Skip to contentSkip to conversation

systemd: fix unmerged-bin tainted message

PATCH In review [email protected] 5 participants 10 messages Apr 10 – Apr 13

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

Override most sbin variables to point to their bin equivalent when usermerge is enabled, with the exception being base_sbindir_native and sbindir_native. There is no guarantee the host machine is using this filesystem scheme.

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

---

v2:
- Use recommended replacement variable when usermerge is enabled
- Apply replacement to other relevant variables in this file
- Keep usrmerge distro feature separate as I believe there is still some merit to mimicking a systemd filesystem in a non-systemd enabled environment, and I didn't hear too much discussion previously

 meta/classes-recipe/populate_sdk_base.bbclass | 5 +++--
 meta/conf/bitbake.conf                        | 8 ++++----
 meta/recipes-core/systemd/systemd_259.5.bb    | 8 ++++++--
 3 files changed, 13 insertions(+), 8 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 +4 -4
index 84450386d9..5d27e70b04 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', '${base_bindir}', '${root_prefix}/sbin', d)}"
 export base_libdir = "${root_prefix}/${baselib}"
 export nonarch_base_libdir = "${root_prefix}/lib"
 
@@ -43,7 +43,7 @@ export systemd_user_unitdir = "${nonarch_libdir}/systemd/user"
 
 # Architecture dependent paths
 export bindir = "${exec_prefix}/bin"
-export sbindir = "${exec_prefix}/sbin"
+export sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${bindir}', '${exec_prefix}/sbin', d)}"
 export libdir = "${exec_prefix}/${baselib}"
 export libexecdir = "${exec_prefix}/libexec"
 export includedir = "${exec_prefix}/include"
@@ -65,9 +65,9 @@ bindir_cross = "/bin"
 bindir_crossscripts = "${bindir}/crossscripts"
 prefix_nativesdk = "/usr"
 bindir_nativesdk = "${prefix_nativesdk}/bin"
-sbindir_nativesdk = "${prefix_nativesdk}/sbin"
+sbindir_nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${bindir_nativesdk}', '${prefix_nativesdk}/sbin', d)}"
 base_bindir_nativesdk = "/bin"
-base_sbindir_nativesdk = "/sbin"
+base_sbindir_nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${base_bindir_nativesdk}', '/sbin', d)}"
 includedir_nativesdk = "${prefix_nativesdk}/include"
 libdir_nativesdk = "${prefix_nativesdk}/lib"
 base_libdir_nativesdk = "/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

[email protected] schrieb am Fr 10. Apr, 13:27 (-0500):

Quoted 4 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.

With this patch net-tools fail to build, but it looks like a fault of net-tools:

```
| for l in $langs; do \
|     install -c -m 755 -d /build/tmp/work/core2-64-poky-linux/net-tools/2.10/image/usr/share/locale/$l; \
|     install -c -m 755 -d /build/tmp/work/core2-64-poky-linux/net-tools/2.10/image/usr/share/locale/$l/LC_MESSAGES; \
|     install -c -m 644 $l.mo /build/tmp/work/core2-64-poky-linux/net-tools/2.10/image/usr/share/locale/$l/LC_MESSAGES/net-tools.mo; \
| done
| make[1]: Leaving directory '/build/tmp/work/core2-64-poky-linux/net-tools/2.10/sources/net-tools-2.10/po'
| mkdir: cannot create directory ‘/build/tmp/work/core2-64-poky-linux/net-tools/2.10/image//usr/bin’: File exists
| WARNING: exit code 1 from a shell command.
ERROR: Task (/build/../work/layers-3rdparty/oe-core/meta/recipes-extended/net-tools/net-tools_2.10.bb:do_install) failed with exit code '1'
```

do_install() {
…

        if [ "${base_sbindir}" != "/sbin" ]; then
                mkdir ${D}/${base_sbindir}
                mv ${D}/sbin/* ${D}/${base_sbindir}/
                rmdir ${D}/sbin
        fi
}

And atop has this code which does not work anymore:

do_install() {
…

    # remove atopacct related files
    rm -rf ${D}${sbindir} ${D}${mandir}/man8
}

ERROR: atop-2.12.1-r0 do_package: QA Issue: atop: Files/directories were installed but not shipped in any package:
/usr/sbin/atopacctd
/usr/sbin/atopgpud
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
atop: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: atop-2.12.1-r0 do_package: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /build/tmp/work/core2-64-poky-linux/atop/2.12.1/temp/log.do_package.1427030

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
#2 lore raw

PATCH 1/1 net-tools: Handle binmerge

In reply to [email protected]

From: Jörg Sommer <[email protected]>

If $base_sbindir = $base_bindir the sbindir already exists.

---
 meta/recipes-extended/net-tools/net-tools_2.10.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-extended/net-tools/net-tools_2.10.bb +1 -1
index 6c8297ba39..a21916fb26 100644
@@ -73,7 +73,7 @@ do_install() {
 		rmdir ${D}/bin
 	fi
 	if [ "${base_sbindir}" != "/sbin" ]; then
-		mkdir ${D}/${base_sbindir}
+		mkdir -p ${D}${base_sbindir}
 		mv ${D}/sbin/* ${D}/${base_sbindir}/
 		rmdir ${D}/sbin
 	fi
Signature · 1 line
2.53.0
#3 lore raw

PATCH 1/1 atop: Fix binmerge

In reply to [email protected]

From: Jörg Sommer <[email protected]>

In case $sbindir = $bindir we have to pass this setting to make install and later on explicitly cleanup the unwanted daemons.

---
 meta-oe/recipes-support/atop/atop_2.12.1.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-support/atop/atop_2.12.1.bb +3 -2
index 4ca74edbaf..6b462a4d8f 100644
@@ -37,7 +37,7 @@ do_compile() {
 do_install() {
     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
         make DESTDIR=${D} VERS=${PV} SYSDPATH=${systemd_system_unitdir} \
-            PMPATHD=${systemd_unitdir}/system-sleep install
+            PMPATHD=${systemd_unitdir}/system-sleep SBINPATH=${sbindir} install
         install -d ${D}${sysconfdir}/tmpfiles.d
         install -m 644 ${UNPACKDIR}/volatiles.atop.conf ${D}${sysconfdir}/tmpfiles.d/atop.conf
         rm -f ${D}${systemd_system_unitdir}/atopacct.service
@@ -53,7 +53,8 @@ do_install() {
     rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
 
     # remove atopacct related files
-    rm -rf ${D}${sbindir} ${D}${mandir}/man8
+    rm -rf ${D}${sbindir}/atopacctd ${D}${mandir}/man8/atopacctd.8 \
+        ${D}${sbindir}/atopgpud ${D}${mandir}/man8/atopgpud.8
 }
 
 inherit systemd
Signature · 1 line
2.53.0
#4 lore raw
In reply to [email protected]
Quoted 17 lines · rs

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.

Override most sbin variables to point to their bin equivalent when usermerge is enabled, with the exception being base_sbindir_native and sbindir_native. There is no guarantee the host machine is using this filesystem scheme.

Quoted 7 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

---

Hi Randolph,

Thanks for your patch. This triggering some issues because of missing folders.

Jörg suggested a fix for net-tools, but we have other failures, at least one with tcf-agent:

ERROR: tcf-agent-1.9.0-r0 do_package: QA Issue: tcf-agent: Files/directories were installed but not shipped in any package:
/usr/sbin/tcf-client
/usr/sbin/tcf-agent
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
tcf-agent: 2 installed and not shipped files. [installed-vs-shipped]

https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/3574
https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/3557

Can you have a look at the issue?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH v2 1/2 atop: Add packages atop-acctd and atop-gpud

In reply to [email protected]

From: Jörg Sommer <[email protected]>

For some users these programmes might be useful.

---
 meta-oe/recipes-support/atop/atop_2.12.1.bb | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
meta-oe/recipes-support/atop/atop_2.12.1.bb +7 -4
index 4ca74edbaf..92665fa464 100644
@@ -7,7 +7,7 @@ etc. At regular intervals, it shows system-level activity related to the CPU, \
 memory, swap, disks (including LVM) and network layers, and for every process \
 (and thread) it shows e.g. the CPU utilization, memory growth, disk \
 utilization, priority, username, state, and exit code."
-HOMEPAGE = "http://www.atoptool.nl"
+HOMEPAGE = "https://www.atoptool.nl"
 SECTION = "console/utils"
 
 LICENSE = "GPL-2.0-only"
@@ -51,16 +51,19 @@ do_install() {
     # /var/log/atop will be created in runtime
     rm -rf ${D}${localstatedir}/log
     rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
-
-    # remove atopacct related files
-    rm -rf ${D}${sbindir} ${D}${mandir}/man8
 }
 
 inherit systemd
 
+PACKAGES =+ "${PN}-acctd ${PN}-gpud"
+
 SYSTEMD_SERVICE:${PN} = "atop.service atopgpu.service atop-rotate.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
 FILES:${PN} += "${systemd_unitdir}/system-sleep ${systemd_system_unitdir}/atop-rotate.timer"
+FILES:${PN}-acctd += "${sbindir}/atopacctd ${mandir}/man8/atopacctd.8"
+FILES:${PN}-gpud += "${sbindir}/atopgpud ${mandir}/man8/atopgpud.8"
 
 RDEPENDS:${PN} = "procps"
+RDEPENDS:${PN}-gpud = "python3-core"
+RRECOMMENDS:${PN} = "${PN}-acctd ${PN}-gpud"
Signature · 1 line
2.53.0
#6 lore raw

PATCH v2 2/2 atop: Fix binmerge

From: Jörg Sommer <[email protected]>

In case $sbindir = $bindir we have to pass this setting to make install.

---
 meta-oe/recipes-support/atop/atop_2.12.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/atop/atop_2.12.1.bb +1 -1
index 92665fa464..d40b95ce6c 100644
@@ -37,7 +37,7 @@ do_compile() {
 do_install() {
     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
         make DESTDIR=${D} VERS=${PV} SYSDPATH=${systemd_system_unitdir} \
-            PMPATHD=${systemd_unitdir}/system-sleep install
+            PMPATHD=${systemd_unitdir}/system-sleep SBINPATH=${sbindir} install
         install -d ${D}${sysconfdir}/tmpfiles.d
         install -m 644 ${UNPACKDIR}/volatiles.atop.conf ${D}${sysconfdir}/tmpfiles.d/atop.conf
         rm -f ${D}${systemd_system_unitdir}/atopacct.service
Signature · 1 line
2.53.0
#7 lore raw

Patchtest results for [PATCH v2 2/2] atop: Fix binmerge

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/v2-2-2-atop-Fix-binmerge.patch

FAIL: test target mailing list: Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists (test_mbox.TestMbox.test_target_mailing_list)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#8 lore raw

Patchtest results for [PATCH v2 1/2] atop: Add packages atop-acctd and atop-gpud

In reply to Jörg Sommer

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/v2-1-2-atop-Add-packages-atop-acctd-and-atop-gpud.patch

FAIL: test target mailing list: Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists (test_mbox.TestMbox.test_target_mailing_list)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#9 lore raw
In reply to [email protected]
Quoted 17 lines · On Fri, 2026-04-10 at 13:27 -0500, [email protected] wrote:

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.

Override most sbin variables to point to their bin equivalent when usermerge is enabled, with the exception being base_sbindir_native and sbindir_native. There is no guarantee the host machine is using this filesystem scheme.

Quoted 4 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

Just to be clear, whilst I understand the issue and people wanting to fix this, I'm not going to take this into wrynose. The failures and other issues the fix has caused shows it isn't a safe/easy fix and we'll have to give it a bit more thought in the next development cycle.

Cheers,

Richard