Add support for USERMOD_PARAM in useradd.bbclass
cover Add support for USERMOD_PARAM in useradd.bbclass
This is my proposed solution for groupmems' lack of support for the --prefix option
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=16277), and the fact that groupmems will be removed in the next version of shadow.
The first three commits make a little bit of clean-up to useradd.bbclass and then add the support for USERMOD_PARAM. These I would like to see backported to Wrynose. While technically it is a new feature, I hope this can be accepted (it should not affect anyone who does not actively start using it). It would make it a lot easier for us and others who are using GROUPMEMS_PARAM today (we have more than 300 recipes that will need to be updated) as it would then be possible to migrate the recipes over some time rather than having to do a flag day rewrite.
The next commit (only intended for master) modifies the perform_groupmems() function so that it actually uses usermod to do the work. This allows GROUPMEMS_PARAM to continue to work while we migrate to USERMOD_PARAM.
The last commit (also only intended for master) adds a warning for all recipes that use GROUPMEMS_PARAM, to inform that one should switch to USERMOD_PARAM.
The final piece (which is not included) here, is the actual removal of support for GROUPMEMS_PARAM. This I intend should be in place in time before feature freeze.
The intention of the above plan is to give us and others who rely on GROUPMEMS_PARAM a way to do the migration without having to resort to a flag day upgrade of a huge number of recipes, and still have everything in place and cleaned-up before 6.1 is released.
Peter Kjellerstedt (5):
useradd.bbclass: Some clean-ups and simplifications useradd.bbclass: Add support for USERMOD_PARAM package.bbclass: Add USERMOD_PARAM to PACKAGEVARS useradd_base.bbclass: Emulate the groupmems command using usermod useradd.bbclass: Show a deprecation warning if GROUPMEMS_PARAM is used
meta/classes-global/package.bbclass | 2 +- meta/classes/useradd.bbclass | 104 ++++++++++++++++++---------- meta/classes/useradd_base.bbclass | 7 +- meta/conf/documentation.conf | 1 + 4 files changed, 72 insertions(+), 42 deletions(-)
PATCH 1/5 useradd.bbclass: Some clean-ups and simplifications
* Improve some odd function names, e.g., groupmemsadd_sysroot and user_group_groupmems_add_sysroot. These were introduced in commit 322ef726132a47d977d2c6ee41de5358f1e85994 (useradd.bbclass: Fix order of postinst-useradd-*).
* Make common_useradd_sysroot() look for the actually used command instead of always looking for useradd.
* Simplification of common_useradd_sysroot() by using case/esac.
* A bit of whitespace clean-up.
--- meta/classes/useradd.bbclass | 60 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 32 deletions(-)
meta/classes/useradd.bbclass +28 -32
@@ -19,7 +19,7 @@ PACKAGE_WRITE_DEPS += "shadow-native" # c) As the preinst script in the target package at do_rootfs time # d) As the preinst script in the target package on device as a package upgrade # -useradd_preinst () { +useradd_preinst() { OPT="" SYSROOT=""
@@ -34,7 +34,7 @@ if test "x$D" != "x"; then # shadow package, then while performing preinsts for packages that depend on # shadow, there might only be /etc/login.def.dpkg-new there in root filesystem. if [ ! -e $D${sysconfdir}/login.defs -a -e $D${sysconfdir}/login.defs.dpkg-new ]; then - cp $D${sysconfdir}/login.defs.dpkg-new $D${sysconfdir}/login.defs + cp $D${sysconfdir}/login.defs.dpkg-new $D${sysconfdir}/login.defs fi # user/group lookups should match useradd/groupadd --prefix
@@ -102,19 +102,19 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then fi } -useradd_sysroot () { - user_group_groupmems_add_sysroot user +groupadd_sysroot() { + common_useradd_sysroot groupadd } -groupadd_sysroot () { - user_group_groupmems_add_sysroot group +useradd_sysroot() { + common_useradd_sysroot useradd } -groupmemsadd_sysroot () { - user_group_groupmems_add_sysroot groupmems +groupmems_sysroot() { + common_useradd_sysroot groupmems } -user_group_groupmems_add_sysroot () { +common_useradd_sysroot() { # Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running # at this point so we're explicit about the environment so pseudo can load if # not already present.
@@ -130,28 +130,24 @@ user_group_groupmems_add_sysroot () { # Beware that in some cases we might see the fake pseudo passwd here, in which case we also must # exit. if [ ! -f $D${sysconfdir}/passwd ] || - grep -q this-is-the-pseudo-passwd $D${sysconfdir}/passwd; then + grep -q this-is-the-pseudo-passwd $D${sysconfdir}/passwd; then exit 0 fi # It is also possible we may be in a recipe which doesn't have useradd dependencies and hence the # useradd/groupadd tools are unavailable. If there is no dependency, we assume we don't want to # create users in the sysroot - if ! command -v useradd; then - bbwarn "command useradd not found!" + if ! command -v "$1"; then + bbwarn "The $1 command could not be found!" exit 0 fi # Add groups and users defined for all recipe packages - if test "$1" = "group"; then - GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}" - elif test "$1" = "user"; then - USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}" - elif test "$1" = "groupmems"; then - GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}" - elif test "x$1" = "x"; then - bbwarn "missing type of passwd db action" - fi + case "$1" in + groupadd) GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}";; + useradd) USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}";; + groupmems) GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}";; + esac # Tell the system to use the environment vars UA_SYSROOT=1
@@ -159,36 +155,36 @@ user_group_groupmems_add_sysroot () { useradd_preinst } -# The export of PSEUDO in useradd_sysroot() above contains references to +# The export of PSEUDO in common_useradd_sysroot() above contains references to # ${PSEUDO_SYSROOT} and ${PSEUDO_LOCALSTATEDIR}. Additionally, the logging # shell functions use ${LOGFIFO}. These need to be handled when restoring # postinst-useradd-${PN} from the sstate cache. EXTRA_STAGING_FIXMES += "PSEUDO_SYSROOT PSEUDO_LOCALSTATEDIR LOGFIFO" -python useradd_sysroot_sstate () { - for type, sort_prefix in [("group", "01"), ("user", "02"), ("groupmems", "03")]: +python useradd_sysroot_sstate() { + for cmd, sort_prefix in [("groupadd", "01"), ("useradd", "02"), ("groupmems", "03")]: scriptfile = None task = d.getVar("BB_CURRENTTASK") if task == "package_setscene": - bb.build.exec_func(type + "add_sysroot", d) + bb.build.exec_func(f"{cmd}_sysroot", d) elif task == "prepare_recipe_sysroot": # Used to update this recipe's own sysroot so the user/groups are available to do_install # If do_populate_sysroot is triggered and we write the file here, there would be an overlapping - # files. See usergrouptests.UserGroupTests.test_add_task_between_p_sysroot_and_package - scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-" + sort_prefix + type + "-${PN}-recipedebug") + # file. See usergrouptests.UserGroupTests.test_add_task_between_p_sysroot_and_package + scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-" + sort_prefix + cmd + "-${PN}-recipedebug") - bb.build.exec_func(type + "add_sysroot", d) + bb.build.exec_func(f"{cmd}_sysroot", d) elif task == "populate_sysroot": # Used when installed in dependent task sysroots - scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-" + sort_prefix + type + "-${PN}") + scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-" + sort_prefix + cmd + "-${PN}") if scriptfile: bb.utils.mkdirhier(os.path.dirname(scriptfile)) with open(scriptfile, 'w') as script: script.write("#!/bin/sh -e\n") - bb.data.emit_func(type + "add_sysroot", script, d) - script.write(type + "add_sysroot\n") + bb.data.emit_func(f"{cmd}_sysroot", script, d) + script.write(f"{cmd}_sysroot\n") os.chmod(scriptfile, 0o755) }
@@ -247,7 +243,7 @@ def get_all_cmd_params(d, cmd_type): return "; ".join(params) # Adds the preinst script into generated packages -fakeroot python populate_packages:prepend () { +fakeroot python populate_packages:prepend() { def update_useradd_package(pkg): bb.debug(1, 'adding user/group calls to preinst for %s' % pkg)
PATCH 2/5 useradd.bbclass: Add support for USERMOD_PARAM
In reply to Peter KjellerstedtThe groupmems command will be removed in shadow 4.20. The same functionality as provided by groupmems can be achieved with the usermod command. Add support for USERMOD_PARAM variables to specify the options to use.
The following GROUPMEMS_PARAM:
GROUPMEMS_PARAM:${PN} = "--add user --group group1; \
--add user --group group2"would be directly converted to the following USERMOD_PARAM:
USERMOD_PARAM:${PN} = "--append --groups group1 user; \
--append --groups group2 user"It can also be simplified to:
USERMOD_PARAM:${PN} = "--append --groups group1,group2 user"
[YOCTO#16277]
--- meta/classes/useradd.bbclass | 39 ++++++++++++++++++++++++++++-------- meta/conf/documentation.conf | 1 + 2 files changed, 32 insertions(+), 8 deletions(-)
meta/classes/useradd.bbclass +31 -8
@@ -48,6 +48,7 @@ if test "x$UA_SYSROOT" = "x"; then # Add groups and users defined only for this package GROUPADD_PARAM="${GROUPADD_PARAM}" USERADD_PARAM="${USERADD_PARAM}" + USERMOD_PARAM="${USERMOD_PARAM}" GROUPMEMS_PARAM="${GROUPMEMS_PARAM}" fi
@@ -85,6 +86,22 @@ if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then done fi +if test "x`echo $USERMOD_PARAM | tr -d '[:space:]'`" != "x"; then + echo "Running usermod commands..." + # Invoke multiple instances of usermod for parameter lists + # separated by ';' + opts=`echo "$USERMOD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$USERMOD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + while test "x$opts" != "x"; do + perform_usermod "$SYSROOT" "$OPT $opts" + if test "x$opts" = "x$remaining"; then + break + fi + opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + done +fi + if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then echo "Running groupmems commands..." # Invoke multiple instances of groupmems for parameter lists
@@ -103,13 +120,17 @@ fi } groupadd_sysroot() { - common_useradd_sysroot groupadd + common_useradd_sysroot groupadd } useradd_sysroot() { common_useradd_sysroot useradd } +usermod_sysroot() { + common_useradd_sysroot usermod +} + groupmems_sysroot() { common_useradd_sysroot groupmems }
@@ -146,6 +167,7 @@ common_useradd_sysroot() { case "$1" in groupadd) GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}";; useradd) USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}";; + usermod) USERMOD_PARAM="${@get_all_cmd_params(d, 'usermod')}";; groupmems) GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}";; esac
@@ -162,7 +184,7 @@ common_useradd_sysroot() { EXTRA_STAGING_FIXMES += "PSEUDO_SYSROOT PSEUDO_LOCALSTATEDIR LOGFIFO" python useradd_sysroot_sstate() { - for cmd, sort_prefix in [("groupadd", "01"), ("useradd", "02"), ("groupmems", "03")]: + for cmd, sort_prefix in [("groupadd", "01"), ("useradd", "02"), ("usermod", "03"), ("groupmems", "04")]: scriptfile = None task = d.getVar("BB_CURRENTTASK") if task == "package_setscene":
@@ -216,9 +238,9 @@ def update_useradd_after_parse(d): bb.fatal("%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE', False)) for pkg in useradd_packages.split(): - d.appendVarFlag("do_populate_sysroot", "vardeps", " USERADD_PARAM:%s GROUPADD_PARAM:%s GROUPMEMS_PARAM:%s" % (pkg, pkg, pkg)) - if not d.getVar('USERADD_PARAM:%s' % pkg) and not d.getVar('GROUPADD_PARAM:%s' % pkg) and not d.getVar('GROUPMEMS_PARAM:%s' % pkg): - bb.fatal("%s inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package %s" % (d.getVar('FILE', False), pkg)) + d.appendVarFlag("do_populate_sysroot", "vardeps", f" USERADD_PARAM:{pkg} GROUPADD_PARAM:{pkg} USERMOD_PARAM:{pkg} GROUPMEMS_PARAM:{pkg}") + if not any(d.getVar(f"{name}_PARAM:{pkg}") for name in ["USERADD", "GROUPADD", "USERMOD", "GROUPMEMS"]): + bb.fatal("%s inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM, USERMOD_PARAM or GROUPMEMS_PARAM for package %s" % (d.getVar('FILE', False), pkg)) python __anonymous() { if not bb.data.inherits_class('nativesdk', d) \
@@ -226,8 +248,8 @@ python __anonymous() { update_useradd_after_parse(d) } -# Return a single [GROUP|USER]ADD_PARAM formatted string which includes the -# [group|user]add parameters for all USERADD_PACKAGES in this recipe +# Return a single (GROUPADD|USERADD|USERMOD)_PARAM formatted string which includes the +# (groupadd|useradd|usermod) parameters for all USERADD_PACKAGES in this recipe def get_all_cmd_params(d, cmd_type): import string
@@ -260,10 +282,11 @@ fakeroot python populate_packages:prepend() { preinst += 'bbfatal () {\n\techo "ERROR: $*"\n\texit 1\n}\n' preinst += 'perform_groupadd () {\n%s}\n' % d.getVar('perform_groupadd') preinst += 'perform_useradd () {\n%s}\n' % d.getVar('perform_useradd') + preinst += 'perform_usermod () {\n%s}\n' % d.getVar('perform_usermod') preinst += 'perform_groupmems () {\n%s}\n' % d.getVar('perform_groupmems') preinst += d.getVar('useradd_preinst') # Expand out the *_PARAM variables to the package specific versions - for rep in ["GROUPADD_PARAM", "USERADD_PARAM", "GROUPMEMS_PARAM"]: + for rep in ["GROUPADD_PARAM", "USERADD_PARAM", "USERMOD_PARAM", "GROUPMEMS_PARAM"]: val = d.getVar(rep + ":" + pkg) or "" preinst = preinst.replace("${" + rep + "}", val) d.setVar('pkg_preinst:%s' % pkg, preinst)
meta/conf/documentation.conf +1 -0
@@ -451,6 +451,7 @@ USERADD_PACKAGES[doc] = "When a recipe inherits the useradd class, this variable USERADD_PARAM[doc] = "When a recipe inherits the useradd class, this variable specifies for a package what parameters should be passed to the useradd command if you wish to add a user to the system when the package is installed." USERADD_UID_TABLES[doc] = "Specifies a password file to use for obtaining static user identification (uid) values when the OpenEmbedded build system adds a user to the system during package installation." USERADDEXTENSION[doc] = "When set to 'useradd-staticids', causes the OpenEmbedded build system to base all user and group additions on files listed in USERADD_UID_TABLES and USERADD_GID_TABLES." +USERMOD_PARAM[doc] = "When a recipe inherits the useradd class, this variable specifies for a package what parameters should be passed to the usermod command if you wish to modify a user when the package is installed. Typically used to add the user to one or more groups." #W
PATCH 3/5 package.bbclass: Add USERMOD_PARAM to PACKAGEVARS
In reply to Peter KjellerstedtThis complements the USERADD_PARAM and GROUPADD_PARAM variables.
[YOCTO#16277]
--- meta/classes-global/package.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-global/package.bbclass +1 -1
@@ -438,7 +438,7 @@ python package_depchains() { # Since bitbake can't determine which variables are accessed during package # iteration, we need to list them here: -PACKAGEVARS = "FILES RDEPENDS RRECOMMENDS SUMMARY DESCRIPTION RSUGGESTS RPROVIDES RCONFLICTS PKG ALLOW_EMPTY pkg_postinst pkg_postrm pkg_postinst_ontarget INITSCRIPT_NAME INITSCRIPT_PARAMS DEBIAN_NOAUTONAME ALTERNATIVE PKGE PKGV PKGR USERADD_PARAM GROUPADD_PARAM CONFFILES SYSTEMD_SERVICE LICENSE SECTION pkg_preinst pkg_prerm RREPLACES GROUPMEMS_PARAM SYSTEMD_AUTO_ENABLE SKIP_FILEDEPS PRIVATE_LIBS PACKAGE_ADD_METADATA" +PACKAGEVARS = "FILES RDEPENDS RRECOMMENDS SUMMARY DESCRIPTION RSUGGESTS RPROVIDES RCONFLICTS PKG ALLOW_EMPTY pkg_postinst pkg_postrm pkg_postinst_ontarget INITSCRIPT_NAME INITSCRIPT_PARAMS DEBIAN_NOAUTONAME ALTERNATIVE PKGE PKGV PKGR USERADD_PARAM GROUPADD_PARAM USERMOD_PARAM CONFFILES SYSTEMD_SERVICE LICENSE SECTION pkg_preinst pkg_prerm RREPLACES GROUPMEMS_PARAM SYSTEMD_AUTO_ENABLE SKIP_FILEDEPS PRIVATE_LIBS PACKAGE_ADD_METADATA" def gen_packagevar(d, pkgvars="PACKAGEVARS"): ret = []
PATCH 4/5 useradd_base.bbclass: Emulate the groupmems command using usermod
In reply to Peter KjellerstedtThe groupmems command does to support the --prefix option, which is being used since commit a7b846ba7d6d63a5e59939d75d9c5fe3e4cbb0e9. However, the groupmems command can easily be emulated using the usermod command.
[YOCTO#16277]
--- meta/classes/useradd_base.bbclass | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/useradd_base.bbclass +4 -3
@@ -56,13 +56,14 @@ perform_groupmems () { bbnote "${PN}: Performing groupmems with [$opts]" local groupname=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-g" || $i == "--group") print $(i+1) }'` local username=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-a" || $i == "--add") print $(i+1) }'` - bbnote "${PN}: Running groupmems command with group $groupname and user $username" + local prefix=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "--prefix") print $(i+1) }'` + bbnote "${PN}: Emulating groupmems command using usermod with group $groupname and user $username" local mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`" if test "x$mem_exists" = "x"; then - eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO groupmems \$opts\" || true + eval flock -x $rootdir${sysconfdir} -c \"$PSEUDO usermod \${prefix:+--prefix \$prefix} --append --groups \$groupname \$username\" || true mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`" if test "x$mem_exists" = "x"; then - bbfatal "${PN}: groupmems command did not succeed." + bbfatal "${PN}: groupmems command (emulated using usermod) did not succeed." fi else bbnote "${PN}: group $groupname already contains $username, not re-adding it"
Re: [OE-core] [PATCH 4/5] useradd_base.bbclass: Emulate the groupmems command using usermod
Quoted 4 lines · Peter Kjellerstedt via lists.openembedded.org
The groupmems command does to support the --prefix option, which is being used since commit
a7b846ba7d6d63a5e59939d75d9c5fe3e4cbb0e9. However, the groupmems command can easily be emulated using the usermod command.
This emulation assumes that the only valid GROUPMEMS_PARAM are of the form '—add [user] —group [group]’ and never used '—delete’, but it looks like the shell script actually mandates that. Might be worth a note that whilst it appears that GROUPMEMS_PARAM supports arbitrary options, it actually doesn’t.
Ross
RE: [OE-core] [PATCH 4/5] useradd_base.bbclass: Emulate the groupmems command using usermod
Quoted 13 lines
-----Original Message-----
From: Ross Burton <[email protected]>
Sent: den 22 maj 2026 16:27
To: Peter Kjellerstedt <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core] [PATCH 4/5] useradd_base.bbclass: Emulate the groupmems command using usermodQuoted 4 lines · Peter Kjellerstedt via lists.openembedded.org
The groupmems command does to support the --prefix option, which is being used since commit
a7b846ba7d6d63a5e59939d75d9c5fe3e4cbb0e9. However, the groupmems command can easily be emulated using the usermod command.
Quoted 7 lines
This emulation assumes that the only valid
GROUPMEMS_PARAMare of the form '—add [user] —group [group]’ and never used '—delete’, but it looks like the shell script actually mandates that. Might be worth a note that whilst it appears thatGROUPMEMS_PARAMsupports arbitrary options, it actually doesn’t.Ross
You are correct. I have sent an updated patch series, where I have updated the function to fail if the user and/or the group are not specified. This would happen before as well, but now it shows an appropriate error message rather than the help output from usermod.
//Peter
PATCH 5/5 useradd.bbclass: Show a deprecation warning if GROUPMEMS_PARAM is used
In reply to Peter KjellerstedtTell the user that they should switch to using USERMOD_PARAM instead of GROUPMEMS_PARAM.
[YOCTO#16277]
--- meta/classes/useradd.bbclass | 9 +++++++++ 1 file changed, 9 insertions(+)
meta/classes/useradd.bbclass +9 -0
@@ -308,6 +308,15 @@ fakeroot python populate_packages:prepend() { update_useradd_package(pkg) } +do_recipe_qa[postfuncs] += "recipe_qa_deprecate_groupmems_param" +python recipe_qa_deprecate_groupmems_param() { + useradd_packages = d.getVar('USERADD_PACKAGES') or "" + for pkg in useradd_packages.split(): + if d.getVar(f"GROUPMEMS_PARAM:{pkg}"): + bb.warn("Use of the GROUPMEMS_PARAM variable is deprecated. Please switch to using USERMOD_PARAM instead") + return +} + # Use the following to extend the useradd with custom functions USERADDEXTENSION ?= ""
Quoted 5 lines · Peter Kjellerstedt via lists.openembedded.org
This is my proposed solution for groupmems' lack of support for the --prefix option
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=16277), and the fact that groupmems will be removed in the next version of shadow.
Quoted 9 lines
The first three commits make a little bit of clean-up to useradd.bbclass and then add the support for
USERMOD_PARAM. These I would like to see backported to Wrynose. While technically it is a new feature, I hope this can be accepted (it should not affect anyone who does not actively start using it). It would make it a lot easier for us and others who are usingGROUPMEMS_PARAMtoday (we have more than 300 recipes that will need to be updated) as it would then be possible to migrate the recipes over some time rather than having to do a flag day rewrite.
I appreciate the patch series, thanks for doing that. I'm much less happy that this is marked as "something we must backport" and then the series starts with a patch mixing whitespace and "simplifications".
Whilst I appreciate it would make it easier for you, you're breaking several different elements of the stable backport policies and hence actually actively make it harder to make case to backport it. It certainly doesn't make it easier for me, quite the opposite.
Cheers,
Richard
Quoted 24 lines
-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: den 12 maj 2026 21:49
To: Peter Kjellerstedt <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH 0/5] Add support forUSERMOD_PARAMin useradd.bbclassQuoted 5 lines · Peter Kjellerstedt via lists.openembedded.org
This is my proposed solution for groupmems' lack of support for the --prefix option
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=16277), and the fact that groupmems will be removed in the next version of shadow.Quoted 9 lines
The first three commits make a little bit of clean-up to useradd.bbclass and then add the support for
USERMOD_PARAM. These I would like to see backported to Wrynose. While technically it is a new feature, I hope this can be accepted (it should not affect anyone who does not actively start using it). It would make it a lot easier for us and others who are usingGROUPMEMS_PARAMtoday (we have more than 300 recipes that will need to be updated) as it would then be possible to migrate the recipes over some time rather than having to do a flag day rewrite.
Quoted 2 lines
I appreciate the patch series, thanks for doing that. I'm much less happy that this is marked as "something we must backport" and then the
I did write "that I would like" and "I hope" so definitely not "must".
Quoted 1 line
series starts with a patch mixing whitespace and "simplifications".
I can split this if that is the only blocker for a backport so that what is needed for the two following commits remain, and the cleanup is left as a separate commit for master. However, ...
Quoted 4 lines
Whilst I appreciate it would make it easier for you, you're breaking several different elements of the stable backport policies and hence actually actively make it harder to make case to backport it. It certainly doesn't make it easier for me, quite the opposite.
I am aware of that this is a new feature, albeit one that should not affect anyone who are not actively trying to solve the problem with groupmems. It would certainly be easier for me if support for USERMOD_PARAM is backported, but we can make do without it as we can backport a version of useradd.bbclass into one of our own layers. Having it in OE-Core is mainly a way to help others who are in the same situation as us.
What I would really appreciate though is to allow support for GROUPMEMS_PARAM (emulated using usermod) to remain on master until closer to feature freeze as otherwise we will have to resort to a flag day update of all our recipes that use GROUPMEMS_PARAM. I promise that I will send a patch that removes support for GROUPMEMS_PARAM in good time before the feature freeze.
The sad part (as I realized while making these changes), is that groupmems (and therefore GROUPMEMS_PARAM) actually has a better API for what OE is doing, and allows for much better validation in perform_groupmems() than in perform_usermod(). And no, I am not arguing for keeping support for GROUPMEMS_PARAM, as that does not make any sense in the long run if upstream is removing the command. I just thought I'd mention it.
Quoted 4 lines
Cheers,
Richard
//Peter
Quoted 40 lines · Peter Kjellerstedt
Quoted 24 lines
-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: den 12 maj 2026 21:49
To: Peter Kjellerstedt <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH 0/5] Add support forUSERMOD_PARAMin useradd.bbclassQuoted 5 lines · Peter Kjellerstedt via lists.openembedded.org
This is my proposed solution for groupmems' lack of support for the --prefix option
(https://bugzilla.yoctoproject.org/show_bug.cgi?id=16277), and the fact that groupmems will be removed in the next version of shadow.Quoted 9 lines
The first three commits make a little bit of clean-up to useradd.bbclass and then add the support for
USERMOD_PARAM. These I would like to see backported to Wrynose. While technically it is a new feature, I hope this can be accepted (it should not affect anyone who does not actively start using it). It would make it a lot easier for us and others who are usingGROUPMEMS_PARAMtoday (we have more than 300 recipes that will need to be updated) as it would then be possible to migrate the recipes over some time rather than having to do a flag day rewrite.Quoted 2 lines
I appreciate the patch series, thanks for doing that. I'm much less happy that this is marked as "something we must backport" and then the
I did write "that I would like" and "I hope" so definitely not "must".
Quoted 1 line
series starts with a patch mixing whitespace and "simplifications".
I can split this if that is the only blocker for a backport so that what is needed for the two following commits remain, and the cleanup is left as a separate commit for master. However, ...
Quoted 4 lines
Whilst I appreciate it would make it easier for you, you're breaking several different elements of the stable backport policies and hence actually actively make it harder to make case to backport it. It certainly doesn't make it easier for me, quite the opposite.
Quoted 7 lines
I am aware of that this is a new feature, albeit one that should not affect anyone who are not actively trying to solve the problem with groupmems. It would certainly be easier for me if support for
USERMOD_PARAMis backported, but we can make do without it as we can backport a version of useradd.bbclass into one of our own layers. Having it in OE-Core is mainly a way to help others who are in the same situation as us.
I'm not seeing anyone else responding on this and I suspect this area of the code isn't used by many, it doesn't appear to be used by many public recipes. You didn't rework or resend the series and I don't think it is backportable in the current form. Convincing the TSC of the need to backport isn't easy and I don't think the bar is met in this case.
As such I could merge the patches as is, but it will make any future backport requests harder.
Quoted 6 lines
What I would really appreciate though is to allow support for
GROUPMEMS_PARAM(emulated using usermod) to remain on master until closer to feature freeze as otherwise we will have to resort to a flag day update of all our recipes that useGROUPMEMS_PARAM. I promise that I will send a patch that removes support forGROUPMEMS_PARAMin good time before the feature freeze.
We can keep it for a short while, probably not as long as feature freeze. If there is a new release of shadow to upgrade to, that will probably mark when we drop the support, if that happens sooner.
Quoted 7 lines
The sad part (as I realized while making these changes), is that groupmems (and therefore
GROUPMEMS_PARAM) actually has a better API for what OE is doing, and allows for much better validation inperform_groupmems()than inperform_usermod(). And no, I am not arguing for keeping support forGROUPMEMS_PARAM, as that does not make any sense in the long run if upstream is removing the command. I just thought I'd mention it.
We're at the mercy of upstream on things like this really...
Cheers,
Richard