Skip to contentSkip to conversation

systemd: fix unmerged-bin tainted message

PATCH Superseded [email protected] 4 participants 7 messages Apr 8 – Jun 5 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: fix unmerged-bin tainted message

From: Randolph Sapp <[email protected]>

Systemd prefers both /bin and /sbin to link to /usr/bin. If this is not the case it reports that the system is tainted in systemctl status.

Add a link from /usr/sbin to /usr/bin to prevent anything from being excluded from the merged bin directory. This mimics the current merged bin directory structure of Arch Linux [1].

Update the systemd recipe to prevent creating a duplicate link when sbinmerge is enabled.

This check was added to systemd back in 2024 [2].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/filesystem/-/blob/main/PKGBUILD
[2] https://github.com/systemd/systemd/commit/844863c61e7b501097da84a1e4d1e4a6aa6d9f0d

---

I feel like this is overloading the "usrmerge" distro feature somewhat. On the other hand, this parameter was added for systemd support, and systemd considers all of this to result in an unmerged-bin warning. I figure it's kind of fine.

Open to opinions here, as we could also just add a "sbinmerge" distro feature. Then again, what would be the expected behavior when usrmerge is disabled? Would /usr/sbin just point to /usr/bin and /sbin to /bin then?

 meta/classes-recipe/populate_sdk_base.bbclass | 5 +++--
 meta/conf/bitbake.conf                        | 2 +-
 meta/recipes-core/systemd/systemd_259.5.bb    | 8 ++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)
meta/classes-recipe/populate_sdk_base.bbclass +3 -2
index b427ff2761..15f393a3bb 100644
@@ -186,9 +186,10 @@ POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif
 # Prepare the root links to point to the /usr counterparts.
 create_merged_usr_symlinks() {
     root="$1"
-    install -d $root${base_bindir} $root${base_sbindir} $root${base_libdir}
+    install -d $root${base_bindir} $root${base_libdir}
     ln -rs $root${base_bindir} $root/bin
-    ln -rs $root${base_sbindir} $root/sbin
+    ln -rs $root${base_bindir} $root/sbin
+    ln -rs $root${base_bindir} $root/usr/sbin
     ln -rs $root${base_libdir} $root/${baselib}
 
     if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"
 export base_libdir = "${root_prefix}/${baselib}"
 export nonarch_base_libdir = "${root_prefix}/lib"
 
meta/recipes-core/systemd/systemd_259.5.bb +6 -2
index c3cb605b4d..d84e38d7cd 100644
@@ -69,6 +69,7 @@ PACKAGECONFIG ??= " \
     quotacheck \
     randomseed \
     resolved \
+    sbinmerge \
     serial-getty-generator \
     set-time-epoch \
     sysusers \
@@ -339,8 +340,11 @@ do_install() {
 		install -m 0644 ${UNPACKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
 	fi
 
-	# create link for existing udev rules
-	ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
+	# create link for existing udev rules if sbinmerge is not enabled
+	if ${@bb.utils.contains('PACKAGECONFIG', 'sbinmerge', 'false', 'true', d)}
+	then
+		ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
+	fi
 
 	# install default policy for presets
 	# https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
Signature · 1 line
2.53.0
#1 lore raw
Quoted 20 lines · Randolph Sapp via lists.openembedded.org

From: Randolph Sapp <[email protected]>

Systemd prefers both /bin and /sbin to link to /usr/bin. If this is not the case it reports that the system is tainted in systemctl status.

Add a link from /usr/sbin to /usr/bin to prevent anything from being excluded from the merged bin directory. This mimics the current merged bin directory structure of Arch Linux [1].

Update the systemd recipe to prevent creating a duplicate link when sbinmerge is enabled.

This check was added to systemd back in 2024 [2].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/filesystem/-/blob/main/PKGBUILD
[2] https://github.com/systemd/systemd/commit/844863c61e7b501097da84a1e4d1e4a6aa6d9f0d

---

Quoted 7 lines

I feel like this is overloading the "usrmerge" distro feature somewhat. On the other hand, this parameter was added for systemd support, and systemd considers all of this to result in an unmerged-bin warning. I figure it's kind of fine.

Open to opinions here, as we could also just add a "sbinmerge" distro feature. Then again, what would be the expected behavior when usrmerge is disabled? Would /usr/sbin just point to /usr/bin and /sbin to /bin then?

These are good questions. It feels like systemd is basically dictating how the system should be laid out at this point and we may as well put all this on the systemd distro feature as it is getting to the point you can't use it without doing that :/.

It feels a bit like we should drop usrmerge too and just use systemd there too since it doesn't have any seperate policy, it is just "do what systemd says".

Cheers,

Richard

#2 lore raw
In reply to [email protected]

Randolph Sapp via lists.openembedded.org schrieb am Mi 08. Apr, 14:50 (-0500):

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 25

Quoted 10 lines
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"

Maybe:

export base_sbindir = "${root_prefix}/${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'bin', 'sbin', d)}"

or

export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${base_bindir}', '${root_prefix}/sbin', d)}"

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 27

Quoted 2 lines
meta/conf/bitbake.conf +0 -0
 export base_libdir = "${root_prefix}/${baselib}"
 export nonarch_base_libdir = "${root_prefix}/lib"

Jörg

Signature · 6 lines
Navimatix GmbH           T: 03641 - 327 99 0
Tatzendpromenade 2       F: 03641 - 526 306
07745 Jena               www.navimatix.de

Geschäftsführer: Steffen Späthe, Jan Rommeley
Registergericht: Amtsgericht Jena, HRB 501480
#3 lore raw
Quoted 21 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jörg Sommer via lists.openembedded.org
Sent: den 9 april 2026 06:31
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [oe-core][PATCH] systemd: fix unmerged-bin tainted message

Randolph Sapp via lists.openembedded.org schrieb am Mi 08. Apr, 14:50 (-0500):

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 25

Quoted 10 lines
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"

Maybe:

Quoted 5 lines

export base_sbindir = "${root_prefix}/${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'bin', 'sbin', d)}"

or

export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${base_bindir}', '${root_prefix}/sbin', d)}"

This one. For the unlikely case that someone modifies base_bindir.

Quoted 5 lines

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 27

Quoted 2 lines
meta/conf/bitbake.conf +0 -0
 export base_libdir = "${root_prefix}/${baselib}"
 export nonarch_base_libdir = "${root_prefix}/lib"

Jörg

//Peter

#4 lore raw
Quoted 21 lines · Peter Kjellerstedt
Quoted 21 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jörg Sommer via lists.openembedded.org
Sent: den 9 april 2026 06:31
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [oe-core][PATCH] systemd: fix unmerged-bin tainted message

Randolph Sapp via lists.openembedded.org schrieb am Mi 08. Apr, 14:50 (-0500):

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 25

Quoted 10 lines
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"

Maybe:

Quoted 8 lines
Quoted 5 lines

export base_sbindir = "${root_prefix}/${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'bin', 'sbin', d)}"

or

export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${base_bindir}', '${root_prefix}/sbin', d)}"

This one. For the unlikely case that someone modifies base_bindir.

Fair enough. Any other comments about Richards proposal to remove the usrmerge distro feature and merge that into the systemd distro feature?

I personally think that a non-systemd environment could still benefit from mimicking a filesystem structure most distros currently ship, but that's just me.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 31 lines · Randolph Sapp via lists.openembedded.org
Quoted 21 lines · Peter Kjellerstedt
Quoted 21 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jörg Sommer via lists.openembedded.org
Sent: den 9 april 2026 06:31
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [oe-core][PATCH] systemd: fix unmerged-bin tainted message

Randolph Sapp via lists.openembedded.org schrieb am Mi 08. Apr, 14:50 (-0500):

meta/conf/bitbake.conf root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi · line 25

Quoted 10 lines
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"

Maybe:

Quoted 8 lines
Quoted 5 lines

export base_sbindir = "${root_prefix}/${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'bin', 'sbin', d)}"

or

export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${base_bindir}', '${root_prefix}/sbin', d)}"

This one. For the unlikely case that someone modifies base_bindir.

Quoted 6 lines

Fair enough. Any other comments about Richards proposal to remove the usrmerge distro feature and merge that into the systemd distro feature?

I personally think that a non-systemd environment could still benefit from mimicking a filesystem structure most distros currently ship, but that's just me.

Also suppose I should apply this to all sbin related variables in this file to keep everything consistent between the SDKs and the actual rootfs images.

#7 lore raw
In reply to [email protected]

Randolph Sapp via lists.openembedded.org schrieb am Mi 08. Apr, 14:50 (-0500):

Quoted 12 lines

From: Randolph Sapp <[email protected]>

Systemd prefers both /bin and /sbin to link to /usr/bin. If this is not the case it reports that the system is tainted in systemctl status.

Add a link from /usr/sbin to /usr/bin to prevent anything from being excluded from the merged bin directory. This mimics the current merged bin directory structure of Arch Linux [1].

Update the systemd recipe to prevent creating a duplicate link when sbinmerge is enabled.

Quoted 6 lines

This check was added to systemd back in 2024 [2].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/filesystem/-/blob/main/PKGBUILD
[2] https://github.com/systemd/systemd/commit/844863c61e7b501097da84a1e4d1e4a6aa6d9f0d

How about including this commit in a updated form, now?

I'm using it since April, I found and fixed some issues, but in the end it works (with binmerge enabled). So I would give my

About the question if binmerge/usrmerge should be part of the systemd feature or be a stand-alone feature, I'm undecided. But I think bin+usrmerge have their use case without systemd.

Quoted 20 lines

---

I feel like this is overloading the "usrmerge" distro feature somewhat. On the other hand, this parameter was added for systemd support, and systemd considers all of this to result in an unmerged-bin warning. I figure it's kind of fine.

Open to opinions here, as we could also just add a "sbinmerge" distro feature. Then again, what would be the expected behavior when usrmerge is disabled? Would /usr/sbin just point to /usr/bin and /sbin to /bin then?

 meta/classes-recipe/populate_sdk_base.bbclass | 5 +++--
 meta/conf/bitbake.conf                        | 2 +-
 meta/recipes-core/systemd/systemd_259.5.bb    | 8 ++++++--
 3 files changed, 10 insertions(+), 5 deletions(-)
meta/classes-recipe/populate_sdk_base.bbclass +0 -0
index b427ff2761..15f393a3bb 100644

meta/classes-recipe/populate_sdk_base.bbclass POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif · line 189

Quoted 5 lines
meta/classes-recipe/populate_sdk_base.bbclass +1 -1
@@ -186,9 +186,10 @@ POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif
 # Prepare the root links to point to the /usr counterparts.
 create_merged_usr_symlinks() {
     root="$1"
-    install -d $root${base_bindir} $root${base_sbindir} $root${base_libdir}
+    install -d $root${base_bindir} $root${base_libdir}

Is this right in case of !binmerge? Install is not picky about creating the same directory two times:

% install -d /tmp/foo /tmp/foo; echo $?
0

meta/classes-recipe/populate_sdk_base.bbclass POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif · line 191

Quoted 3 lines
meta/classes-recipe/populate_sdk_base.bbclass +1 -1
     ln -rs $root${base_bindir} $root/bin
-    ln -rs $root${base_sbindir} $root/sbin
+    ln -rs $root${base_bindir} $root/sbin

In case of binmerge both lines are equivalent. But in case of !binmerge, this should be wrong.

meta/classes-recipe/populate_sdk_base.bbclass POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manif · line 192

Quoted 1 line
meta/classes-recipe/populate_sdk_base.bbclass +1 -0
+    ln -rs $root${base_bindir} $root/usr/sbin

This also.

Quoted 21 lines
meta/classes-recipe/populate_sdk_base.bbclass +0 -0
     ln -rs $root${base_libdir} $root/${baselib}
 
     if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
meta/conf/bitbake.conf +1 -1
index 84450386d9..29301534d2 100644
@@ -22,7 +22,7 @@ root_prefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefi
 
 # Base paths
 export base_bindir = "${root_prefix}/bin"
-export base_sbindir = "${root_prefix}/sbin"
+export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${root_prefix}/bin', '${root_prefix}/sbin', d)}"
 export base_libdir = "${root_prefix}/${baselib}"
 export nonarch_base_libdir = "${root_prefix}/lib"
 
meta/recipes-core/systemd/systemd_259.5.bb +0 -0
index c3cb605b4d..d84e38d7cd 100644

meta/recipes-core/systemd/systemd_259.5.bb PACKAGECONFIG ??= " \ · line 72

Quoted 4 lines
meta/recipes-core/systemd/systemd_259.5.bb +1 -0
@@ -69,6 +69,7 @@ PACKAGECONFIG ??= " \
     quotacheck \
     randomseed \
     resolved \
+    sbinmerge \

I think upstream names it binmerge after the target, as with usrmerge.

Quoted 20 lines
meta/recipes-core/systemd/systemd_259.5.bb +5 -2
     serial-getty-generator \
     set-time-epoch \
     sysusers \
@@ -339,8 +340,11 @@ do_install() {
 		install -m 0644 ${UNPACKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
 	fi
 
-	# create link for existing udev rules
-	ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
+	# create link for existing udev rules if sbinmerge is not enabled
+	if ${@bb.utils.contains('PACKAGECONFIG', 'sbinmerge', 'false', 'true', d)}
+	then
+		ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
+	fi
 
 	# install default policy for presets
 	# https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
Signature · 1 line
2.53.0
Signature · 6 lines
Navimatix GmbH           T: 03641 - 327 99 0
Tatzendpromenade 2       F: 03641 - 526 306
07745 Jena               www.navimatix.de

Geschäftsführer: Steffen Späthe, Jan Rommeley
Registergericht: Amtsgericht Jena, HRB 501480