Bug 11124 - Problem with RSS and functions that modifies files installed into RSS by other recipes
Summary: Problem with RSS and functions that modifies files installed into RSS by othe...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: Medium+ critical
Target Milestone: 2.3 M4
Assignee: Maxin B. John
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-03-03 23:51 UTC by Peter Kjellerstedt
Modified: 2017-04-14 22:31 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 Peter Kjellerstedt 2017-03-03 23:51:41 UTC
After having used the new recipe specific sysroots (RSS) for a while a serious problem occurred for me today. Suddenly recipes started to fail to build all over the place complaining about non-existing users/groups. After some debugging it seems that what is happening is that something has caused base-passwd to be invalidated. This leads to a message like this appearing in the log.do_install file for the failing recipes:

NOTE: base-passwd exists in sysroot, but is stale (base-passwd.5c851c4442756f2ec9415e966858e933 vs. base-passwd.68b489dd6c4657f8ec785e48cdb5bd78), removing.
DEBUG: Removing manifest: /home/pkj/dists/cvp-master/builds/q3505/tmp/work/all-poky-linux/useraddtest/1.0-r0/recipe-sysroot/etc/passwd
DEBUG: Removing manifest: /home/pkj/dists/cvp-master/builds/q3505/tmp/work/all-poky-linux/useraddtest/1.0-r0/recipe-sysroot/etc/group
...

And then I guess the base-passwd files are reinstalled in the sysroot (but there are no log messages about this?). However, since the entire sysroot is not recreated (i.e., do_prepare_recipe_sysroot is not run), the useradd/groupadd commands are not rerun and the user/group that the recipe had previously created in the sysroot are gone and thus do_install() fails when it tries to use them.

To reproduce:

1) Create the following recipe as meta/recipes-core/useraddtest/useraddtest_1.0.bb:

LICENSE = "CLOSED"

inherit allarch useradd

do_install () {
	mkdir -p ${D}${datadir}
	echo test > ${D}${datadir}/test
	chown test:test ${D}${datadir}/test
}

USERADD_PACKAGES = "${PN}"

GROUPADD_PARAM_${PN} = "--system test"
USERADD_PARAM_${PN} = "--system --gid test test"

FILES_${PN} = "${datadir}/test"

2) bitbake useraddtest

3) Make any trivial changes to the base-passwd and useraddtest recipes to cause them to rebuild.

4) bitbake useraddtest

The build fails with:

| DEBUG: Executing shell function do_install
| chown: invalid user: `test:test'

My take on this is that if anything requires anything in the RSS to be updated, then the entire RSS needs to be rebuilt. It is not enough to only remove the files of the stale package and reinstall it, as some function of some other recipe may have modified them (i.e., what happens with the passwd/group files installed by base-passwd but modified by any recipe using the useradd bbclass). Currently it seems that useradd.bbclass is the only one doing something like this (at least in OE-Core), but since any recipe can hook into the same functions the problem is not limited to that.
Comment 1 Maxin B. John 2017-04-11 14:54:22 UTC
Sorry for the delay in updating this bug. The scenario looks like the one described in this bug (reported earlier)

https://bugzilla.yoctoproject.org/show_bug.cgi?id=7724
Comment 2 Peter Kjellerstedt 2017-04-11 16:15:43 UTC
They are similar, but not identical. However, it may be that solving the issue described in this ticket may also solve the other. 

I got some tips from RP and hope I can work on this to get a solution in time for 2.3, because it is a serious problem for us since we have a lot of recipes that create users/groups and if anything invalidates base-passwd without invalidating everything else, you basically have to remove tmp to get back to a working build environment. :(
Comment 3 Leonardo Sandoval Gonzalez 2017-04-12 19:15:01 UTC
There is a new series (sent by RP) that hopefully fix this problem:

https://patchwork.openembedded.org/series/6324/