Skip to contentSkip to conversation

systemd: update to 261 and be compatible with rhel8

PATCH Superseded [email protected] 3 participants 6 messages Jul 3 – Jul 20 Arm/Amlogic Meson SoC support

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover systemd: update to 261 and be compatible with rhel8

From: Daniel Turull <[email protected]>

systemd increases the dependency on the host kernel, which breaks builds with rhel 8

This series add native patches in the systemd tools to make it work.

v2:
- re-add tag verification in SRC_URI
v3:
- rebase on top of Ross Burton meson patches. if not needed keep v2
- re-tested
See https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/
v4:
- still on top of Meson patches from Ross
- merge systemd-systemctl-native and systemd-hwdb-native into
systemd-tools-native and update references
(this will cause meta-oe postgresql to fail). I'm planning to send
a patch to it once we merge this one.

Tested on rhel8.10 with testsuite systemd on qemux86-64

Daniel Turull (2):
systemd: upgrade to 261
systemd: add native hwdb generator via merged systemd-tools-native

 meta/classes-recipe/systemd.bbclass           |   4 +-
 meta/conf/distro/include/maintainers.inc      |   2 +-
 meta/recipes-bsp/keymaps/keymaps_1.0.bb       |   2 +-
 .../initscripts/initscripts_1.0.bb            |   2 +-
 ...ve_259.5.bb => systemd-boot-native_261.bb} |   0
 ...temd-boot_259.5.bb => systemd-boot_261.bb} |   0
 .../systemd/systemd-systemctl-native_259.5.bb |  19 --
 .../systemd/systemd-tools-native_261.bb       |  42 +++++
 meta/recipes-core/systemd/systemd.inc         |   8 +-
 ...meson-use-libfido2_cflags-dependency.patch |  54 ------
 .../0003-Do-not-create-var-log-README.patch   |  10 +-
 ...il-fix-PCR-bank-guessing-without-EFI.patch |  62 ------
 ...-detailed-debug-logging-to-fdset_new.patch |  97 ----------
 ...idfd_open-and-STATX_MNT_ID-on-older-.patch | 176 ++++++++++++++++++
 ...t-mode-for-reproducible-cross-builds.patch |  36 ++++
 .../{systemd_259.5.bb => systemd_261.bb}      |  14 +-
 .../modutils-initscripts.bb                   |   2 +-
 scripts/postinst-intercepts/update_udev_hwdb  |  24 ++-
 18 files changed, 292 insertions(+), 262 deletions(-)
 rename meta/recipes-core/systemd/{systemd-boot-native_259.5.bb => systemd-boot-native_261.bb} (100%)
 rename meta/recipes-core/systemd/{systemd-boot_259.5.bb => systemd-boot_261.bb} (100%)
 delete mode 100644 meta/recipes-core/systemd/systemd-systemctl-native_259.5.bb
 create mode 100644 meta/recipes-core/systemd/systemd-tools-native_261.bb
 delete mode 100644 meta/recipes-core/systemd/systemd/0001-meson-use-libfido2_cflags-dependency.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0004-tpm2-util-fix-PCR-bank-guessing-without-EFI.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0018-shared-fdset-add-detailed-debug-logging-to-fdset_new.patch
 create mode 100644 meta/recipes-core/systemd/systemd/Handle-missing-pidfd_open-and-STATX_MNT_ID-on-older-.patch
 create mode 100644 meta/recipes-core/systemd/systemd/hwdb-use-compat-mode-for-reproducible-cross-builds.patch
 rename meta/recipes-core/systemd/{systemd_259.5.bb => systemd_261.bb} (99%)
#1 lore raw

PATCH v4 1/2 systemd: upgrade to 261

From: Daniel Turull <[email protected]>

Changes: https://github.com/systemd/systemd/compare/v259.5...v261-stable

- Drop backported patches no longer needed (libfido2_cflags, tpm2-util PCR bank, fdset_new debug)
- Remove sysvinit-path/sysvrcnd-path meson options and systemd-sysv-install skeleton (removed upstream in 260)
- Add explicit meson disables for auto-detected features in systemd-systemctl-native to prevent host sysroot contamination
- Refresh 0003-Do-not-create-var-log-README.patch

Tested on qemu target with testsuite systemd

AI-Generated: Claude-opus-4.6

---
 ...ve_259.5.bb => systemd-boot-native_261.bb} |  0
 ...temd-boot_259.5.bb => systemd-boot_261.bb} |  0
 ...9.5.bb => systemd-systemctl-native_261.bb} |  8 +-
 meta/recipes-core/systemd/systemd.inc         |  8 +-
 ...meson-use-libfido2_cflags-dependency.patch | 54 -----------
 .../0003-Do-not-create-var-log-README.patch   | 10 +-
 ...il-fix-PCR-bank-guessing-without-EFI.patch | 62 ------------
 ...-detailed-debug-logging-to-fdset_new.patch | 97 -------------------
 .../{systemd_259.5.bb => systemd_261.bb}      | 12 +--
 9 files changed, 18 insertions(+), 233 deletions(-)
 rename meta/recipes-core/systemd/{systemd-boot-native_259.5.bb => systemd-boot-native_261.bb} (100%)
 rename meta/recipes-core/systemd/{systemd-boot_259.5.bb => systemd-boot_261.bb} (100%)
 rename meta/recipes-core/systemd/{systemd-systemctl-native_259.5.bb => systemd-systemctl-native_261.bb} (54%)
 delete mode 100644 meta/recipes-core/systemd/systemd/0001-meson-use-libfido2_cflags-dependency.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0004-tpm2-util-fix-PCR-bank-guessing-without-EFI.patch
 delete mode 100644 meta/recipes-core/systemd/systemd/0018-shared-fdset-add-detailed-debug-logging-to-fdset_new.patch
 rename meta/recipes-core/systemd/{systemd_259.5.bb => systemd_261.bb} (99%)
meta/recipes-core/systemd/systemd-boot-native_261.bb renamed from meta/recipes-core/systemd/systemd-boot-native_259.5.bb +0 -0
similarity index 100%
rename from meta/recipes-core/systemd/systemd-boot-native_259.5.bb
rename to meta/recipes-core/systemd/systemd-boot-native_261.bb
meta/recipes-core/systemd/systemd-boot_261.bb renamed from meta/recipes-core/systemd/systemd-boot_259.5.bb +0 -0
similarity index 100%
rename from meta/recipes-core/systemd/systemd-boot_259.5.bb
rename to meta/recipes-core/systemd/systemd-boot_261.bb
meta/recipes-core/systemd/systemd-systemctl-native_261.bb renamed from meta/recipes-core/systemd/systemd-systemctl-native_259.5.bb +7 -1
similarity index 54%
rename from meta/recipes-core/systemd/systemd-systemctl-native_259.5.bb
rename to meta/recipes-core/systemd/systemd-systemctl-native_261.bb
index bf9c9f4776..28fddc79df 100644
@@ -10,8 +10,14 @@ inherit pkgconfig meson native
 
 MESON_TARGET = "systemctl"
 MESON_INSTALL_TAGS = "systemctl"
+# Explicitly disable features that meson auto-detects from the native sysroot.
+# Only systemctl is built here; these prevent spurious dependencies and ensure
+# reproducible builds regardless of what is installed on the build host.
 EXTRA_OEMESON += "-Dlink-systemctl-shared=false"
-EXTRA_OEMESON += "-Dsysvinit-path= -Dsysvrcnd-path="
+EXTRA_OEMESON += "-Dpam=disabled -Daudit=disabled -Dselinux=disabled"
+EXTRA_OEMESON += "-Dacl=disabled -Dapparmor=disabled -Dseccomp=disabled"
+EXTRA_OEMESON += "-Dlibcryptsetup=disabled -Dlibcurl=disabled -Dlibfido2=disabled"
+EXTRA_OEMESON += "-Dpcre2=disabled -Dp11kit=disabled -Dopenssl=disabled"
 
 # Systemctl is supposed to operate on target, but the target sysroot is not
 # determined at run-time, but rather set during configure
meta/recipes-core/systemd/systemd.inc +2 -6
index f107c4c5da..d9048e9187 100644
@@ -15,14 +15,10 @@ LICENSE:libsystemd = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=c09786363500a9acc29b147e6e72d2c6 \
                     file://LICENSE.LGPL2.1;md5=be0aaf4a380f73f7e00b420a007368f2"
 
-SRCREV = "b3d8fc43e9cb531d958c17ef2cd93b374bc14e8a"
-SRCBRANCH = "v259-stable"
+SRCREV = "de9dbc37ad4aa637e200ac02a0545095997055df"
+SRCBRANCH = "v261-stable"
 SRC_URI = "git://github.com/systemd/systemd.git;protocol=https;branch=${SRCBRANCH};tag=v${PV}"
 
 CVE_PRODUCT = "systemd"
 
 CVE_STATUS[CVE-2019-3815] = "not-applicable-platform: only applied to RHEL"
-CVE_STATUS[CVE-2026-40223] = "fixed-version: fixed in 259.2"
-CVE_STATUS[CVE-2026-40224] = "fixed-version: fixed in 259.3"
-CVE_STATUS[CVE-2026-40225] = "fixed-version: fixed in 259.5"
-CVE_STATUS[CVE-2026-40226] = "fixed-version: fixed in 259.4"
meta/recipes-core/systemd/systemd/0001-meson-use-libfido2_cflags-dependency.patch deleted +0 -54

54 lines not on this page · raw message

meta/recipes-core/systemd/systemd/0003-Do-not-create-var-log-README.patch +3 -7
index 1d3c4f83c0..0128c83d9f 100644
@@ -1,7 +1,7 @@
 From a7f6a296707642d05463aec22ea3dfce7d06c989 Mon Sep 17 00:00:00 2001
 From: Peter Kjellerstedt <[email protected]>
 Date: Tue, 21 Jan 2025 05:02:00 +0100
-Subject: [PATCH 03/16] Do not create /var/log/README
+Subject: [PATCH] Do not create /var/log/README
 
 /var/log/README is a link to /usr/share/doc/systemd/README.logs. The
 latter is packaged in systemd-doc and likely not installed, which leaves
@@ -15,19 +15,15 @@ Signed-off-by: Peter Kjellerstedt <[email protected]>
  1 file changed, 3 deletions(-)
 
 diff --git a/tmpfiles.d/legacy.conf.in b/tmpfiles.d/legacy.conf.in
-index cdef21fa9b..03798c953e 100644
+index cdef21fa9b..7890abcdef 100644
 --- a/tmpfiles.d/legacy.conf.in
 +++ b/tmpfiles.d/legacy.conf.in
-@@ -13,9 +13,6 @@
+@@ -13,6 +13,3 @@
  
  d /run/lock 0755 root root -
  L /var/lock - - - - ../run/lock
 -{% if CREATE_LOG_DIRS %}
 -L$ /var/log/README - - - - ../..{{DOC_DIR}}/README.logs
 -{% endif %}
- 
- {% if HAVE_SYSV_COMPAT %}
- # /run/lock/subsys is used for serializing SysV service execution, and
 -- 
 2.34.1
-
meta/recipes-core/systemd/systemd/0004-tpm2-util-fix-PCR-bank-guessing-without-EFI.patch deleted +0 -62

62 lines not on this page · raw message

meta/recipes-core/systemd/systemd/0018-shared-fdset-add-detailed-debug-logging-to-fdset_new.patch deleted +0 -97

97 lines not on this page · raw message

meta/recipes-core/systemd/systemd_261.bb renamed from meta/recipes-core/systemd/systemd_259.5.bb +6 -6
similarity index 99%
rename from meta/recipes-core/systemd/systemd_259.5.bb
rename to meta/recipes-core/systemd/systemd_261.bb
index f3ec0edae7..eedce348c3 100644
@@ -32,9 +32,6 @@ SRC_URI += " \
            file://systemd-pager.sh \
            file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0003-Do-not-create-var-log-README.patch \
-           file://0001-meson-use-libfido2_cflags-dependency.patch \
-           file://0018-shared-fdset-add-detailed-debug-logging-to-fdset_new.patch \
-           file://0004-tpm2-util-fix-PCR-bank-guessing-without-EFI.patch \
            "
 
 PAM_PLUGINS = " \
@@ -226,9 +223,6 @@ EXTRA_OEMESON += "-Dnobody-user=nobody \
                   -Ddbus=disabled \
                   -Dtests=false \
                   -Dlibc=${TCLIBC} \
-                  -Drc-local='' \
-                  -Dsysvinit-path='' \
-                  -Dsysvrcnd-path='' \
                   "
 
 # Hardcode target binary paths to avoid using paths from sysroot or worse
@@ -582,6 +576,8 @@ FILES:${PN}-extra-utils = "\
                         ${bindir}/systemd-cgtop \
                         ${bindir}/systemd-stdio-bridge \
                         ${base_sbindir}/mount.ddi \
+                        ${base_sbindir}/mount.mstack \
+                        ${base_sbindir}/mount.storage \
                         ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \
                         ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \
                         ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \
@@ -678,6 +674,7 @@ FILES:${PN} = " ${base_bindir}/* \
                 ${datadir}/polkit-1 \
                 ${datadir}/${BPN} \
                 ${datadir}/factory \
+                ${datadir}/user-tmpfiles.d \
                 ${sysconfdir}/credstore/ \
                 ${sysconfdir}/credstore.encrypted/ \
                 ${sysconfdir}/dbus-1/ \
@@ -687,6 +684,7 @@ FILES:${PN} = " ${base_bindir}/* \
                 ${sysconfdir}/sysctl.d/ \
                 ${sysconfdir}/systemd/ \
                 ${sysconfdir}/tmpfiles.d/ \
+                ${sysconfdir}/user-tmpfiles.d/ \
                 ${sysconfdir}/xdg/ \
                 ${sysconfdir}/init.d/README \
                 ${sysconfdir}/resolv-conf.systemd \
@@ -797,11 +795,13 @@ FILES:udev += "${base_sbindir}/udevd \
                ${nonarch_libdir}/udev/rules.d/60-persistent-storage.rules \
                ${nonarch_libdir}/udev/rules.d/60-persistent-storage-mtd.rules \
                ${nonarch_libdir}/udev/rules.d/60-persistent-storage-tape.rules \
+               ${nonarch_libdir}/udev/rules.d/60-tpm2-id.rules \
                ${nonarch_libdir}/udev/rules.d/60-persistent-v4l.rules \
                ${nonarch_libdir}/udev/rules.d/60-sensor.rules \
                ${nonarch_libdir}/udev/rules.d/60-serial.rules \
                ${nonarch_libdir}/udev/rules.d/61-autosuspend-manual.rules \
                ${nonarch_libdir}/udev/rules.d/64-btrfs.rules \
+               ${nonarch_libdir}/udev/rules.d/65-integration.rules \
                ${nonarch_libdir}/udev/rules.d/70-camera.rules \
                ${nonarch_libdir}/udev/rules.d/70-joystick.rules \
                ${nonarch_libdir}/udev/rules.d/70-memory.rules \
#2 lore raw

PATCH v4 2/2 systemd: add native hwdb generator via merged systemd-tools-native

In reply to [email protected]

From: Daniel Turull <[email protected]>

systemd 261 requires STATX_MNT_ID (kernel >= 5.8) for path resolution. On older hosts (e.g. RHEL 8 with kernel 4.18), the QEMU-emulated udevadm hwdb fails during image construction.

Build systemd-hwdb natively so image construction no longer depends on QEMU-emulated udevadm on such hosts, with:
- A patch restoring /proc/self/fdinfo mount-ID fallback for kernels lacking STATX_MNT_ID (applied only to the native tools recipe)
- A patch forcing compat mode in hwdb generation to avoid embedding build-host paths in hwdb.bin (reproducibility)

Update the update_udev_hwdb intercept to prefer the native systemd-hwdb over QEMU emulation, with a test -s check to catch silent failures from either path.

Rather than add a second native recipe, merge systemctl and systemd-hwdb into a single systemd-tools-native recipe that builds both tools from one meson configure. Both are satisfied by target-absolute paths (--prefix /usr for hwdb's UDEVLIBEXECDIR, --sysconfdir /etc for systemctl); systemctl --root enable/disable and hwdb generation were verified to behave identically to the previous separate builds. All in-tree consumers (systemd.bbclass, systemd_261.bb, keymaps, initscripts, modutils-initscripts) are updated to the new name.

Tested on RHEL 8.10 and Ubuntu 22.04.5

AI-Generated: Claude-opus-4.6

---
systemd-tools-native is assigned to Chen Qi in maintainers.inc, matching the rest of the systemd recipes; adjust if a different owner is preferred.

---
 meta/classes-recipe/systemd.bbclass           |   4 +-
 meta/conf/distro/include/maintainers.inc      |   2 +-
 meta/recipes-bsp/keymaps/keymaps_1.0.bb       |   2 +-
 .../initscripts/initscripts_1.0.bb            |   2 +-
 .../systemd/systemd-systemctl-native_261.bb   |  25 ---
 .../systemd/systemd-tools-native_261.bb       |  42 +++++
 ...idfd_open-and-STATX_MNT_ID-on-older-.patch | 176 ++++++++++++++++++
 ...t-mode-for-reproducible-cross-builds.patch |  36 ++++
 meta/recipes-core/systemd/systemd_261.bb      |   2 +-
 .../modutils-initscripts.bb                   |   2 +-
 scripts/postinst-intercepts/update_udev_hwdb  |  24 ++-
 11 files changed, 281 insertions(+), 36 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd-systemctl-native_261.bb
 create mode 100644 meta/recipes-core/systemd/systemd-tools-native_261.bb
 create mode 100644 meta/recipes-core/systemd/systemd/Handle-missing-pidfd_open-and-STATX_MNT_ID-on-older-.patch
 create mode 100644 meta/recipes-core/systemd/systemd/hwdb-use-compat-mode-for-reproducible-cross-builds.patch
meta/classes-recipe/systemd.bbclass +2 -2
index 26eaaf1922..8c6b6cae36 100644
@@ -21,8 +21,8 @@ python __anonymous() {
     # Inhibit update-rcd from doing any work so that systemd images don't have
     # redundant init files.
     if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        d.appendVar("DEPENDS", " systemd-systemctl-native")
-        d.appendVar("PACKAGE_WRITE_DEPS", " systemd-systemctl-native")
+        d.appendVar("DEPENDS", " systemd-tools-native")
+        d.appendVar("PACKAGE_WRITE_DEPS", " systemd-tools-native")
         d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
 }
 
meta/conf/distro/include/maintainers.inc +1 -1
index 4c6307086c..53a274c0a2 100644
@@ -833,7 +833,7 @@ RECIPE_MAINTAINER:pn-systemd-bootconf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-conf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-machine-units = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-serialgetty = "Chen Qi <[email protected]>"
-RECIPE_MAINTAINER:pn-systemd-systemctl-native = "Chen Qi <[email protected]>"
+RECIPE_MAINTAINER:pn-systemd-tools-native = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemtap = "Victor Kamensky <[email protected]>"
 RECIPE_MAINTAINER:pn-systemtap-native = "Victor Kamensky <[email protected]>"
 RECIPE_MAINTAINER:pn-sysvinit = "Ross Burton <[email protected]>"
meta/recipes-bsp/keymaps/keymaps_1.0.bb +1 -1
index b7e6ef6cb1..171f7f7c0b 100644
@@ -36,7 +36,7 @@ do_install () {
     fi
 }
 
-PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-tools-native','',d)}"
 pkg_postinst:${PN} () {
 	if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
 		if [ -n "$D" ]; then
meta/recipes-core/initscripts/initscripts_1.0.bb +1 -1
index 23411b6a71..48c1b6244f 100644
@@ -41,7 +41,7 @@ S = "${UNPACKDIR}"
 KERNEL_VERSION = ""
 
 DEPENDS:append = " update-rc.d-native"
-PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-tools-native','',d)}"
 
 PACKAGES =+ "${PN}-functions ${PN}-sushell"
 RDEPENDS:${PN} = "initd-functions \
meta/recipes-core/systemd/systemd-systemctl-native_261.bb deleted +0 -25
deleted file mode 100644
index 28fddc79df..0000000000
@@ -1,25 +0,0 @@
-FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:"
-
-SUMMARY = "Systemctl executable from systemd"
-
-require systemd.inc
-
-DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
-
-inherit pkgconfig meson native
-
-MESON_TARGET = "systemctl"
-MESON_INSTALL_TAGS = "systemctl"
-# Explicitly disable features that meson auto-detects from the native sysroot.
-# Only systemctl is built here; these prevent spurious dependencies and ensure
-# reproducible builds regardless of what is installed on the build host.
-EXTRA_OEMESON += "-Dlink-systemctl-shared=false"
-EXTRA_OEMESON += "-Dpam=disabled -Daudit=disabled -Dselinux=disabled"
-EXTRA_OEMESON += "-Dacl=disabled -Dapparmor=disabled -Dseccomp=disabled"
-EXTRA_OEMESON += "-Dlibcryptsetup=disabled -Dlibcurl=disabled -Dlibfido2=disabled"
-EXTRA_OEMESON += "-Dpcre2=disabled -Dp11kit=disabled -Dopenssl=disabled"
-
-# Systemctl is supposed to operate on target, but the target sysroot is not
-# determined at run-time, but rather set during configure
-# More details are here https://github.com/systemd/systemd/issues/35897#issuecomment-2665405887
-EXTRA_OEMESON += "--sysconfdir ${sysconfdir_native}"
meta/recipes-core/systemd/systemd-tools-native_261.bb new file +42 -0

42 lines not on this page · raw message

meta/recipes-core/systemd/systemd/Handle-missing-pidfd_open-and-STATX_MNT_ID-on-older-.patch new file +176 -0

176 lines not on this page · raw message

meta/recipes-core/systemd/systemd/hwdb-use-compat-mode-for-reproducible-cross-builds.patch new file +36 -0
new file mode 100644
index 0000000000..bb90105cbd
@@ -0,0 +1,36 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Daniel Turull <[email protected]>
+Date: Wed, 25 Jun 2026 10:00:00 +0200
+Subject: [PATCH] hwdb: use compat mode to avoid embedding source paths
+
+Use compat=true in systemd-hwdb's verb_update() so that source
+filenames, line numbers, and priorities are not embedded in hwdb.bin.
+
+Without this, when --root $D is used during cross-compilation, the
+absolute build paths (e.g. /tmp/work/.../rootfs/usr/lib/udev/hwdb.d/...)
+are written into the database, causing:
+- Non-reproducible builds (different TMPDIR → different hwdb.bin)
+- Build directory path leakage into the target image
+
+The compat format matches what udevadm hwdb (the deprecated path)
+has always produced, and is the expected format for cross-built images.
+
+Upstream-Status: Inappropriate [oe specific]
+
+AI-Generated: Claude Opus 4.6
+Signed-off-by: Daniel Turull <[email protected]>
+---
+ src/hwdb/hwdb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/hwdb/hwdb.c
++++ b/src/hwdb/hwdb.c
+@@ -27,7 +27,7 @@ static int verb_update(int argc, char *argv[], uintptr_t _data, void *userdata)
+         if (hwdb_bypass())
+                 return 0;
+ 
+-        return hwdb_update(arg_root, arg_hwdb_bin_dir, arg_strict, false);
++        return hwdb_update(arg_root, arg_hwdb_bin_dir, arg_strict, true);
+ }
+ 
+ static int help(void) {
meta/recipes-core/systemd/systemd_261.bb +1 -1
index eedce348c3..05440e92bb 100644
@@ -910,7 +910,7 @@ pkg_prerm:${PN}:libc-glibc () {
 	fi
 }
 
-PACKAGE_WRITE_DEPS += "qemuwrapper-cross"
+PACKAGE_WRITE_DEPS += "qemuwrapper-cross systemd-tools-native"
 
 pkg_postinst:udev-hwdb () {
 	if test -n "$D"; then
meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb +1 -1
index fb7b09393a..a1b70b9219 100644
@@ -19,7 +19,7 @@ do_install () {
 	install -m 0755 ${S}/modutils.sh ${D}${sysconfdir}/init.d/
 }
 
-PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-tools-native','',d)}"
 pkg_postinst:${PN} () {
 	if type systemctl >/dev/null 2>/dev/null; then
 		if [ -n "$D" ]; then
scripts/postinst-intercepts/update_udev_hwdb +20 -4
index 8b3f5de791..d7a4ffc294 100644
@@ -19,7 +19,23 @@ case "${PREFERRED_PROVIDER_udev}" in
 		;;
 esac
 
-rm -f $D${UDEVLIBDIR}/udev/hwdb.bin
-PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS} ||
-	PSEUDO_UNLOAD=1 qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS}
-chown root:root $D${UDEVLIBDIR}/udev/hwdb.bin
+hwdb_bin="$D${UDEVLIBDIR}/udev/hwdb.bin"
+rm -f "$hwdb_bin"
+
+# Use native systemd-hwdb to generate hwdb.bin at build time.
+# This avoids QEMU user-mode emulation and works on host kernels < 5.8
+# (e.g. RHEL 8) where systemd 261+ would fail due to missing STATX_MNT_ID.
+NATIVE_HWDB="${STAGING_DIR_NATIVE}/usr/bin/systemd-hwdb"
+if test -x "$NATIVE_HWDB" && test "${PREFERRED_PROVIDER_udev}" = "systemd"; then
+	PSEUDO_UNLOAD=1 $NATIVE_HWDB update --root $D ${UDEV_EXTRA_ARGS}
+else
+	PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS} ||
+		PSEUDO_UNLOAD=1 qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS}
+fi
+
+if ! test -s "$hwdb_bin"; then
+	echo "ERROR: hwdb.bin was not created at $hwdb_bin" >&2
+	echo "The hwdb generation command exited successfully but produced no output." >&2
+	exit 1
+fi
+chown root:root "$hwdb_bin"
#3 lore raw

Re: [PATCH v4 2/2] systemd: add native hwdb generator via merged systemd-tools-native

Hi Daniel,

Quoted 9 lines · On 3 Jul 2026, at 08:29, [email protected] wrote:

Build systemd-hwdb natively so image construction no longer depends on QEMU-emulated udevadm on such hosts, with:
- A patch restoring /proc/self/fdinfo mount-ID fallback for kernels lacking STATX_MNT_ID (applied only to the native tools recipe)
- A patch forcing compat mode in hwdb generation to avoid embedding build-host paths in hwdb.bin (reproducibility)

Quoted 3 lines

Update the update_udev_hwdb intercept to prefer the native systemd-hwdb over QEMU emulation, with a test -s check to catch silent failures from either path.

Staring at these patches made me have thoughts and ideas, I’ve just sent some patches that do some cleanups to the systemctl code (and conflict with your series) that also then renames systemd-systemctl-native to -tools-, so that the upgrade work is tidier as it doesn’t also need to rename lots of things. This makes patches easier to review/revert/backport/etc.

Then some research revealed that we don’t need to run update-hwdb in a qemu at all, we were likely doing that originally because we didn’t have a native recipe and the generated file has explicit bytesize/word order: the files generated by ppc32 vs aarch64 in qemu are identical, so we can just delete the qemu codepaths entirely.

This did involve discovering that there’s a bug in pseudo and writing an upstreamable patch for systemd-hwdb to strip build paths, but I think we’re getting there. The last bit of the series needs a bit more love, but I’ll be sending that on Monday.

Then we can rebase the 261 upgrade, which should be a lot smaller!

Ross

#4 lore raw

Re: [PATCH v4 2/2] systemd: add native hwdb generator via merged systemd-tools-native

Quoted 29 lines · Ross Burton

Hi Daniel,

Quoted 10 lines · On 3 Jul 2026, at 08:29, [email protected] wrote:

Build systemd-hwdb natively so image construction no longer depends on
QEMU-emulated udevadm on such hosts, with:
- A patch restoring /proc/self/fdinfo mount-ID fallback for kernels lacking STATX_MNT_ID (applied only to the native tools recipe)
- A patch forcing compat mode in hwdb generation to avoid embedding build-host paths in hwdb.bin (reproducibility)

Quoted 3 lines

Update the update_udev_hwdb intercept to prefer the native systemd-hwdb over QEMU emulation, with a test -s check to catch silent failures from either path.

Staring at these patches made me have thoughts and ideas, I’ve just sent some patches that do some cleanups to the systemctl code (and conflict with your series) that also then renames systemd-systemctl- native to -tools-, so that the upgrade work is tidier as it doesn’t also need to rename lots of things.  This makes patches easier to review/revert/backport/etc.

Then some research revealed that we don’t need to run update-hwdb in a qemu at all, we were likely doing that originally because we didn’t have a native recipe and the generated file has explicit bytesize/word order: the files generated by ppc32 vs aarch64 in qemu are identical, so we can just delete the qemu codepaths entirely.

Quoted 7 lines

This did involve discovering that there’s a bug in pseudo and writing an upstreamable patch for systemd-hwdb to strip build paths, but I think we’re getting there.  The last bit of the series needs a bit more love, but I’ll be sending that on Monday.

Then we can rebase the 261 upgrade, which should be a lot smaller!

Thanks Ross, then I'll rebase the upgrade on top of you new patches. I will also take the latest systemd version

what about the debian 11 compatibility, has been settle to use buildtools within debian 11 since it is old and reaching EOL or should I put effort to make it build natively?

Daniel

#5 lore raw

Re: [PATCH v4 2/2] systemd: add native hwdb generator via merged systemd-tools-native

Quoted 46 lines · Daniel Turull
Quoted 36 lines · Ross Burton

Hi Daniel,

Quoted 13 lines · On 3 Jul 2026, at 08:29, [email protected] wrote:

Build systemd-hwdb natively so image construction no longer depends
on
QEMU-emulated udevadm on such hosts, with:
- A patch restoring /proc/self/fdinfo mount-ID fallback for kernels
  lacking STATX_MNT_ID (applied only to the native tools recipe)
- A patch forcing compat mode in hwdb generation to avoid embedding
  build-host paths in hwdb.bin (reproducibility)

Quoted 3 lines

Update the update_udev_hwdb intercept to prefer the native systemd-hwdb over QEMU emulation, with a test -s check to catch silent failures from either path.

Staring at these patches made me have thoughts and ideas, I’ve just sent some patches that do some cleanups to the systemctl code (and conflict with your series) that also then renames systemd- systemctl-
native to -tools-, so that the upgrade work is tidier as it doesn’t also need to rename lots of things.  This makes patches easier to review/revert/backport/etc.

Then some research revealed that we don’t need to run update-hwdb in
a qemu at all, we were likely doing that originally because we didn’t
have a native recipe and the generated file has explicit bytesize/word order: the files generated by ppc32 vs aarch64 in qemu
are identical, so we can just delete the qemu codepaths entirely.

Quoted 8 lines

This did involve discovering that there’s a bug in pseudo and writing
an upstreamable patch for systemd-hwdb to strip build paths, but I think we’re getting there.  The last bit of the series needs a bit more love, but I’ll be sending that on Monday.

Then we can rebase the 261 upgrade, which should be a lot smaller!

Quoted 7 lines

Thanks Ross, then I'll rebase the upgrade on top of you new patches. I
will also take the latest systemd version

what about the debian 11 compatibility, has been settle to use buildtools within debian 11 since it is old and reaching EOL or should I put effort to make it build natively?

We switched debian11 to use buildtools so we're ok there.

I have some of Ross' patches ready for merging in master-next. I'd also written this patch myself:

https://git.openembedded.org/openembedded-core/commit/?h=master-next&id=87c788c4f1f99425c6716d0337ec153719bcca4a

which applied on top of yours, basically dropping the systemd intercept as I don't think it is needed any more if we're not using qemu.

Cheers,

Richard