Skip to contentSkip to conversation

systemd: upgrade to 255.1

PATCH In review [email protected] 4 participants 22 messages Dec 27, 2023 – Jan 22, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 systemd: upgrade to 255.1

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---
 ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
 rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)
meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
 
 use [Install] blocks so that they get created when the service is enabled
 like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
 --- a/units/meson.build
 +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',
 diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
 +[Install]
 +WantedBy=sysinit.target
 diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
 --- a/units/systemd-binfmt.service.in
 +++ b/units/systemd-binfmt.service.in
 @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 -- 
-2.39.2
+2.34.1
 
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73

73 lines not on this page · raw message

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
 # The 60 seconds is watchdog's default vaule.
 WATCHDOG_TIMEOUT ??= "60"
 
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 systemd-boot: upgrade to 255.1

From: Chen Qi <[email protected]>

0030-meson-Pass-all-static-pie-args-to-linker.patch is dropped as it's a backported patch and is now in the new 255.1 version.

---
 ...md-boot_254.4.bb => systemd-boot_255.1.bb} |  4 ---
 ...n-Pass-all-static-pie-args-to-linker.patch | 35 -------------------
 2 files changed, 39 deletions(-)
 rename meta/recipes-core/systemd/{systemd-boot_254.4.bb => systemd-boot_255.1.bb} (94%)
 delete mode 100644 meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch
meta/recipes-core/systemd/systemd-boot_255.1.bb renamed from meta/recipes-core/systemd/systemd-boot_254.4.bb +0 -4
similarity index 94%
rename from meta/recipes-core/systemd/systemd-boot_254.4.bb
rename to meta/recipes-core/systemd/systemd-boot_255.1.bb
index 2b43ccf243..4ee25ee72f 100644
@@ -8,10 +8,6 @@ DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native
 inherit meson pkgconfig gettext
 inherit deploy
 
-SRC_URI += " \
-           file://0030-meson-Pass-all-static-pie-args-to-linker.patch \
-           "
-
 LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
 
 EFI_LD = "bfd"
meta/recipes-core/systemd/systemd/0030-meson-Pass-all-static-pie-args-to-linker.patch deleted +0 -35
deleted file mode 100644
index 8e563238ef..0000000000
@@ -1,35 +0,0 @@
-From f85a387a67900b02c69abccb88c2ef7191c67277 Mon Sep 17 00:00:00 2001
-From: Jan Janssen <[email protected]>
-Date: Sun, 1 Oct 2023 09:55:48 +0200
-Subject: [PATCH] meson: Pass all -static-pie args to linker
-
-Fixes: #29381
-
-Upstream-Status: Backport [https://github.com/systemd/systemd/commit/cecbb162a3134b43d2ca160e13198c73ff34c3ef]
-Signed-off-by: Viswanath Kraleti <[email protected]>
----
- src/boot/efi/meson.build | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
-index 2773eaf286..9a60a57329 100644
---- a/src/boot/efi/meson.build
-+++ b/src/boot/efi/meson.build
-@@ -161,9 +161,14 @@ efi_c_ld_args = [
-         '-Wl,--entry=efi_main',
-         '-Wl,--fatal-warnings',
- 
--        # These flags should be passed by -static-pie, but seem to be missing sometimes.
--        '-Wl,--no-dynamic-linker',
--        '-z', 'text',
-+        # These flags should be passed by -static-pie, but for whatever reason the flag translation
-+        # is not enabled on all architectures. Not passing `-static` would just allow the linker to
-+        # use dynamic libraries, (which we can't/don't use anyway). But if `-pie` is missing and the
-+        # gcc build does not default to `-pie` we get a regular (no-pie) binary that will be
-+        # rightfully rejected by elf2efi. Note that meson also passes `-pie` to the linker driver,
-+        # but it is overridden by our `-static-pie`. We also need to pass these directly to the
-+        # linker as `-static`+`-pie` seem to get translated differently.
-+        '-Wl,-static,-pie,--no-dynamic-linker,-z,text',
- 
-         # EFI has 4KiB pages.
-         '-z', 'common-page-size=4096',
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 rootfs-postcommands.bbclass: ignore comment mismatch in systemd_user_check

In reply to [email protected]

From: Chen Qi <[email protected]>

The check was forcing every field to be identical, this is too strict. For example, if the comment differs, there's really no impact. For example, root user's comment is 'root' in passwd, and it's 'Super User' in sysusers.d/basic.conf. Such difference is not worth a warning. In fact, previous codes use 'lower()' to avoid warning between 'nobody' and 'Nobody', and what's more, another patch puts its own basic.conf.in in systemd's SRC_URI, but it changes 'Super User' to 'root'. Such changes are all unnecessary. We should just ignore comment mismatch.

---
 meta/classes-recipe/rootfs-postcommands.bbclass | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/classes-recipe/rootfs-postcommands.bbclass +1 -2
index 29ee74932a..f996b6c71a 100644
@@ -111,12 +111,11 @@ def compare_users(user, e_user):
     # user and e_user must not have None values. Unset values must be '-'.
     (name, uid, gid, comment, homedir, ushell) = user
     (e_name, e_uid, e_gid, e_comment, e_homedir, e_ushell) = e_user
-    # Ignore 'uid', 'gid' or 'comment' if they are not set
+    # Ignore 'uid', 'gid' or 'homedir' if they are not set
     # Ignore 'shell' and 'ushell' if one is not set
     return name == e_name \
         and (uid == '-' or uid == e_uid) \
         and (gid == '-' or gid == e_gid) \
-        and (comment == '-' or e_comment == '-' or comment.lower() == e_comment.lower()) \
         and (homedir == '-' or e_homedir == '-' or homedir == e_homedir) \
         and (ushell == '-' or e_ushell == '-' or ushell == e_ushell)
 
Signature · 1 line
2.34.1
#3 lore raw
In reply to [email protected]

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/warnings

Quoted 350 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---
 ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
 rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)
meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
 
 use [Install] blocks so that they get created when the service is enabled
 like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
 --- a/units/meson.build
 +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',
 diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
 +[Install]
 +WantedBy=sysinit.target
 diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
 --- a/units/systemd-binfmt.service.in
 +++ b/units/systemd-binfmt.service.in
 @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 -- 
-2.39.2
+2.34.1
 
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
- 
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
- 
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
- 
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
- 
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
- 
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
- 
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
--- 
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
 # The 60 seconds is watchdog's default vaule.
 WATCHDOG_TIMEOUT ??= "60"
 
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#4 lore raw

I double checked it in my environment, setting INIT_MANAGER to "systemd" and then 'bitbake systemd' will not generate this warning. In this case ROOT_HOME's value is "/root". I checked https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354, but I couldn't find the configuration items that set the init manager to systemd. Does the build use the variable 'INIT_MANAGER'? Does it set ROOT_HOME to "/home/root" somewhere?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Wednesday, December 27, 2023 7:59 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/warnings

Quoted 375 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in, 
which is not enough to be treated as 'fully support'. I deliberately 
put a warning message in do_install to warn users about non "/root" 
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---  
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode 

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

(quoted diff) +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 

2001

(quoted diff) +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

(quoted diff) +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index 

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index 
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7 
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index 
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 

2001

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to 

/usr

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -14
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto, 
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index 

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c 

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it 
-#  under the terms of the GNU Lesser General Public License as 

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec 

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Please do a musl build too. We might have some patch conflicts to address.

Quoted 406 lines · Chen Qi via lists.openembedded.org

I double checked it in my environment, setting INIT_MANAGER to "systemd" and then 'bitbake systemd' will not generate this warning. In this case ROOT_HOME's value is "/root". I checked https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354, but I couldn't find the configuration items that set the init manager to systemd. Does the build use the variable 'INIT_MANAGER'? Does it set ROOT_HOME to "/home/root" somewhere?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Wednesday, December 27, 2023 7:59 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/warnings

Quoted 363 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in
tmpfiles.d/provision.conf units/emergency.service.in
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately
put a warning message in do_install to warn users about non "/root"
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb =>

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"

diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install

time for
- the binfmt services

meta/recipes-core/systemd/systemd.inc +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is

enabled like a traditional service.

meta/recipes-core/systemd/systemd.inc +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd.inc +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd.inc +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 

diff --git a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to

/usr

meta/recipes-core/systemd/systemd.inc +0 -14
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd.inc +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd.inc +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in >

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
      meson_do_install
+     # Change the root user's home directory in /lib/sysusers.d/basic.conf.
+     # This is done merely for backward compatibility with previous systemd recipes.
+     # systemd hardcodes root user's HOME to be "/root". Changing to use other values
+     # may have unexpected runtime behaviors.
+     if [ "${ROOT_HOME}" != "/root" ]; then
+             bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+             sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+     fi
      install -d ${D}/${base_sbindir}
      if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
              # Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--
Quoted 6 lines

2.34.1

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192970): https://lists.openembedded.org/g/openembedded-core/message/192970
Mute This Topic: https://lists.openembedded.org/mt/103380516/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#6 lore raw

Hi Khem,

I'm working on some other issue these two days. But I think I can send out a follow-up patch to handle those musl patches after New Year's Day.

Regards,
Qi

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: Thursday, December 28, 2023 11:20 AM
To: Chen, Qi <[email protected]>
Cc: Alexandre Belloni <[email protected]>; [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

Please do a musl build too. We might have some patch conflicts to address.

Quoted 419 lines · Chen Qi via lists.openembedded.org

I double checked it in my environment, setting INIT_MANAGER to "systemd" and then 'bitbake systemd' will not generate this warning. In this case ROOT_HOME's value is "/root". I checked https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354, but I couldn't find the configuration items that set the init manager to systemd. Does the build use the variable 'INIT_MANAGER'? Does it set ROOT_HOME to "/home/root" somewhere?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Wednesday, December 27, 2023 7:59 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354
/steps/14/logs/warnings

Quoted 366 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME
value, so if users set ROOT_HOME to "/home/root", the behavior is
the same as before. However, this is only for backward
compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and
other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting 
sysusers.d/basic.conf.in, which is not enough to be treated as 
'fully support'. I deliberately put a warning message in do_install to warn users about non "/root"
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++--- 
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"

diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-de +++ pe ndency-links-at-install-tim.patch

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

meta/recipes-core/systemd/systemd.inc +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd.inc +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ 
index
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ 
index
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd.inc +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd.inc +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 

diff --git a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch
+++ /dev/null

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d 

to /usr

meta/recipes-core/systemd/systemd.inc +0 -3
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in 

oe-core/yocto, -the old /usr/lib is still being used.

meta/recipes-core/systemd/systemd.inc +0 -10
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd.inc +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd.inc +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -3
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify 

it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += 

"-Dkexec-path=${sbindir}/kexec \ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +8 -1
-
 do_install() {
      meson_do_install
+     # Change the root user's home directory in /lib/sysusers.d/basic.conf.
+     # This is done merely for backward compatibility with previous systemd recipes.
+     # systemd hardcodes root user's HOME to be "/root". Changing to use other values
+     # may have unexpected runtime behaviors.
+     if [ "${ROOT_HOME}" != "/root" ]; then
+             bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+             sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+     fi
      install -d ${D}/${base_sbindir}
      if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
              # Provided by a separate recipe @@ -754,6 +757,7 @@ 
FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \

${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \

Quoted 13 lines

${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+

+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \

--
2.34.1

--
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#192970):
https://lists.openembedded.org/g/openembedded-core/message/192970
Mute This Topic: https://lists.openembedded.org/mt/103380516/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw
In reply to Chen, Qi
Quoted 4 lines · Qi

I double checked it in my environment, setting INIT_MANAGER to "systemd" and then 'bitbake systemd' will not generate this warning. In this case ROOT_HOME's value is "/root". I checked https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354, but I couldn't find the configuration items that set the init manager to systemd. Does the build use the variable 'INIT_MANAGER'? Does it set ROOT_HOME to "/home/root" somewhere?

This is the config that is used:

MACHINE = "qemux86-64"
DISTRO = "poky"
SDKMACHINE = "x86_64"
PACKAGE_CLASSES = "package_rpm package_deb package_ipk"
DL_DIR = '/srv/autobuilder/autobuilder.yocto.io/current_sources'
SSTATE_DIR ?= '/srv/autobuilder/autobuilder.yocto.io/pub/sstate'
TEST_SUITES:append = ' systemd'
DISTRO_FEATURES:append = ' pam systemd usrmerge'
VIRTUAL-RUNTIME_init_manager = 'systemd'
DISTRO_FEATURES_BACKFILL_CONSIDERED = 'sysvinit'
DISTRO_FEATURES:remove = 'x11'
QEMU_USE_KVM = 'True'
INHERIT += 'report-error'
PREMIRRORS = ''
BB_GENERATE_MIRROR_TARBALLS = '1'
BB_NUMBER_THREADS = '16'
BB_NUMBER_PARSE_THREADS = '16'
PARALLEL_MAKE = '-j 16 -l 52'
BB_PRESSURE_MAX_CPU = '10000'
BB_PRESSURE_MAX_IO = '10000'
XZ_MEMLIMIT = '5%'
XZ_THREADS = '8'
ZSTD_THREADS = '8'
BB_TASK_NICE_LEVEL = '5'
BB_TASK_NICE_LEVEL:task-testimage = '0'
BB_TASK_IONICE_LEVEL = '2.7'
BB_TASK_IONICE_LEVEL:task-testimage = '2.1'
IMAGE_CLASSES += 'testimage'
TEST_QEMUBOOT_TIMEOUT = '1500'
SANITY_TESTED_DISTROS = ''
SDK_EXT_TYPE = 'minimal'
SDK_INCLUDE_TOOLCHAIN = '1'
ESDK_LOCAL_CONF_REMOVE:append = 'BB_HASHSERVE'
BB_DISKMON_DIRS = 'STOPTASKS,${TMPDIR},1G,100K STOPTASKS,${DL_DIR},1G STOPTASKS,${SSTATE_DIR},1G STOPTASKS,/tmp,100M,30K HALT,${TMPDIR},100M,1K HALT,${DL_DIR},100M HALT,${SSTATE_DIR},100M HALT,/tmp,10M,1K' BB_HASHSERVE = 'hashserv.yocto.io:8686'
RUNQEMU_TMPFS_DIR = '/home/pokybuild/tmp'
BB_HEARTBEAT_EVENT = '60'
BB_LOG_HOST_STAT_ON_INTERVAL = '1'
BB_LOG_HOST_STAT_CMDS_INTERVAL = 'oe-time-dd-test.sh -c 100 -t 3'
BB_LOG_HOST_STAT_ON_FAILURE = '1'
BB_LOG_HOST_STAT_CMDS_FAILURE = 'oe-time-dd-test.sh -l'
SDK_TOOLCHAIN_LANGS += 'rust'
BB_SERVER_TIMEOUT = '60'

It is in auto.conf and it is displayed in the first lines of
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/stdio

Quoted 398 lines

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Wednesday, December 27, 2023 7:59 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/warnings

Quoted 375 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in, 
which is not enough to be treated as 'fully support'. I deliberately 
put a warning message in do_install to warn users about non "/root" 
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---  
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode 

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

(quoted diff) +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 

2001

(quoted diff) +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

(quoted diff) +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index 

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index 
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7 
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index 
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 

2001

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to 

/usr

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -14
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto, 
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index 

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c 

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it 
-#  under the terms of the GNU Lesser General Public License as 

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec 

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#8 lore raw
Quoted 14 lines · Alexandre Belloni
Quoted 4 lines · Qi

I double checked it in my environment, setting INIT_MANAGER to "systemd" and then 'bitbake systemd' will not generate this warning. In this case ROOT_HOME's value is "/root". I checked https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354, but I couldn't find the configuration items that set the init manager to systemd. Does the build use the variable 'INIT_MANAGER'? Does it set ROOT_HOME to "/home/root" somewhere?

This is the config that is used:

MACHINE = "qemux86-64"
DISTRO = "poky"
SDKMACHINE = "x86_64"
PACKAGE_CLASSES = "package_rpm package_deb package_ipk" DL_DIR = '/srv/autobuilder/autobuilder.yocto.io/current_sources' SSTATE_DIR ?= '/srv/autobuilder/autobuilder.yocto.io/pub/sstate'

Quoted 4 lines

TEST_SUITES:append = ' systemd'
DISTRO_FEATURES:append = ' pam systemd usrmerge'
VIRTUAL-RUNTIME_init_manager = 'systemd'
DISTRO_FEATURES_BACKFILL_CONSIDERED = 'sysvinit'

OK, I see.

I'd suggest replacing the above 4 lines with a single line:

INIT_MANAGER = "systemd"

The INIT_MANAGER mechanism was added to make switching init managers easier.

Another choice is adding the following line to sync with the meta/conf/distro/include/init-manager-systemd.inc settings.

ROOT_HOME ?= "/root"

Regards,

Qi

Quoted 432 lines

DISTRO_FEATURES:remove = 'x11'
QEMU_USE_KVM = 'True'
INHERIT += 'report-error'
PREMIRRORS = ''
BB_GENERATE_MIRROR_TARBALLS = '1'
BB_NUMBER_THREADS = '16'
BB_NUMBER_PARSE_THREADS = '16'
PARALLEL_MAKE = '-j 16 -l 52'
BB_PRESSURE_MAX_CPU = '10000'
BB_PRESSURE_MAX_IO = '10000'
XZ_MEMLIMIT = '5%'
XZ_THREADS = '8'
ZSTD_THREADS = '8'
BB_TASK_NICE_LEVEL = '5'
BB_TASK_NICE_LEVEL:task-testimage = '0'
BB_TASK_IONICE_LEVEL = '2.7'
BB_TASK_IONICE_LEVEL:task-testimage = '2.1'
IMAGE_CLASSES += 'testimage'
TEST_QEMUBOOT_TIMEOUT = '1500'
SANITY_TESTED_DISTROS = ''
SDK_EXT_TYPE = 'minimal'
SDK_INCLUDE_TOOLCHAIN = '1'
ESDK_LOCAL_CONF_REMOVE:append = 'BB_HASHSERVE'
BB_DISKMON_DIRS = 'STOPTASKS,${TMPDIR},1G,100K STOPTASKS,${DL_DIR},1G STOPTASKS,${SSTATE_DIR},1G STOPTASKS,/tmp,100M,30K HALT,${TMPDIR},100M,1K HALT,${DL_DIR},100M HALT,${SSTATE_DIR},100M HALT,/tmp,10M,1K' BB_HASHSERVE = 'hashserv.yocto.io:8686'
RUNQEMU_TMPFS_DIR = '/home/pokybuild/tmp'
BB_HEARTBEAT_EVENT = '60'
BB_LOG_HOST_STAT_ON_INTERVAL = '1'
BB_LOG_HOST_STAT_CMDS_INTERVAL = 'oe-time-dd-test.sh -c 100 -t 3'
BB_LOG_HOST_STAT_ON_FAILURE = '1'
BB_LOG_HOST_STAT_CMDS_FAILURE = 'oe-time-dd-test.sh -l'
SDK_TOOLCHAIN_LANGS += 'rust'
BB_SERVER_TIMEOUT = '60'

It is in auto.conf and it is displayed in the first lines of
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/stdio

Quoted 395 lines

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Wednesday, December 27, 2023 7:59 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

We hit the added warning on the autobuilders:

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/8354/steps/14/logs/warnings

Quoted 373 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in
tmpfiles.d/provision.conf units/emergency.service.in
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately
put a warning message in do_install to warn users about non "/root"
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
  .../distro/include/init-manager-systemd.inc   |  2 +
  meta/recipes-core/systemd/systemd.inc         |  4 +-
  ...tall-dependency-links-at-install-tim.patch | 22 +++---
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
  .../systemd/systemd/basic.conf.in             | 40 ----------
  .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
  6 files changed, 25 insertions(+), 132 deletions(-)  delete mode

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
rename meta/recipes-core/systemd/{systemd_254.4.bb =>
systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
  VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
  VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
  VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
  LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                      file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
  SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
  S = "${WORKDIR}/git"

diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00
+2001
  From: Chen Qi <[email protected]>
  Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install

time for
- the binfmt services

meta/recipes-core/systemd/systemd.inc +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at
+install time  for the binfmt services
 
  use [Install] blocks so that they get created when the service is

enabled like a traditional service.

meta/recipes-core/systemd/systemd.inc +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
   3 files changed, 7 insertions(+), 2 deletions(-)
 
  diff --git a/units/meson.build b/units/meson.build -index

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

           {
             'file' : 'proc-sys-fs-binfmt_misc.automount',
             'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index
c7939a10f8..219570ab19 100644
           },
           {
             'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
           {
             'file' : 'systemd-binfmt.service.in',
             'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index
c7939a10f8..219570ab19 100644
           {
             'file' : 'systemd-bless-boot.service.in',  diff --git

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd.inc +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
  --- a/units/proc-sys-fs-binfmt_misc.automount
  +++ b/units/proc-sys-fs-binfmt_misc.automount
  @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd.inc +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
   After=proc-sys-fs-binfmt_misc.mount
   After=local-fs.target
  @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
   TimeoutSec=90s
  +
  +[Install]
  +WantedBy=sysinit.target
  --
-2.39.2
+2.34.1
 

diff --git a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to

/usr

meta/recipes-core/systemd/systemd.inc +0 -14
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd.inc +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd.inc +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
  SRC_URI += " \
             file://touchscreen.rules \
             file://00-create-volatile.conf \
-           file://basic.conf.in \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
             file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
             file://systemd-pager.sh \
             file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
             file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
             "
 
  # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
      ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
      backlight \
      binfmt \
+    cgroupv2 \
      gshadow \
      hibernate \
      hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in >

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
  do_install() {
  	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
  	install -d ${D}/${base_sbindir}
  	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
  		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw
Quoted 5 lines · Chen Qi via lists.openembedded.org
Quoted 4 lines

TEST_SUITES:append = ' systemd'
DISTRO_FEATURES:append = ' pam systemd usrmerge'
VIRTUAL-RUNTIME_init_manager = 'systemd'
DISTRO_FEATURES_BACKFILL_CONSIDERED = 'sysvinit'

Quoted 7 lines

OK, I see.

I'd suggest replacing the above 4 lines with a single line:

INIT_MANAGER = "systemd"

The INIT_MANAGER mechanism was added to make switching init managers easier.

I agree. The 4 lines are defined in two places here:
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json

Can you send a patch to replace them with INIT_MANAGER?

Alex

author
#10 lore raw

OK, I'll do it after New Year's Day.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: Friday, December 29, 2023 4:04 PM
To: Chen, Qi <[email protected]>
Cc: Alexandre Belloni <[email protected]>; [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

Quoted 5 lines · Chen Qi via lists.openembedded.org
Quoted 4 lines

TEST_SUITES:append = ' systemd'
DISTRO_FEATURES:append = ' pam systemd usrmerge'
VIRTUAL-RUNTIME_init_manager = 'systemd'
DISTRO_FEATURES_BACKFILL_CONSIDERED = 'sysvinit'

Quoted 7 lines

OK, I see.

I'd suggest replacing the above 4 lines with a single line:

INIT_MANAGER = "systemd"

The INIT_MANAGER mechanism was added to make switching init managers easier.

I agree. The 4 lines are defined in two places here:
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json

Can you send a patch to replace them with INIT_MANAGER?

Alex

#11 lore raw
In reply to [email protected]

Hello,

This fails with:

https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/7361/steps/12/logs/warnings

WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)

Quoted 350 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---
 ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
 rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)
meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
 
 use [Install] blocks so that they get created when the service is enabled
 like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
 --- a/units/meson.build
 +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',
 diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
 +[Install]
 +WantedBy=sysinit.target
 diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
 --- a/units/systemd-binfmt.service.in
 +++ b/units/systemd-binfmt.service.in
 @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 -- 
-2.39.2
+2.34.1
 
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
- 
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
- 
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
- 
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
- 
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
- 
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
- 
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
--- 
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
 # The 60 seconds is watchdog's default vaule.
 WATCHDOG_TIMEOUT ??= "60"
 
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#12 lore raw

Another patch in this series fixes the warning:
rootfs-postcommands.bbclass: ignore comment mismatch in systemd_user_check

Is that patch also staged?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Saturday, January 6, 2024 12:02 AM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

Hello,

This fails with:

https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/7361/steps/12/logs/warnings

WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)

Quoted 375 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in, 
which is not enough to be treated as 'fully support'. I deliberately 
put a warning message in do_install to warn users about non "/root" 
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---  
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode 

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

(quoted diff) +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 

2001

(quoted diff) +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

(quoted diff) +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index 

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index 
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7 
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index 
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 

2001

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to 

/usr

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -14
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto, 
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index 

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c 

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it 
-#  under the terms of the GNU Lesser General Public License as 

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec 

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#13 lore raw

I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8420/steps/25/logs/stdio

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

Quoted 414 lines · Chen Qi via lists.openembedded.org

Another patch in this series fixes the warning:
rootfs-postcommands.bbclass: ignore comment mismatch in systemd_user_check

Is that patch also staged?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Saturday, January 6, 2024 12:02 AM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

Hello,

This fails with:

https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/7361/steps/12/logs/warnings

WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)

Quoted 369 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in, 
which is not enough to be treated as 'fully support'. I deliberately 
put a warning message in do_install to warn users about non "/root" 
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++---  
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode 

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependen cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depe +++ ndency-links-at-install-tim.patch

(quoted diff) +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 

2001

(quoted diff) +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

(quoted diff) +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index 

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ index 
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7 
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ index 
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644 +index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 
(quoted diff) +0 -0

a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt.d-modules-load.d-to-.patch
+++ /dev/null

(quoted diff) +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 

2001

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to 

/usr

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -14
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto, 
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index 

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c 

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -4
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it 
-#  under the terms of the GNU Lesser General Public License as 

published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec 

\ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--

2.34.1

Signature · 12 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#193387): https://lists.openembedded.org/g/openembedded-core/message/193387
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#14 lore raw

I just sent out a patch for the yocto-autobuilder-helper repo to use '/root' as the ROOT_HOME's value in case of 'sysvinit with systemd'.

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Tuesday, January 9, 2024 3:47 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8420/steps/25/logs/stdio

WARNING: systemd-1_255.1-r0 do_install: Using /home/root as root user's home directory is not fully supported by systemd

Quoted 432 lines · Chen Qi via lists.openembedded.org

Another patch in this series fixes the warning:
rootfs-postcommands.bbclass: ignore comment mismatch in systemd_user_check

Is that patch also staged?

Regards,
Qi

-----Original Message-----
From: Alexandre Belloni <[email protected]>
Sent: Saturday, January 6, 2024 12:02 AM
To: Chen, Qi <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH 1/3] systemd: upgrade to 255.1

Hello,

This fails with:

https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/736
1/steps/12/logs/warnings

WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-full-cmdline-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User root has been defined as (root, 0, 0, root, /root, /bin/sh) but sysusers.d expects it as (root, 0, 0, Super User, /root, -)
WARNING: core-image-sato-sdk-1.0-r0 do_rootfs: User nobody has been defined as (nobody, 65534, 65534, nobody, /nonexistent, /usr/sbin/nologin) but sysusers.d expects it as (nobody, 65534, 65534, Kernel Overflow User, -, -)

Quoted 373 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME
value, so if users set ROOT_HOME to "/home/root", the behavior is
the same as before. However, this is only for backward
compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and
other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ 
tmpfiles.d/ units/ xorg/ tools/ sysusers.d/basic.conf.in 
tmpfiles.d/provision.conf units/emergency.service.in 
units/rescue.service.in tools/list-discoverable-partitions.py
Previously, the recipe was just substituting 
sysusers.d/basic.conf.in, which is not enough to be treated as 
'fully support'. I deliberately put a warning message in do_install to warn users about non "/root"
ROOT_HOME value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
 .../distro/include/init-manager-systemd.inc   |  2 +
 meta/recipes-core/systemd/systemd.inc         |  4 +-
 ...tall-dependency-links-at-install-tim.patch | 22 +++--- 
...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
 .../systemd/systemd/basic.conf.in             | 40 ----------
 .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
 6 files changed, 25 insertions(+), 132 deletions(-)  delete mode

100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binf mt .d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in

 rename meta/recipes-core/systemd/{systemd_254.4.bb => 

systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
 VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
 VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
 VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not 
+offically supported ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                     file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
 SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
 S = "${WORKDIR}/git"

diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch
index 085f1e9052..be231cf6b2 100644
---
a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-depend en
cy-links-at-install-tim.patch
+++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-de +++ pe ndency-links-at-install-tim.patch

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +2 -1
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00
+2001
 From: Chen Qi <[email protected]>
 Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install 

time for
- the binfmt services

meta/recipes-core/systemd/systemd.inc +2 -0
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at 
+install time  for the binfmt services
 
 use [Install] blocks so that they get created when the service is 

enabled like a traditional service.

meta/recipes-core/systemd/systemd.inc +0 -0
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
  3 files changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/units/meson.build b/units/meson.build -index

c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
--- a/units/meson.build
+++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [

          {
            'file' : 'proc-sys-fs-binfmt_misc.automount',
            'conditions' : ['ENABLE_BINFMT'], @@ -36,7 +36,7 @@ 
index
c7939a10f8..219570ab19 100644
          },
          {
            'file' : 'proc-sys-fs-binfmt_misc.mount', -@@ -246,7
+245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
          {
            'file' : 'systemd-binfmt.service.in',
            'conditions' : ['ENABLE_BINFMT'], @@ -45,7 +45,7 @@ 
index
c7939a10f8..219570ab19 100644
          {
            'file' : 'systemd-bless-boot.service.in',  diff --git 

a/units/proc-sys-fs-binfmt_misc.automount
b/units/proc-sys-fs-binfmt_misc.automount

meta/recipes-core/systemd/systemd.inc +1 -1
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
 --- a/units/proc-sys-fs-binfmt_misc.automount
 +++ b/units/proc-sys-fs-binfmt_misc.automount
 @@ -22,3 +22,6 @@ Before=shutdown.target @@ -56,7 +56,7 @@ index 

6b1bbdc91e..5ec5b8670a 100644 +[Install] +WantedBy=sysinit.target

(quoted diff) +0 -0

b/units/systemd-binfmt.service.in -index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
--- a/units/systemd-binfmt.service.in +++
b/units/systemd-binfmt.service.in @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html

meta/recipes-core/systemd/systemd.inc +3 -3
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
  After=proc-sys-fs-binfmt_misc.mount
  After=local-fs.target
 @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
  TimeoutSec=90s
 +
 +[Install]
 +WantedBy=sysinit.target
 --
-2.39.2
+2.34.1
 

diff --git a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch b/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch
deleted file mode 100644
index 98914ae154..0000000000
---
a/meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-bi nf
mt.d-modules-load.d-to-.patch
+++ /dev/null

meta/recipes-core/systemd/systemd.inc +0 -1
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00

2001

meta/recipes-core/systemd/systemd.inc +0 -3
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d 

to /usr

meta/recipes-core/systemd/systemd.inc +0 -3
-
-These directories are moved to /lib since systemd v246, commit 
-4a56315a990b ("path: use ROOTPREFIX properly"), but in 

oe-core/yocto, -the old /usr/lib is still being used.

meta/recipes-core/systemd/systemd.inc +0 -10
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index

693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}

meta/recipes-core/systemd/systemd.inc +0 -21
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c

b/src/libsystemd/sd-path/sd-path.c

meta/recipes-core/systemd/systemd.inc +0 -30
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
- 
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
- 
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
- 
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
- 
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
- 
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -3
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify 

it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version.

meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -34
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -2
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
 SRC_URI += " \
            file://touchscreen.rules \
            file://00-create-volatile.conf \
-           file://basic.conf.in \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
            ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
            file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
            "
 
 # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    cgroupv2 \
     gshadow \
     hibernate \
     hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += 

"-Dkexec-path=${sbindir}/kexec \ # The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +0 -2
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > 

${S}/sysusers.d/basic.conf.in -}

meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -2
-
 do_install() {
 	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
 	install -d ${D}/${base_sbindir}
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
 		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
 
 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
--
Quoted 6 lines

2.34.1

--
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com

Quoted 10 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#193387):
https://lists.openembedded.org/g/openembedded-core/message/193387
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com

author
#15 lore raw
In reply to [email protected]

What's the status of this patch series?
Is there any issue or concern that I missed?

Regards,
Qi

Quoted 346 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
  .../distro/include/init-manager-systemd.inc   |  2 +
  meta/recipes-core/systemd/systemd.inc         |  4 +-
  ...tall-dependency-links-at-install-tim.patch | 22 +++---
  ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
  .../systemd/systemd/basic.conf.in             | 40 ----------
  .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
  6 files changed, 25 insertions(+), 132 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
  VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
  VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
  VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
  LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                      file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
 
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
  SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
 
  S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
  From: Chen Qi <[email protected]>
  Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
 
  use [Install] blocks so that they get created when the service is enabled
  like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
   3 files changed, 7 insertions(+), 2 deletions(-)
 
  diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
  --- a/units/meson.build
  +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
           {
             'file' : 'proc-sys-fs-binfmt_misc.automount',
             'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
           },
           {
             'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
           {
             'file' : 'systemd-binfmt.service.in',
             'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
           {
             'file' : 'systemd-bless-boot.service.in',
  diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
  --- a/units/proc-sys-fs-binfmt_misc.automount
  +++ b/units/proc-sys-fs-binfmt_misc.automount
  @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
  +[Install]
  +WantedBy=sysinit.target
  diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
  --- a/units/systemd-binfmt.service.in
  +++ b/units/systemd-binfmt.service.in
  @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
   After=proc-sys-fs-binfmt_misc.mount
   After=local-fs.target
  @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
   TimeoutSec=90s
  +
  +[Install]
  +WantedBy=sysinit.target
  --
-2.39.2
+2.34.1
 
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +10 -7
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
  SRC_URI += " \
             file://touchscreen.rules \
             file://00-create-volatile.conf \
-           file://basic.conf.in \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
             file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
             file://systemd-pager.sh \
             file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
             file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
             "
 
  # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
      ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
      backlight \
      binfmt \
+    cgroupv2 \
      gshadow \
      hibernate \
      hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
  # The 60 seconds is watchdog's default vaule.
  WATCHDOG_TIMEOUT ??= "60"
 
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
  do_install() {
  	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
  	install -d ${D}/${base_sbindir}
  	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
  		# Provided by a separate recipe
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#192923): https://lists.openembedded.org/g/openembedded-core/message/192923
Mute This Topic: https://lists.openembedded.org/mt/103380516/7304865
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#16 lore raw
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

Quoted 349 lines

Regards,
Qi

Quoted 326 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
  .../distro/include/init-manager-systemd.inc   |  2 +
  meta/recipes-core/systemd/systemd.inc         |  4 +-
  ...tall-dependency-links-at-install-tim.patch | 22 +++---
  ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
  .../systemd/systemd/basic.conf.in             | 40 ----------
  .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
  6 files changed, 25 insertions(+), 132 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
  VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
  VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
  VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
  LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                      file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
  SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
  S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
  From: Chen Qi <[email protected]>
  Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
  use [Install] blocks so that they get created when the service is enabled
  like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
   3 files changed, 7 insertions(+), 2 deletions(-)
  diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
  --- a/units/meson.build
  +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
           {
             'file' : 'proc-sys-fs-binfmt_misc.automount',
             'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
           },
           {
             'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
           {
             'file' : 'systemd-binfmt.service.in',
             'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
           {
             'file' : 'systemd-bless-boot.service.in',
  diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
  --- a/units/proc-sys-fs-binfmt_misc.automount
  +++ b/units/proc-sys-fs-binfmt_misc.automount
  @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
  +[Install]
  +WantedBy=sysinit.target
  diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
  --- a/units/systemd-binfmt.service.in
  +++ b/units/systemd-binfmt.service.in
  @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
   After=proc-sys-fs-binfmt_misc.mount
   After=local-fs.target
  @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
   TimeoutSec=90s
  +
  +[Install]
  +WantedBy=sysinit.target
  --
-2.39.2
+2.34.1
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +9 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
  SRC_URI += " \
             file://touchscreen.rules \
             file://00-create-volatile.conf \
-           file://basic.conf.in \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
             file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
             file://systemd-pager.sh \
             file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
             file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
             "
  # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
      ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
      backlight \
      binfmt \
+    cgroupv2 \
      gshadow \
      hibernate \
      hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
  # The 60 seconds is watchdog's default vaule.
  WATCHDOG_TIMEOUT ??= "60"
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
  do_install() {
  	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
  	install -d ${D}/${base_sbindir}
  	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
  		# Provided by a separate recipe

meta/recipes-core/systemd/systemd_255.1.bb FILES:udev += "${base_sbindir}/udevd \ · line 763

Quoted 7 lines
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -0
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194007): https://lists.openembedded.org/g/openembedded-core/message/194007
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#17 lore raw
Quoted 7 lines · Alexandre Belloni
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

and I know you sent a patch for this but it didn't make it yet.

Quoted 356 lines
Quoted 350 lines

Regards,
Qi

Quoted 326 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
  .../distro/include/init-manager-systemd.inc   |  2 +
  meta/recipes-core/systemd/systemd.inc         |  4 +-
  ...tall-dependency-links-at-install-tim.patch | 22 +++---
  ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
  .../systemd/systemd/basic.conf.in             | 40 ----------
  .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
  6 files changed, 25 insertions(+), 132 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
  VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
  VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
  VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +2 -2
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
  LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
                      file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
  SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
  S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
  From: Chen Qi <[email protected]>
  Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
  use [Install] blocks so that they get created when the service is enabled
  like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray <[email protected]>
   3 files changed, 7 insertions(+), 2 deletions(-)
  diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
  --- a/units/meson.build
  +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
           {
             'file' : 'proc-sys-fs-binfmt_misc.automount',
             'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
           },
           {
             'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
           {
             'file' : 'systemd-binfmt.service.in',
             'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
           {
             'file' : 'systemd-bless-boot.service.in',
  diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
  --- a/units/proc-sys-fs-binfmt_misc.automount
  +++ b/units/proc-sys-fs-binfmt_misc.automount
  @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
  +[Install]
  +WantedBy=sysinit.target
  diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
  --- a/units/systemd-binfmt.service.in
  +++ b/units/systemd-binfmt.service.in
  @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
   After=proc-sys-fs-binfmt_misc.mount
   After=local-fs.target
  @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
   TimeoutSec=90s
  +
  +[Install]
  +WantedBy=sysinit.target
  --
-2.39.2
+2.34.1
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj <[email protected]>
-Signed-off-by: Jiaqing Zhao <[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +9 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
  SRC_URI += " \
             file://touchscreen.rules \
             file://00-create-volatile.conf \
-           file://basic.conf.in \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
             ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
             file://init \
@@ -29,7 +28,6 @@ SRC_URI += " \
             file://systemd-pager.sh \
             file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
             file://0008-implment-systemd-sysv-install-for-OE.patch \
-           file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
             "
  # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
      ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
      backlight \
      binfmt \
+    cgroupv2 \
      gshadow \
      hibernate \
      hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
  # The 60 seconds is watchdog's default vaule.
  WATCHDOG_TIMEOUT ??= "60"
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
  do_install() {
  	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
  	install -d ${D}/${base_sbindir}
  	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
  		# Provided by a separate recipe

meta/recipes-core/systemd/systemd_255.1.bb FILES:udev += "${base_sbindir}/udevd \ · line 763

Quoted 7 lines
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -0
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194007): https://lists.openembedded.org/g/openembedded-core/message/194007
Mute This Topic: https://lists.openembedded.org/mt/103380516/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#18 lore raw
Quoted 8 lines · Alexandre Belloni
Quoted 6 lines · Alexandre Belloni
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

and I know you sent a patch for this but it didn't make it yet.

I just double checked with the following settings from the "Sysvinit with systemd" entry in config.json, there's no warning.

DISTRO_FEATURES:append = ' systemd usrmerge'
ROOT_HOME = '/root'
VIRTUAL-RUNTIME_init_manager = 'sysvinit'

So I further checked the build's settings. https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466

In the second step, "Fetch yocto-autobuilder-helper", I can see the following logs:

HEAD is now at ebb7e65 config.json: Fix syntax errors

So the build is not using the latest repo. The latest commit is:

97bb07f (HEAD -> master, origin/master, origin/HEAD) config.json: set ROOT_HOME to /root for sysvinit with systemd

Regards,

Qi

Quoted 351 lines
Quoted 351 lines
Quoted 346 lines

Regards,
Qi

Quoted 326 lines · Chen Qi via lists.openembedded.org

From: Chen Qi<[email protected]>

1. Patch changes:

0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch is removed because it has no real effect now. The /lib is now /usr/lib because 'usrmerge' is a required distro feature for systemd.

0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch is refreshed for the new version to avoid patch-fuzz issue.

2. root user's home directory now defaults to "/root":

The sysuers.d/basic.conf is still modified to respect the ROOT_HOME value, so if users set ROOT_HOME to "/home/root", the behavior is the same as before. However, this is only for backward compatibility. With this patch, The ROOT_HOME value is set to "/root" in init-manager-systemd.inc. This is because systemd's source codes are hardcoding "/root", and other values are not officially supported. See the list below.

$ grep -rl '"/root"' src/ | grep -v 'src/test'
src/core/namespace.c
src/basic/user-util.c
src/nss-systemd/nss-systemd.c
src/nspawn/nspawn.c
src/firstboot/firstboot.c
src/shared/userdb.c
src/shared/user-record.c
$ grep -rl /root network/ factory/ sysctl.d/ sysusers.d/ rules.d/ tmpfiles.d/ units/ xorg/ tools/
sysusers.d/basic.conf.in
tmpfiles.d/provision.conf
units/emergency.service.in
units/rescue.service.in
tools/list-discoverable-partitions.py
Previously, the recipe was just substituting sysusers.d/basic.conf.in,
which is not enough to be treated as 'fully support'. I deliberately put
a warning message in do_install to warn users about non "/root" ROOT_HOME
value. Don't remove it until all above places are handled.

3. cgroupv2 is now the default.
cgroupv2 is the default for systemd for many years and it's the default for distros such as ubuntu and fedora. Let's also use it as the default.

---
   .../distro/include/init-manager-systemd.inc   |  2 +
   meta/recipes-core/systemd/systemd.inc         |  4 +-
   ...tall-dependency-links-at-install-tim.patch | 22 +++---
   ...sysctl.d-binfmt.d-modules-load.d-to-.patch | 73 -------------------
   .../systemd/systemd/basic.conf.in             | 40 ----------
   .../{systemd_254.4.bb => systemd_255.1.bb}    | 16 ++--
   6 files changed, 25 insertions(+), 132 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch delete mode 100644 meta/recipes-core/systemd/systemd/basic.conf.in
rename meta/recipes-core/systemd/{systemd_254.4.bb => systemd_255.1.bb} (98%)

meta/conf/distro/include/init-manager-systemd.inc +2 -0
index 595d1f2644..0a76647459 100644
@@ -5,3 +5,5 @@ VIRTUAL-RUNTIME_init_manager ??= "systemd"
   VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
   VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
   VIRTUAL-RUNTIME_dev_manager ??= "systemd"
+# systemd hardcodes /root in its source codes, other values are not offically supported
+ROOT_HOME ?= "/root"
meta/recipes-core/systemd/systemd.inc +0 -0
index ccc3236457..1417e0150f 100644
@@ -15,8 +15,8 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
   LIC_FILES_CHKSUM ="file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 

file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"

meta/recipes-core/systemd/systemd.inc +2 -2
-SRCREV = "2e7504449a51fb38db9cd2da391c6434f82def51"
-SRCBRANCH = "v254-stable"
+SRCREV = "2018ccef6645ce00c784369a22dc4e98f6d7061d"
+SRCBRANCH = "v255-stable"
   SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
   S = "${WORKDIR}/git"
meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch +11 -11
index 085f1e9052..be231cf6b2 100644
@@ -1,8 +1,8 @@
-From ca7d9a8d9c81702af9c599bb79706f12b1a465cf Mon Sep 17 00:00:00 2001
+From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
   From: Chen Qi<[email protected]>
   Date: Thu, 21 Feb 2019 16:23:24 +0800
-Subject: [PATCH] binfmt: Don't install dependency links at install time for
- the binfmt services
+Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
+ for the binfmt services
   use [Install] blocks so that they get created when the service is enabled
   like a traditional service.
@@ -25,10 +25,10 @@ Signed-off-by: Scott Murray<[email protected]>
    3 files changed, 7 insertions(+), 2 deletions(-)
   diff --git a/units/meson.build b/units/meson.build
-index c7939a10f8..219570ab19 100644
+index e7bfb7f838..1d5ec4b178 100644
   --- a/units/meson.build
   +++ b/units/meson.build
-@@ -149,7 +149,6 @@ units = [
+@@ -154,7 +154,6 @@ units = [
            {
              'file' : 'proc-sys-fs-binfmt_misc.automount',
              'conditions' : ['ENABLE_BINFMT'],
@@ -36,7 +36,7 @@ index c7939a10f8..219570ab19 100644
            },
            {
              'file' : 'proc-sys-fs-binfmt_misc.mount',
-@@ -246,7 +245,6 @@ units = [
+@@ -251,7 +250,6 @@ units = [
            {
              'file' : 'systemd-binfmt.service.in',
              'conditions' : ['ENABLE_BINFMT'],
@@ -45,7 +45,7 @@ index c7939a10f8..219570ab19 100644
            {
              'file' : 'systemd-bless-boot.service.in',
   diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6b1bbdc91e..5ec5b8670a 100644
+index 5d212015a5..6c2900ca77 100644
   --- a/units/proc-sys-fs-binfmt_misc.automount
   +++ b/units/proc-sys-fs-binfmt_misc.automount
   @@ -22,3 +22,6 @@ Before=shutdown.target
@@ -56,7 +56,7 @@ index 6b1bbdc91e..5ec5b8670a 100644
   +[Install]
   +WantedBy=sysinit.target
   diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index b04412e037..63f116e4fa 100644
+index 6861c76674..531e9fbd90 100644
   --- a/units/systemd-binfmt.service.in
   +++ b/units/systemd-binfmt.service.in
   @@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
@@ -68,12 +68,12 @@ index b04412e037..63f116e4fa 100644
    After=proc-sys-fs-binfmt_misc.mount
    After=local-fs.target
   @@ -31,3 +32,6 @@ RemainAfterExit=yes
- ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
- ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ ExecStart={{LIBEXECDIR}}/systemd-binfmt
+ ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
    TimeoutSec=90s
   +
   +[Install]
   +WantedBy=sysinit.target
   --
-2.39.2
+2.34.1
meta/recipes-core/systemd/systemd/0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch deleted +0 -73
deleted file mode 100644
index 98914ae154..0000000000
@@ -1,73 +0,0 @@
-From f75f03ef6bc3554068e456bed227f333d5cb8c34 Mon Sep 17 00:00:00 2001
-From: Khem Raj<[email protected]>
-Date: Tue, 29 Sep 2020 18:01:41 -0700
-Subject: [PATCH] Move sysusers.d/sysctl.d/binfmt.d/modules-load.d to /usr
-
-These directories are moved to /lib since systemd v246, commit
-4a56315a990b ("path: use ROOTPREFIX properly"), but in oe-core/yocto,
-the old /usr/lib is still being used.
-
-Upstream-Status: Inappropriate (OE-specific)
-Signed-off-by: Khem Raj<[email protected]>
-Signed-off-by: Jiaqing Zhao<[email protected]>
----
- src/core/systemd.pc.in           | 8 ++++----
- src/libsystemd/sd-path/sd-path.c | 8 ++++----
- 2 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
-index 693433b34b..8368a3ff02 100644
---- a/src/core/systemd.pc.in
-+++ b/src/core/systemd.pc.in
-@@ -67,16 +67,16 @@ tmpfilesdir=${tmpfiles_dir}
-
- user_tmpfiles_dir=${prefix}/share/user-tmpfiles.d
-
--sysusers_dir=${rootprefix}/lib/sysusers.d
-+sysusers_dir=${prefix}/lib/sysusers.d
- sysusersdir=${sysusers_dir}
-
--sysctl_dir=${rootprefix}/lib/sysctl.d
-+sysctl_dir=${prefix}/lib/sysctl.d
- sysctldir=${sysctl_dir}
-
--binfmt_dir=${rootprefix}/lib/binfmt.d
-+binfmt_dir=${prefix}/lib/binfmt.d
- binfmtdir=${binfmt_dir}
-
--modules_load_dir=${rootprefix}/lib/modules-load.d
-+modules_load_dir=${prefix}/lib/modules-load.d
- modulesloaddir=${modules_load_dir}
-
- catalog_dir=${prefix}/lib/systemd/catalog
-diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
-index 1af3a36d1d..def502b717 100644
---- a/src/libsystemd/sd-path/sd-path.c
-+++ b/src/libsystemd/sd-path/sd-path.c
-@@ -365,19 +365,19 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
-                 return 0;
-
-         case SD_PATH_SYSUSERS:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysusers.d";
-+                *ret = "/usr/lib/sysusers.d";
-                 return 0;
-
-         case SD_PATH_SYSCTL:
--                *ret = ROOTPREFIX_NOSLASH "/lib/sysctl.d";
-+                *ret = "/usr/lib/sysctl.d";
-                 return 0;
-
-         case SD_PATH_BINFMT:
--                *ret = ROOTPREFIX_NOSLASH "/lib/binfmt.d";
-+                *ret = "/usr/lib/binfmt.d";
-                 return 0;
-
-         case SD_PATH_MODULES_LOAD:
--                *ret = ROOTPREFIX_NOSLASH "/lib/modules-load.d";
-+                *ret = "/usr/lib/modules-load.d";
-                 return 0;
-
-         case SD_PATH_CATALOG:
---
-2.39.2
-
meta/recipes-core/systemd/systemd/basic.conf.in deleted +0 -40
deleted file mode 100644
index fac288f7fa..0000000000
@@ -1,40 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# The superuser
-u root    0     "root" :ROOT_HOME:
-
-# The nobody user/group for NFS file systems
-g {{NOBODY_GROUP_NAME}} 65534       -            -
-u {{NOBODY_USER_NAME }} 65534:65534 "Nobody"     -
-
-# Administrator group: can *see* more than normal users
-g adm     {{ADM_GID    }}     -            -
-
-# Administrator group: can *do* more than normal users
-g wheel   {{WHEEL_GID  }}     -            -
-
-# Access to shared database of users on the system
-g utmp    {{UTMP_GID   }}     -            -
-
-# Physical and virtual hardware access groups
-g audio   {{AUDIO_GID  }}     -            -
-g cdrom   {{CDROM_GID  }}     -            -
-g dialout {{DIALOUT_GID}}     -            -
-g disk    {{DISK_GID   }}     -            -
-g input   {{INPUT_GID  }}     -            -
-g kmem    {{KMEM_GID   }}     -            -
-g kvm     {{KVM_GID    }}     -            -
-g lp      {{LP_GID     }}     -            -
-g render  {{RENDER_GID }}     -            -
-g sgx     {{SGX_GID    }}     -            -
-g tape    {{TAPE_GID   }}     -            -
-g tty     {{TTY_GID    }}     -            -
-g video   {{VIDEO_GID  }}     -            -
-
-# Default group for normal users
-g users   {{USERS_GID  }}     -            -
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +9 -6
similarity index 98%
rename from meta/recipes-core/systemd/systemd_254.4.bb
rename to meta/recipes-core/systemd/systemd_255.1.bb
index 0c12926bef..daa3a01fef 100644
@@ -21,7 +21,6 @@ REQUIRED_DISTRO_FEATURES += "systemd"
   SRC_URI += " \
              file://touchscreen.rules  \
              file://00-create-volatile.conf  \
-file://basic.conf.in  \
              ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
              ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
              file://init  \
@@ -29,7 +28,6 @@ SRC_URI += " \
              file://systemd-pager.sh  \
              file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch  \
              file://0008-implment-systemd-sysv-install-for-OE.patch  \
-file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch  \
              "
   # patches needed by musl
@@ -73,6 +71,7 @@ PACKAGECONFIG ??= " \
       ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
       backlight \
       binfmt \
+    cgroupv2 \
       gshadow \
       hibernate \
       hostnamed \
@@ -266,12 +265,16 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
   # The 60 seconds is watchdog's default vaule.
   WATCHDOG_TIMEOUT ??= "60"
-do_configure:prepend() {
-  sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
   do_install() {
   	meson_do_install
+	# Change the root user's home directory in /lib/sysusers.d/basic.conf.
+	# This is done merely for backward compatibility with previous systemd recipes.
+	# systemd hardcodes root user's HOME to be "/root". Changing to use other values
+	# may have unexpected runtime behaviors.
+	if [ "${ROOT_HOME}" != "/root" ]; then
+		bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
+		sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
+	fi
   	install -d ${D}/${base_sbindir}
   	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
   		# Provided by a separate recipe

meta/recipes-core/systemd/systemd_255.1.bb FILES:udev += "${base_sbindir}/udevd \ · line 763

Quoted 7 lines
meta/recipes-core/systemd/systemd_255.1.bb renamed from meta/recipes-core/systemd/systemd_254.4.bb +1 -0
@@ -754,6 +757,7 @@ FILES:udev += "${base_sbindir}/udevd \
                  ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
                  ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
                  ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+               ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                  ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
                  ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
                  ${rootlibexecdir}/udev/rules.d/60-sensor.rules \

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#194007):https://lists.openembedded.org/g/openembedded-core/message/194007 Mute This Topic:https://lists.openembedded.org/mt/103380516/3617179
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#19 lore raw
Quoted 20 lines · ChenQi
Quoted 8 lines · Alexandre Belloni
Quoted 6 lines · Alexandre Belloni
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

and I know you sent a patch for this but it didn't make it yet.

I just double checked with the following settings from the "Sysvinit with systemd" entry in config.json, there's no warning.

DISTRO_FEATURES:append = ' systemd usrmerge'
ROOT_HOME = '/root'
VIRTUAL-RUNTIME_init_manager = 'sysvinit'

So I further checked the build's settings.
https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466

Quoted 6 lines

In the second step, "Fetch yocto-autobuilder-helper", I can see the following logs:

HEAD is now at ebb7e65 config.json: Fix syntax errors

So the build is not using the latest repo. The latest commit is:

This is not correct, it was using the latest commit at the time, the patch was applied after my email.

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#20 lore raw
Quoted 20 lines · Alexandre Belloni
Quoted 19 lines · ChenQi
Quoted 8 lines · Alexandre Belloni
Quoted 6 lines · Alexandre Belloni
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

and I know you sent a patch for this but it didn't make it yet.

I just double checked with the following settings from the "Sysvinit with systemd" entry in config.json, there's no warning.

DISTRO_FEATURES:append = ' systemd usrmerge'
ROOT_HOME = '/root'
VIRTUAL-RUNTIME_init_manager = 'sysvinit'

So I further checked the build's settings.
https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466

Quoted 10 lines
Quoted 6 lines

In the second step, "Fetch yocto-autobuilder-helper", I can see the following logs:

HEAD is now at ebb7e65 config.json: Fix syntax errors

So the build is not using the latest repo. The latest commit is:

This is not correct, it was using the latest commit at the time, the patch was applied after my email.

OK... Do you mean that the warning appeared in autobuilder, and then you applied the patch to yocto-autobuilder-helper to make the warning disappear? I thought you meant that the warning continued to exist even with the patch.

To clarify, we can now wait for autobuiler's results and I don't need to do anything more, right?

Regards,

Qi

#21 lore raw
Quoted 31 lines · ChenQi
Quoted 20 lines · Alexandre Belloni
Quoted 19 lines · ChenQi
Quoted 8 lines · Alexandre Belloni
Quoted 6 lines · Alexandre Belloni
Quoted 2 lines · Chen Qi via lists.openembedded.org

What's the status of this patch series?
Is there any issue or concern that I missed?

I'm glad you asked, I got this today:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466/steps/26/logs/warnings

and I know you sent a patch for this but it didn't make it yet.

I just double checked with the following settings from the "Sysvinit with systemd" entry in config.json, there's no warning.

DISTRO_FEATURES:append = ' systemd usrmerge'
ROOT_HOME = '/root'
VIRTUAL-RUNTIME_init_manager = 'sysvinit'

So I further checked the build's settings.
https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/8466

Quoted 10 lines
Quoted 6 lines

In the second step, "Fetch yocto-autobuilder-helper", I can see the following logs:

HEAD is now at ebb7e65 config.json: Fix syntax errors

So the build is not using the latest repo. The latest commit is:

This is not correct, it was using the latest commit at the time, the patch was applied after my email.

Quoted 6 lines

OK... Do you mean that the warning appeared in autobuilder, and then you applied the patch to yocto-autobuilder-helper to make the warning disappear? I thought you meant that the warning continued to exist even with the patch.

To clarify, we can now wait for autobuiler's results and I don't need to do anything more, right?

I confirm, no action is needed on your side.

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com