Bug 11460 - useradd postinst refers to recipe sysroot
Summary: useradd postinst refers to recipe sysroot
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: High normal
Target Milestone: 2.4 M1
Assignee: Maxin B. John
QA Contact:
URL:
Whiteboard:
: 11489 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-05-04 14:38 UTC by Ross Burton
Modified: 2017-05-15 14:14 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2017-05-04 14:38:42 UTC
useradd.bbclass has this in useradd_preinst:

	export PSEUDO_PASSWD="$SYSROOT:${STAGING_DIR_NATIVE}"

But with recipe-specific-sysroots the STAGING_DIR_NATIVE is in the *recipe* work directory, and may well not exist if the packages were taken from sstate or rm_work is enabled.
Comment 1 Ross Burton 2017-05-04 14:40:06 UTC
Concrete example: dbus pkg_preinst has this line:

export PSEUDO_PASSWD="$SYSROOT:/data/poky-master/tmp/work/corei7-64-poky-linux/dbus/1.10.14-r0/recipe-sysroot-native"
Comment 2 brian avery 2017-05-10 16:01:28 UTC
which is used/called as part of -c populate_sdk_ext :(
Comment 3 brian avery 2017-05-10 20:12:05 UTC
Moving my comments from the duplicate bug I filed before finding this one and closing mine:.
My comments, moved:

The path to pseudo-native/usr/bin/pseudo used by useradd is populated from sstate. This means if the build dir is different from the build dir that was used to generate the sstate, the useradd command will fail. One place this happens is "$bitbake <image> -c populate_sdk_ext" . This tries to do a groupadd for dbus and fails. 

This bug is being opened by me for tracking/discussion, there is a patch already available that seems to fix it in my testing, from Peter Kjellerstedt .  His patch is https://patchwork.openembedded.org/series/6598/ .

His comments on the patch cover letter:
Similar to the problem with the hosttools directory and the state
cache that was recently fixed, there is another problem with the
sysroots-components directory. This only affects postinst-useradd
scripts, so in this case the fix can be activated from useradd.bbclass
rather than sstate.bbclass and thus affects a lot less recipes.

Also, from Jose: 
Bug 11497 created to add a test case for this scenario
Comment 4 brian avery 2017-05-10 20:13:28 UTC
*** Bug 11489 has been marked as a duplicate of this bug. ***