Bug 13279 - Make sure users/groups exist for package_write_* tasks
Summary: Make sure users/groups exist for package_write_* tasks
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: 2.7
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 5.0 M1
Assignee: Eilís Ní Fhlannagáin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-04-12 18:03 UTC by Peter Kjellerstedt
Modified: 2023-12-11 21:13 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
Make sure users/groups exist for package_write_* tasks (2.98 KB, patch)
2019-04-12 18:03 UTC, Peter Kjellerstedt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Kjellerstedt 2019-04-12 18:03:58 UTC
Created attachment 4472 [details]
Make sure users/groups exist for package_write_* tasks

If the populate_lic task and any of the package_write_* tasks need to run, but the package task can be restored from the sstate cache, then the fetch task, which is a dependency of populate_lic, will wipe out the RSS including any users/groups that have been created. This results in that the package_write_* tasks are run without any user/group information, which causes them to fallback to either use the root user for any unknown users/groups (rpm) or to use the numeric UIDs/GIDs (deb/ipk). Neither solution will yield correct packages.

To resolve this problem, I devised a patch that adds handling of the package_write_* tasks to useradd.bbclass and submitted it to the openembedded-core mailing list (also attached to this bug report). However, Richard was not convinced this is the proper solution, and commented:

> This may be a bigger problem than just package_write_*.
> 
> This feels like a bad thing to do since there may be other tasks which also rely on the user information being present. This probably only fixes one corner case but there are likey others :(.
> 
> Possible solutions might be:
> 
> a) To wipe out all sstate tasks if we're rerunning do_fetch
> b) Preserve the user/group information around the cleaning of the sysroot
> 
> I think we may need to fix this generically...

I don't think preserving user/group information when cleaning the sysroot is the right thing to do, so I am now looking for pointers/ideas on how to wipe out all sstate tasks when do_fetch is rerun.
Comment 1 Richard Purdie 2019-05-31 13:11:41 UTC
You asked for a hint about ways to solve this problem. It took me a bit of digging but I remembered/found:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=3d3194a68fceba3fcc6b072ae9956870a8b5c4fd

which attempted to solve an older but similar problem.

That code basically forces some sstate to be skipped if certain other tasks will rerun. Whilst the need for that case was removed with RSS, the same mechanism may work here.
Comment 2 Richard Purdie 2019-05-31 13:19:55 UTC
Option 2 may be to change:

python clean_recipe_sysroot() {
    # We remove these stamps since we're removing any content they'd have added with
    # cleandirs. This removes the sigdata too, likely not a big deal,
    oe.path.remove(d.getVar("STAMP") + "*addto_recipe_sysroot*")
    return
}

to include wiping out any setscene stamps.
Comment 3 Randy MacLeod 2019-08-15 15:23:39 UTC
Robert or Peter, could one of you work on this defect for M3 or even M4?
Comment 4 Randy MacLeod 2023-07-26 21:21:58 UTC
Bulk move of 64 bugs to 4.3 M3 after a quick review.
If a bug is actually fixed, please add a commit link and resolve it.
-- Randy for YP bug team.
Comment 5 Trevor Gamblin 2023-09-14 15:56:16 UTC
Moved to M4.
Comment 6 Randy MacLeod 2023-10-30 15:29:15 UTC
Bulk move to 5.0 M1. -- Randy
Comment 7 Peter Kjellerstedt 2023-12-11 19:29:09 UTC
Richard asked me for a selftest for this issue, or instructions for a way to reproduce it. When I failed to reproduce it I went back in time to find the reason and I had to go all the way back to Zeus. There, in commit 27ce69861edb7e52078b59ebf8fefc9201e9a228, Richard removed the clean_recipe_sysroot() function mentioned above, and with it the cause of the recipe sysroot being wiped out in case the fetch task happens to be triggered. So it appears this issue was resolved more than four years ago.
Comment 8 Richard Purdie 2023-12-11 21:13:08 UTC
Thanks Peter, that is extremely helpful and much appreciated!

https://git.openembedded.org/openembedded-core/commit/?id=27ce69861edb7e52078b59ebf8fefc9201e9a228

is the link to the commit which fixed this.