Skip to contentSkip to conversation

systemd: update to 261 and be compatible with rhel8

PATCH Superseded [email protected] 2 participants 6 messages Jun 26 – Jul 2 Arm/Amlogic Meson SoC support

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 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

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

Daniel Turull (3):
dlopen-deps.inc: treat soname list as ordered alternatives
systemd: upgrade to 261
systemd: add native hwdb generator for hosts without STATX_MNT_ID

 meta/conf/distro/include/maintainers.inc      |   1 +
 meta/recipes-core/systemd/dlopen-deps.inc     |   9 +-
 ...ve_259.5.bb => systemd-boot-native_261.bb} |   0
 ...temd-boot_259.5.bb => systemd-boot_261.bb} |   0
 .../systemd/systemd-hwdb-native_261.bb        |  32 ++++
 .../systemd/systemd-systemctl-native_259.5.bb |  28 ---
 .../systemd/systemd-systemctl-native_261.bb   |  28 +++
 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 +-
 scripts/postinst-intercepts/update_udev_hwdb  |  24 ++-
 16 files changed, 311 insertions(+), 268 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%)
 create mode 100644 meta/recipes-core/systemd/systemd-hwdb-native_261.bb
 delete mode 100644 meta/recipes-core/systemd/systemd-systemctl-native_259.5.bb
 create mode 100644 meta/recipes-core/systemd/systemd-systemctl-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 v2 1/3 dlopen-deps.inc: treat soname list as ordered alternatives

From: Daniel Turull <[email protected]>

The .note.dlopen format defines the soname array as a list of alternatives (e.g. ["libcrypt.so.2", "libcrypt.so.1"]). The previous code warned for every soname that was not found, even when an earlier entry in the list already satisfied the dependency.

Select the first available provider and only warn when no alternative can be resolved.

AI-Generated: Claude-opus-4.6

---
 meta/recipes-core/systemd/dlopen-deps.inc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
meta/recipes-core/systemd/dlopen-deps.inc +6 -3
index e0b333398c..82a2ccd389 100644
@@ -66,15 +66,18 @@ python package_generate_dlopen_deps() {
                     elf = oe.qa.ELFFile(f)
                     elf.open()
                     for dep in parse(extract_segment(f, ".note.dlopen"), elf.isLittleEndian()):
+                        # soname list contains alternatives; find the first available provider
+                        found = False
                         for soname in dep["soname"]:
                             if soname in shlibs:
-                                # TODO assumes the first match is good
                                 package, version = list(shlibs[soname].values())[0]
                                 dependency = dep_map[dep["priority"]]
                                 bb.note(f"{pkg}: adding {dependency} on {package} via .note.dlopen")
                                 d.appendVar(f"{dependency}:{pkg}", f" {package} (>= {version})")
-                            else:
-                                bb.warn(f"cannot find {soname}")
+                                found = True
+                                break
+                        if not found:
+                            bb.warn(f"cannot find any provider for dlopen dependency: {dep['soname']}")
                 except oe.qa.NotELFFileError as e:
                     bb.note(f"Cannot extract ELF notes: {e}")
                     pass
#2 lore raw

PATCH v2 2/3 systemd: upgrade to 261

In reply to [email protected]

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} | 17 ++--
 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(+), 242 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 -10
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 3d01d60e9c..686448cf1e 100644
@@ -10,19 +10,16 @@ inherit pkgconfig meson native
 
 MESON_TARGET = "systemctl:executable"
 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
 # More details are here https://github.com/systemd/systemd/issues/35897#issuecomment-2665405887
 EXTRA_OEMESON += "--sysconfdir ${sysconfdir_native}"
-
-do_install:append() {
-	# Install systemd-sysv-install in /usr/bin rather than /usr/lib/systemd
-	# (where it is normally installed) so systemctl can find it in $PATH.
-	# It is expected that the use of systemd-sysv-install will be removed
-	# with version 259 of systemd and then this, and everything that was
-	# added along with it, should be reverted.
-	install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${bindir}/systemd-sysv-install
-}
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 \
#3 lore raw

PATCH v2 3/3 systemd: add native hwdb generator for hosts without STATX_MNT_ID

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.

Add systemd-hwdb-native recipe that builds systemd-hwdb natively with:
- A patch restoring /proc/self/fdinfo mount-ID fallback for kernels lacking STATX_MNT_ID (applied only to native recipes)
- 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.

Tested on RHEL 8.10 and Ubuntu 22.04.5

AI-Generated: Claude-opus-4.6

---
I'm not sure who should be the maitainer of the new native recipe. is it Qi Chen, who is the maintainer for the rest of systemd recipes, unassigned or me? The question I'm asking is because all need to be updated at the same time.

---
 meta/conf/distro/include/maintainers.inc      |   1 +
 .../systemd/systemd-hwdb-native_261.bb        |  32 ++++
 .../systemd/systemd-systemctl-native_261.bb   |   3 +
 ...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 +-
 scripts/postinst-intercepts/update_udev_hwdb  |  24 ++-
 7 files changed, 269 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd-hwdb-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/conf/distro/include/maintainers.inc +1 -0
index f757fafdcb..86bf4d14ee 100644
@@ -831,6 +831,7 @@ RECIPE_MAINTAINER:pn-systemd-boot-native = "Viswanath Kraleti <quic_vkraleti@qui
 RECIPE_MAINTAINER:pn-systemd-bootchart = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-bootconf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-conf = "Chen Qi <[email protected]>"
+RECIPE_MAINTAINER:pn-systemd-hwdb-native = "Unassigned <[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]>"
meta/recipes-core/systemd/systemd-hwdb-native_261.bb new file +32 -0
new file mode 100644
index 0000000000..0b3ff2ba03
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: MIT
+FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:"
+
+SUMMARY = "Hardware database management tool from systemd"
+
+require systemd.inc
+
+DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
+
+# TODO: Remove STATX_MNT_ID patch once minimum supported build host kernel is >= 5.8 (RHEL 8 EOL: 2029)
+SRC_URI += "file://Handle-missing-pidfd_open-and-STATX_MNT_ID-on-older-.patch \
+            file://hwdb-use-compat-mode-for-reproducible-cross-builds.patch \
+           "
+
+inherit pkgconfig meson native
+
+MESON_TARGET = "systemd-hwdb:executable"
+
+# Override prefix so compiled-in UDEVLIBEXECDIR (/usr/lib/udev) matches the
+# target rootfs layout. This allows --root $D --usr to find hwdb.d source
+# files and write hwdb.bin to the correct location.
+EXTRA_OEMESON += "--prefix /usr"
+EXTRA_OEMESON += "-Dhwdb=true -Dlink-udev-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"
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 ${B}/systemd-hwdb ${D}${bindir}/systemd-hwdb
+}
meta/recipes-core/systemd/systemd-systemctl-native_261.bb +3 -0
index 686448cf1e..a6ad6901e0 100644
@@ -6,6 +6,9 @@ require systemd.inc
 
 DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native"
 
+# TODO: Remove STATX_MNT_ID patch once minimum supported build host kernel is >= 5.8 (RHEL 8 EOL: 2029)
+SRC_URI += "file://Handle-missing-pidfd_open-and-STATX_MNT_ID-on-older-.patch"
+
 inherit pkgconfig meson native
 
 MESON_TARGET = "systemctl:executable"
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..22bd4ca5fc 100644
@@ -910,7 +910,7 @@ pkg_prerm:${PN}:libc-glibc () {
 	fi
 }
 
-PACKAGE_WRITE_DEPS += "qemuwrapper-cross"
+PACKAGE_WRITE_DEPS += "qemuwrapper-cross systemd-hwdb-native"
 
 pkg_postinst:udev-hwdb () {
 	if test -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"
#4 lore raw

Re: [OE-core] [PATCH v2 3/3] systemd: add native hwdb generator for hosts without STATX_MNT_ID

meta/recipes-core/systemd/systemd-hwdb-native_261.bb line 4

Quoted 9 lines · Daniel Turull via lists.openembedded.org

+++ b/meta/recipes-core/systemd/systemd-hwdb-native_261.bb

meta/recipes-core/systemd/systemd-hwdb-native_261.bb new file +4 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: MIT
+FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:"
+
+SUMMARY = "Hardware database management tool from systemd"

Would it be better to merge these native recipes into one? Something like systemd-tools-native, which builds both hwdb and systemctl.

Cheers,
Ross

#5 lore raw

Re: [OE-core] [PATCH v2 3/3] systemd: add native hwdb generator for hosts without STATX_MNT_ID

Quoted 14 lines · Ross Burton

meta/recipes-core/systemd/systemd-hwdb-native_261.bb line 4

Quoted 10 lines

On 26 Jun 2026, at 08:38, Daniel Turull via lists.openembedded.org <[email protected]> wrote:
+++ b/meta/recipes-core/systemd/systemd-hwdb-native_261.bb

meta/recipes-core/systemd/systemd-hwdb-native_261.bb new file +4 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: MIT
+FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:"
+
+SUMMARY = "Hardware database management tool from systemd"

Would it be better to merge these native recipes into one?  Something like systemd-tools-native, which builds both hwdb and systemctl.

Sure, I'll make a v4 with a systemd-tools-native. I hope later today or tomorrow I can send it.

Daniel