useradd: use --root for groupmems which lacks --prefix support
PATCH 1/1 useradd: use --root for groupmems which lacks --prefix support
groupmems in shadow does not support --prefix (unlike useradd, groupadd, usermod). Only -R/--root is recognized. Recent commit [0] switched the global OPT to --prefix, breaking any recipe using GROUPMEMS_PARAM with "unrecognized option '--prefix'" at do_prepare_recipe_sysroot.
Introduce GROUPMEMS_OPT="--root $D" used exclusively in the groupmems loop, keeping OPT="--prefix $D" unchanged for all other shadow ops.
[0]: https://git.openembedded.org/openembedded-core/commit/?id=a7b846ba7d6d63a5e59939d75d9c5fe3e4cbb0e9
--- meta/classes/useradd.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/useradd.bbclass +5 -1
@@ -22,11 +22,15 @@ PACKAGE_WRITE_DEPS += "shadow-native" useradd_preinst () { OPT="" SYSROOT="" +GROUPMEMS_OPT="" if test "x$D" != "x"; then # Installing into a sysroot SYSROOT="$D" OPT="--prefix $D" + # groupmems does not support --prefix (unlike useradd/groupadd/usermod), + # only -R/--root is recognized. Use --root specifically for groupmems. + GROUPMEMS_OPT="--root $D" # Make sure login.defs is there, this is to make debian package backend work # correctly while doing rootfs.
@@ -92,7 +96,7 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` while test "x$opts" != "x"; do - perform_groupmems "$SYSROOT" "$OPT $opts" + perform_groupmems "$SYSROOT" "$GROUPMEMS_OPT $opts" if test "x$opts" = "x$remaining"; then break fi
Signature · 1 line
2.34.1
Quoted 51 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jeevan via lists.openembedded.org
Sent: den 7 maj 2026 13:41
To: [email protected]
Subject: [OE-core] [PATCH][master] useradd: use --root for groupmems which lacks --prefix supportgroupmems in shadow does not support --prefix (unlike useradd, groupadd, usermod). Only -R/--root is recognized. Recent commit [0] switched the global OPT to --prefix, breaking any recipe using
GROUPMEMS_PARAMwith "unrecognized option '--prefix'" atdo_prepare_recipe_sysroot.Introduce GROUPMEMS_OPT="--root $D" used exclusively in the groupmems loop, keeping OPT="--prefix $D" unchanged for all other shadow ops.
[0]: https://git.openembedded.org/openembedded-core/commit/?id=a7b846ba7d6d63a5e59939d75d9c5fe3e4cbb0e9
Signed-off-by Telukula Jeevan Kumar Sahu <[email protected]>--- meta/classes/useradd.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)meta/classes/useradd.bbclass +5
-2@@ -22,11 +22,15 @@ PACKAGE_WRITE_DEPS += "shadow-native" useradd_preinst () { OPT="" SYSROOT="" +GROUPMEMS_OPT="" if test "x$D" != "x"; then # Installing into a sysroot SYSROOT="$D" OPT="--prefix $D" + # groupmems does not support --prefix (unlike useradd/groupadd/usermod), + # only -R/--root is recognized. Use --root specifically for groupmems. + GROUPMEMS_OPT="--root $D" # Make sure login.defs is there, this is to make debian package backend work # correctly while doing rootfs.@@ -92,7 +96,7 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` while test "x$opts" != "x"; do - perform_groupmems "$SYSROOT" "$OPT $opts" + perform_groupmems "$SYSROOT" "$GROUPMEMS_OPT $opts" if test "x$opts" = "x$remaining"; then break fi --
Quoted 1 line
2.34.1
There is a Bugzilla issue for this: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16277
Since the groupmems command has actually been removed in newer versions of shadow, the proper solution is actually to switch to using the usermod command instead. I am working on it...
//Peter