@@ -37,6 +37,17 @@ if test "x$D" != "x"; then
cp $D${sysconfdir}/login.defs.dpkg-new $D${sysconfdir}/login.defs
fi
+ # opkg/dpkg run preinsts before shadow's postinst has run pwconv/grpconv
+ if test "x$UA_SYSROOT" = "x" -a -e $D${sysconfdir}/login.defs; then
+ # image rootfs only; on deb, packages unpacked before shadow keep the old behaviour
+ if [ ! -e $D${sysconfdir}/shadow ]; then
+ pwconv --root $D || exit 1
+ fi
+ if [ ! -e $D${sysconfdir}/gshadow ]; then
+ grpconv --root $D || exit 1
+ fi
+ fi
+
# user/group lookups should match useradd/groupadd --prefix
export PSEUDO_PASSWD="$SYSROOT"
fi
There was a difference in the user/group setting for different package backends. The reason behind is the timing when shadow files are created that is different for rpm and ipk/deb. opkg and dpkg run all preinsts before any postinst, so useradd/groupadd run before shadow's pkg_postinst has created /etc/shadow and /etc/gshadow with pwconv/grpconv. The later pwconv then gives --system users password aging from login.defs, and grpconv copies the "x" that groupadd puts in /etc/group into /etc/gshadow. With rpm, shadow's postinst runs first, so the same accounts get no aging and "!", as useradd/groupadd intend. Solution is to run pwconv/grpconv in the preinst when the files are missing so all backends give the same result. Wait until login.defs is unpacked, as apt only orders unpacking by Pre-Depends, so base-passwd users still get their aging defaults. This also makes useradd/usermod -e/-f work on ipk/deb, as they require shadow files. Recipe sysroots (UA_SYSROOT) are left as they are. [YOCTO #14139] AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Peter Bergin <peter@berginkonsult.se> --- meta/classes/useradd.bbclass | 11 +++++++++++ 1 file changed, 11 insertions(+)