Skip to contentSkip to conversation

package/systemd: require merged-bin

Buildroot Romain Naour via buildroot 1 participant 1 message Nov 5, 2025

lore
Share & tools
lore
#0 lore raw

commit: https://git.buildroot.net/buildroot/commit/?id=a530492cd3e6de7ed5f9406f7573fe7b9061b3d5
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Since version 256, systemd will taint the system if /usr/bin and /usr/sbin are not merged, known as merged-bin:

    # systemctl --no-pager status
    ● buildroot
        State: running
        Units: 166 loaded (incl. loaded aliases)
         Jobs: 0 queued
       Failed: 0 units
        Since: Mon 2025-07-07 19:48:05 UTC; 19s ago
      systemd: 257.7
      Tainted: unmerged-bin
       CGroup: /
               ├─init.scope
               [...]

Although this is not yet an error, it will be in the future.

To be as ready as we can be when that happens, forcibly enable merged-bin, like we did when we initially added merged-usr (except this time we carry the select from systemd, even though it is not yet strictly required, rather than from the init entry).

Extend the runtime test to catch any tainted flag.

Cc Arnout Vandecappelle <[email protected]>
Cc Norbert Lange <[email protected]>
Cc Sen Hastings <[email protected]>
---
 package/systemd/Config.in                  |  1 +
 support/testing/tests/init/test_systemd.py | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
package/systemd/Config.in +1 -0
index 0cb10ea3d8..931134911a 100644
@@ -25,6 +25,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8
 	depends on BR2_HOST_GCC_AT_LEAST_8 # host-systemd
 	select BR2_ROOTFS_MERGED_USR
+	select BR2_ROOTFS_MERGED_BIN
 	select BR2_PACKAGE_HAS_UDEV
 	select BR2_PACKAGE_DBUS if !BR2_PACKAGE_DBUS_BROKER # runtime
 	select BR2_PACKAGE_LIBCAP
support/testing/tests/init/test_systemd.py +19 -0
index 05a65223b3..7fdd5d1798 100644
@@ -31,6 +31,25 @@ class InitSystemSystemdBase(InitSystemBase):
             self.start_emulator(fs)
         self.check_init("/lib/systemd/systemd")
 
+        # Test there is no tainted flag.
+        output, ret = self.emulator.run("systemctl --no-pager status")
+        self.assertEqual(ret, 0, f"'systemctl status' failed with exit code {ret}, with:\n{output}")
+        try:
+            # 'support-ended' tainted flag is only set based on the
+            # SUPPORT_END variable in /etc/os-release; as we don't set
+            # it in Buildroot, we can't get that flag in the runtime
+            # tests, even on our maintenance branches, so we don't need
+            # to filter it out.
+            tainted_flags = [
+                "".join(line.split(":")[1:]).strip()
+                for line in output
+                if line.strip().startswith("Tainted: ")
+            ][0]
+            raise RuntimeError(f"Tainted flags: {tainted_flags}")
+        except IndexError:
+            # No tainted flag \o/
+            pass
+
         # Test all units are OK
         output, _ = self.emulator.run("systemctl --no-pager --failed --no-legend")
         self.assertEqual(len(output), 0)

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