[OE-core] [PATCH] base-passwd/useradd: Various improvements to useradd with RSS

Peter Kjellerstedt peter.kjellerstedt at axis.com
Fri Apr 14 02:39:37 UTC 2017


> -----Original Message-----
> From: openembedded-core-bounces at lists.openembedded.org
> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of
> Richard Purdie
> Sent: den 12 april 2017 20:34
> To: openembedded-core at lists.openembedded.org
> Subject: [OE-core] [PATCH] base-passwd/useradd: Various improvements to
> useradd with RSS
> 
> Currently there are multiple issues with useradd:
> 
> * If base-passwd rebuilds, it wipes out recipe specific user/group additions
>   to sysroots and causes errors
> * If recipe A adds a user and recipe B depends on A, it can't see any of the
>   users/groups A adds.
> 
> This patch changes base-passwd so it always works as a postinst script
> within the sysroot and copies in the master files, then runs any
> postinst-useradd-* scripts afterwards to add additional user/groups.
> 
> The postinst-useradd-* scripts are tweaked so that if /etc/passwd doesn't exist
> they just exit, knowning they'll be executed later.
> 
> There is a problem where if recipe A adds a user an recipe B depends on A but
> doesn't care about users, it may not have a dependency on the useradd/groupadd
> tools which would therefore not be available in B's sysroot. We therefore also
> tweak postinst-useradd-* scripts so that if the tools aren't present we simply
> don't add users. If you need the users, you add a dependency on the tools in the
> recipe and they'll be added.
> 
> We add postinst-* to SSTATE_SCAN_FILES since almost any postinst script of this
> kind is going to need relocation help.
> 
> We also ensure that the postinst-useradd script is written into the sstate
> object as the current script was only being added in a recipe local way.
> 
> Thanks to Peter Kjellerstedt <pkj at axis.com> for some pieces of this
> patch.
> 
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

I have tested this now, and it seems to be doing what is expected. 

However, during my testing I stumbled upon a bug in pseudo which caused 
bash to segmentation fault. It was triggered by how the postinst-useradd 
scripts are called from the postinst-base-passwd script. Seebs and I 
debugged this and eventually found a solution which is now available as 
commit b6b68db896 in git://git.yoctoproject.org/pseudo. This must be 
fixed in OE-Core, either as a backport patch or by using an updated 
version of pseudo. 

I also made some improvements to the debuggability of the postinst 
scripts. I will send that as a separate patch set.

//Peter




More information about the Openembedded-core mailing list