Skip to contentSkip to conversation

conserver: only inherit useradd with systemd

PATCH New Peter Suti 1 participant 1 message Nov 26

lore
Share & tools
lore

Peter Suti

author
#0 lore raw

PATCH 1/1 conserver: only inherit useradd with systemd

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

---
 meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb +3 -4
index 8a841bf97e..57b50f30c8 100644
@@ -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; \
 "
Signature · 1 line
2.43.0