diff mbox series

[meta-oe] conserver: only inherit useradd with systemd

Message ID 20261126073514.48187-1-peter.suti@streamunlimited.com
State Under Review
Headers show
Series [meta-oe] conserver: only inherit useradd with systemd | expand

Commit Message

Peter Suti Nov. 26, 2026, 7:35 a.m. UTC
With multilib enabled and systemd not in DISTRO_FEATURES, parsing
fails:

    ERROR: .../conserver_8.3.0.bb: .../conserver_8.3.0.bb inherits
    useradd but doesn't set USERADD_PACKAGES

Without systemd, USERADD_PACKAGES only holds whitespace. That passes
the "if not useradd_packages" check in useradd.bbclass, but for a
multilib variant multilib.bbclass filters the variable through
suffix_filter(), which returns " ".join(val.split()). The result is an
empty string and the check fails.

Fix this by inheriting useradd only when systemd is enabled, as the
user is only needed by conserver.service. USERADD_PACKAGES can then be
set unconditionally. chrony does the same for its privdrop user.

Tested on qemux86-64 with MULTILIBS = "multilib:lib32", both with
INIT_MANAGER = "sysvinit" and "systemd":

    bitbake -p
    bitbake -e conserver
    bitbake -e lib32-conserver

With sysvinit, useradd is not inherited, so as before no user is
created. With systemd, USERADD_PACKAGES is "conserver" and
"lib32-conserver" and both inherit useradd.

Fixes https://github.com/openembedded/meta-openembedded/issues/1058

AI-Generated: Claude Code, Opus 5.5
Signed-off-by: Peter Suti <peter.suti@streamunlimited.com>
---
 meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb b/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
index 8a841bf97e..57b50f30c8 100644
--- a/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
+++ b/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
@@ -17,7 +17,8 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=b28513e7b696027d3d2b8dbf117f9fe5"
 
 DEPENDS = "virtual/crypt"
 
-inherit autotools ptest systemd useradd
+inherit autotools ptest systemd
+inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}
 
 SRC_URI = "\
     git://github.com/bstansell/conserver;protocol=https;branch=master;tag=v${PV} \
@@ -81,9 +82,7 @@  RDEPENDS:${PN}-ptest += "bash"
 
 SYSTEMD_SERVICE:${PN} = "${PN}.service"
 
-USERADD_PACKAGES = "\
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${PN}', '', d)} \
-"
+USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "\
     -M -d /invalid -r -U -s ${sbindir}/nologin conserver; \
 "