> -----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 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
> 
> Signed-off-by: Telukula Jeevan Kumar Sahu <[email protected]>
> ---
>  meta/classes/useradd.bbclass | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
> index d7ed6cb931..6738ad12f4 100644
> --- a/meta/classes/useradd.bbclass
> +++ b/meta/classes/useradd.bbclass
> @@ -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
> --
> 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

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#236584): 
https://lists.openembedded.org/g/openembedded-core/message/236584
Mute This Topic: https://lists.openembedded.org/mt/119195310/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to