Skip to contentSkip to conversation

package/systemd: set cgroups default-hierarchy to unified

PATCH In review Norbert Lange 2 participants 7 messages Dec 3, 2021 – Jan 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 package/systemd: set cgroups default-hierarchy to unified

Use the unified hierarchy, which is systemds default since v243. The biggest holdover was docker which now supports the unified layout.

Note that systemd will automatically fallback to hybrid if the kernel is too old or the unified hierarchy fails for other reasons.

---
v1->v2: no change

---
 package/systemd/systemd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/systemd/systemd.mk +1 -1
index a8b11faa5e..6c57a123bb 100644
@@ -25,7 +25,7 @@ SYSTEMD_SELINUX_MODULES = systemd udev xdg
 SYSTEMD_PROVIDES = udev
 
 SYSTEMD_CONF_OPTS += \
-	-Ddefault-hierarchy=hybrid \
+	-Ddefault-hierarchy=unified \
 	-Didn=true \
 	-Dima=false \
 	-Dkexec-path=/usr/sbin/kexec \
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/4 package/systemd: Update description and kernel options

realign the configuration to the README.

enable CONFIG_AUTOFS_FS (kernel >= 4.18) aswell as the someday to be removed CONFIG_AUTOFS4_FS option.

---
v1->v2: no change

---
 package/systemd/Config.in  | 20 +++++++++++++++-----
 package/systemd/systemd.mk | 16 ++++++++++++----
 2 files changed, 27 insertions(+), 9 deletions(-)
package/systemd/Config.in +15 -5
index 0148cad791..6f622c73f3 100644
@@ -22,7 +22,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	depends on !BR2_STATIC_LIBS # kmod
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_TOOLCHAIN_HAS_SSP
-	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
 	depends on BR2_HOST_GCC_AT_LEAST_5 # host-systemd
 	select BR2_PACKAGE_HAS_UDEV
@@ -51,13 +51,23 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	  an elaborate transactional dependency-based service control
 	  logic.  It can work as a drop-in replacement for sysvinit.
 
-	  Systemd requires a Linux kernel >= 3.0 with the following
+	  Systemd requires a Linux kernel >= 3.13 with the following
 	  options enabled:
 
-	  - CONFIG_CGROUPS
+	  - CONFIG_DEVTMPFS
+	  - CONFIG_CGROUPS (it is OK to disable all controllers)
 	  - CONFIG_INOTIFY_USER
-	  - CONFIG_FHANDLE
-	  - CONFIG_AUTOFS4_FS
+	  - CONFIG_SIGNALFD
+	  - CONFIG_TIMERFD
+	  - CONFIG_EPOLL
+	  - CONFIG_UNIX (it requires CONFIG_NET, but every other flag in it is not necessary)
+	  - CONFIG_SYSFS
+	  - CONFIG_PROC_FS
+	  - CONFIG_FHANDLE (libudev, mount and bind mount handling)
+
+	  - CONFIG_NET_NS (needed by PrivateNetwork=, used in some systemd units)
+
+	  - CONFIG_AUTOFS_FS / CONFIG_AUTOFS4_FS
 	  - CONFIG_TMPFS_POSIX_ACL
 	  - CONFIG_TMPFS_XATTR
 
package/systemd/systemd.mk +12 -4
index 6c57a123bb..373e5c82bb 100644
@@ -648,14 +648,22 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
 SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
 
 define SYSTEMD_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_FHANDLE)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_EPOLL)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_SIGNALFD)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERFD)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER)
-	$(call KCONFIG_ENABLE_OPT,CONFIG_PROC_FS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_EPOLL)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_UNIX)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_SYSFS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PROC_FS)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FHANDLE)
+
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_NS)
+
+	$(call KCONFIG_DISABLE_OPT,CONFIG_SYSFS_DEPRECATED)
+
+	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS_FS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v2 3/4 package/systemd: adopt odering in nsswitch to newer versions

In reply to Norbert Lange

This modifies the order of the nss modules, reflecting the current state of the documentation.

nss-mymachines lost support for resolution of users and groups, and now only does resolution of hostnames. Changed in v246.

Multiple changes in regards to nss-myhostname now recommend placement after nss-files and before nss-dns. See commits ce266330, f918c67.

nss-resolve handles the nss-files logic itself, and its suggested to move in front of nss-files. Changed in v249.

---
 package/systemd/systemd.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
package/systemd/systemd.mk +3 -5
index 373e5c82bb..16202d4ac9 100644
@@ -563,13 +563,11 @@ define SYSTEMD_INSTALL_NSSCONFIG_HOOK
 		-e '/^gshadow:/ {/systemd/! s/$$/ systemd/}' \
 		$(if $(BR2_PACKAGE_SYSTEMD_RESOLVED), \
 			-e '/^hosts:/ s/[[:space:]]*mymachines//' \
-			-e '/^hosts:/ {/resolve/! s/files/files resolve [!UNAVAIL=return]/}' ) \
+			-e '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' ) \
 		$(if $(BR2_PACKAGE_SYSTEMD_MYHOSTNAME), \
-			-e '/^hosts:/ {/myhostname/! s/$$/ myhostname/}' ) \
+			-e '/^hosts:/ {/myhostname/! s/files/files myhostname/}' ) \
 		$(if $(BR2_PACKAGE_SYSTEMD_MACHINED), \
-			-e '/^passwd:/ {/mymachines/! s/files/files mymachines/}' \
-			-e '/^group:/ {/mymachines/! s/files/files [SUCCESS=merge] mymachines/}' \
-			-e '/^hosts:/ {/mymachines/! s/files/files mymachines/}' ) \
+			-e '/^hosts:/ {/mymachines/! s/^\(hosts:[[:space:]]*\)/\1 mymachines/}' ) \
 		$(TARGET_DIR)/etc/nsswitch.conf
 endef
 
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 3/4] package/systemd: adopt odering in nsswitch to newer versions

Quoted 6 lines · Norbert Lange

This modifies the order of the nss modules, reflecting the current state of the documentation.

nss-mymachines lost support for resolution of users and groups, and now only does resolution of hostnames. Changed in v246.

Quoted 7 lines

Multiple changes in regards to nss-myhostname now recommend placement after nss-files and before nss-dns. See commits ce266330, f918c67.

nss-resolve handles the nss-files logic itself, and its suggested to move in front of nss-files. Changed in v249.

This patch was superseded by [1], which is marked as v2 just like this patch.
I hope you understand that this is a little confusing for the maintainers (or for anyone reviewing it).

If you want to make life easier for use, please:

- Re-post the entire series when one patch changes.

- Make sure you include a patch changelog (you do that, I'm just saying it here for completeness). Patches which haven't changed can have a "No changes" version, but personally I don't care too much about that (it's implied by the fact that there is a patch changelog but this particular version is not included). That saves a bit of time during the rebase since you don't have to reword every commit.

- Mark the old series as Superseded in patchwork. When you create an account, you can always update your own patches.

I applied the series (including the [1]) to master. There's one comment I'll
post separately.

Regards,
Arnout

[1] https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 16 lines
---
  package/systemd/systemd.mk | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
package/systemd/systemd.mk +1 -1
index 373e5c82bb..16202d4ac9 100644
@@ -563,13 +563,11 @@ define SYSTEMD_INSTALL_NSSCONFIG_HOOK
  		-e '/^gshadow:/ {/systemd/! s/$$/ systemd/}' \
  		$(if $(BR2_PACKAGE_SYSTEMD_RESOLVED), \
  			-e '/^hosts:/ s/[[:space:]]*mymachines//' \
-			-e '/^hosts:/ {/resolve/! s/files/files resolve [!UNAVAIL=return]/}' ) \
+			-e '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' ) \
  		$(if $(BR2_PACKAGE_SYSTEMD_MYHOSTNAME), \

package/systemd/systemd.mk define SYSTEMD_INSTALL_NSSCONFIG_HOOK · line 573

Quoted 10 lines
package/systemd/systemd.mk +2 -4
-			-e '/^hosts:/ {/myhostname/! s/$$/ myhostname/}' ) \
+			-e '/^hosts:/ {/myhostname/! s/files/files myhostname/}' ) \
  		$(if $(BR2_PACKAGE_SYSTEMD_MACHINED), \
-			-e '/^passwd:/ {/mymachines/! s/files/files mymachines/}' \
-			-e '/^group:/ {/mymachines/! s/files/files [SUCCESS=merge] mymachines/}' \
-			-e '/^hosts:/ {/mymachines/! s/files/files mymachines/}' ) \
+			-e '/^hosts:/ {/mymachines/! s/^\(hosts:[[:space:]]*\)/\1 mymachines/}' ) \
  		$(TARGET_DIR)/etc/nsswitch.conf
  endef
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 3/4] package/systemd: adopt odering in nsswitch to newer versions

Am So., 9. Jan. 2022 um 13:55 Uhr schrieb Arnout Vandecappelle <[email protected]>:

Quoted 13 lines · Norbert Lange
Quoted 9 lines

This modifies the order of the nss modules, reflecting the current state of the documentation.

nss-mymachines lost support for resolution of users and groups, and now only does resolution of hostnames. Changed in v246.

Multiple changes in regards to nss-myhostname now recommend placement after nss-files and before nss-dns. See commits ce266330, f918c67.

Quoted 8 lines
Quoted 4 lines

nss-resolve handles the nss-files logic itself, and its suggested to move in front of nss-files. Changed in v249.

This patch was superseded by [1], which is marked as v2 just like this patch.
I hope you understand that this is a little confusing for the maintainers (or for anyone reviewing it).

Yeah sorry, still got my troubles with the mailing list conventions.

Quoted 11 lines

If you want to make life easier for use, please:

- Re-post the entire series when one patch changes.

- Make sure you include a patch changelog (you do that, I'm just saying it here for completeness). Patches which haven't changed can have a "No changes" version, but personally I don't care too much about that (it's implied by the fact that there is a patch changelog but this particular version is not included). That saves a bit of time during the rebase since you don't have to reword every commit.

ok, so far I thought I should not change the version unless the commit changed.

Quoted 33 lines

- Mark the old series as Superseded in patchwork. When you create an account, you can always update your own patches.

I applied the series (including the [1]) to master. There's one comment I'll
post separately.

Regards,
Arnout

[1]
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 18 lines
---
  package/systemd/systemd.mk | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
package/systemd/systemd.mk +2 -2
index 373e5c82bb..16202d4ac9 100644
@@ -563,13 +563,11 @@ define SYSTEMD_INSTALL_NSSCONFIG_HOOK
              -e '/^gshadow:/ {/systemd/! s/$$/ systemd/}' \
              $(if $(BR2_PACKAGE_SYSTEMD_RESOLVED), \
                      -e '/^hosts:/ s/[[:space:]]*mymachines//' \
-                     -e '/^hosts:/ {/resolve/! s/files/files resolve [!UNAVAIL=return]/}' ) \
+                     -e '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' ) \
              $(if $(BR2_PACKAGE_SYSTEMD_MYHOSTNAME), \
-                     -e '/^hosts:/ {/myhostname/! s/$$/ myhostname/}' ) \
+                     -e '/^hosts:/ {/myhostname/! s/files/files myhostname/}' ) \
              $(if $(BR2_PACKAGE_SYSTEMD_MACHINED), \
Quoted 8 lines

package/systemd/systemd.mk define SYSTEMD_INSTALL_NSSCONFIG_HOOK · line 573

Quoted 8 lines
package/systemd/systemd.mk +1 -3
-                     -e '/^passwd:/ {/mymachines/! s/files/files mymachines/}' \
-                     -e '/^group:/ {/mymachines/! s/files/files [SUCCESS=merge] mymachines/}' \
-                     -e '/^hosts:/ {/mymachines/! s/files/files mymachines/}' ) \
+                     -e '/^hosts:/ {/mymachines/! s/^\(hosts:[[:space:]]*\)/\1 mymachines/}' ) \
              $(TARGET_DIR)/etc/nsswitch.conf
  endef
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH v2 4/4 package/systemd: always enable systemd-tmpfilesd

In reply to Norbert Lange

this tool and service is pretty much expected to be enabled, making this a certainty will enable future improvements.

The config variable BR2_PACKAGE_SYSTEMD_TMPFILES is still availabe and always set.

---
v1->v2
- dont remove the config, instead just set it to 1

---
 package/dhcp/Config.in     | 1 -
 package/systemd/Config.in  | 9 +--------
 package/systemd/systemd.mk | 7 +------
 3 files changed, 2 insertions(+), 15 deletions(-)
package/dhcp/Config.in +0 -1
index e6e70908dd..515040c612 100644
@@ -13,7 +13,6 @@ if BR2_PACKAGE_DHCP
 
 config BR2_PACKAGE_DHCP_SERVER
 	bool "dhcp server"
-	select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
 	help
 	  DHCP server from the ISC DHCP distribution.
 
package/systemd/Config.in +1 -8
index 6f622c73f3..52c86aad59 100644
@@ -485,15 +485,8 @@ config BR2_PACKAGE_SYSTEMD_TIMESYNCD
 	  http://www.freedesktop.org/software/systemd/man/systemd-timesyncd.html
 
 config BR2_PACKAGE_SYSTEMD_TMPFILES
-	bool "enable tmpfiles support"
+	bool
 	default y
-	help
-	  systemd-tmpfiles creates, deletes, and cleans up volatile
-	  and temporary files and directories, based on the
-	  configuration file format and location specified in
-	  tmpfiles.d(5).
-
-	  http://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html
 
 config BR2_PACKAGE_SYSTEMD_USERDB
 	bool "enable userdb daemon"
package/systemd/systemd.mk +1 -6
index 16202d4ac9..dfe9a1a5c7 100644
@@ -49,6 +49,7 @@ SYSTEMD_CONF_OPTS += \
 	-Dsysvrcnd-path= \
 	-Dtelinit-path= \
 	-Dtests=false \
+	-Dtmpfiles=true \
 	-Dumount-path=/usr/bin/umount \
 	-Dutmp=false
 
@@ -307,12 +308,6 @@ else
 SYSTEMD_CONF_OPTS += -Dquotacheck=false
 endif
 
-ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
-SYSTEMD_CONF_OPTS += -Dtmpfiles=true
-else
-SYSTEMD_CONF_OPTS += -Dtmpfiles=false
-endif
-
 ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
 SYSTEMD_CONF_OPTS += -Dsysusers=true
 else
Signature · 6 lines
2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH v2 4/4] package/systemd: always enable systemd-tmpfilesd

Quoted 5 lines · Norbert Lange

this tool and service is pretty much expected to be enabled, making this a certainty will enable future improvements.

The config variable BR2_PACKAGE_SYSTEMD_TMPFILES is still availabe and always set.

I don't understand why it's not simply removed. (The commit message should
primarily explain *why* things are done, not so much *what* is done.)

Since I think that the symbol can be removed entirely, I pushed a follow-up
patch that
- removes the symbol;
- removes its use in cryptsetup.mk;
- adds it in Config.in.legacy, with an explanation of what to do if it's used in br2-external.

It's a separate commit, so if you think that it really shouldn't have been
removed we can easily revert it.

Regards,
Arnout

Quoted 60 lines

---
v1->v2

(quoted diff) +0 -2
-   dont remove the config, instead just set it to 1
---
  package/dhcp/Config.in     | 1 -
  package/systemd/Config.in  | 9 +--------
  package/systemd/systemd.mk | 7 +------
  3 files changed, 2 insertions(+), 15 deletions(-)
package/dhcp/Config.in +0 -1
index e6e70908dd..515040c612 100644
@@ -13,7 +13,6 @@ if BR2_PACKAGE_DHCP
 
  config BR2_PACKAGE_DHCP_SERVER
  	bool "dhcp server"
-	select BR2_PACKAGE_SYSTEMD_TMPFILES if BR2_PACKAGE_SYSTEMD
  	help
  	  DHCP server from the ISC DHCP distribution.
 
package/systemd/Config.in +1 -8
index 6f622c73f3..52c86aad59 100644
@@ -485,15 +485,8 @@ config BR2_PACKAGE_SYSTEMD_TIMESYNCD
  	  http://www.freedesktop.org/software/systemd/man/systemd-timesyncd.html
 
  config BR2_PACKAGE_SYSTEMD_TMPFILES
-	bool "enable tmpfiles support"
+	bool
  	default y
-	help
-	  systemd-tmpfiles creates, deletes, and cleans up volatile
-	  and temporary files and directories, based on the
-	  configuration file format and location specified in
-	  tmpfiles.d(5).
-
-	  http://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html
 
  config BR2_PACKAGE_SYSTEMD_USERDB
  	bool "enable userdb daemon"
package/systemd/systemd.mk +1 -0
index 16202d4ac9..dfe9a1a5c7 100644
@@ -49,6 +49,7 @@ SYSTEMD_CONF_OPTS += \
  	-Dsysvrcnd-path= \
  	-Dtelinit-path= \
  	-Dtests=false \
+	-Dtmpfiles=true \
  	-Dumount-path=/usr/bin/umount \
  	-Dutmp=false
 
@@ -307,12 +308,6 @@ else
  SYSTEMD_CONF_OPTS += -Dquotacheck=false
  endif

package/systemd/systemd.mk else · line 313

Quoted 10 lines
package/systemd/systemd.mk +0 -6
 
-ifeq ($(BR2_PACKAGE_SYSTEMD_TMPFILES),y)
-SYSTEMD_CONF_OPTS += -Dtmpfiles=true
-else
-SYSTEMD_CONF_OPTS += -Dtmpfiles=false
-endif
-
  ifeq ($(BR2_PACKAGE_SYSTEMD_SYSUSERS),y)
  SYSTEMD_CONF_OPTS += -Dsysusers=true
  else

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot