Bug 8078 - useradd.bbclass: useradd_preinst not run when rebuilding on second MACHINE
Summary: useradd.bbclass: useradd_preinst not run when rebuilding on second MACHINE
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.8
Hardware: All Multiple
: Medium+ major
Target Milestone: 2.3 M4
Assignee: Maxin B. John
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-07-29 20:13 UTC by Richard Tollerton
Modified: 2017-04-13 14:16 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments
proposed fix (1.58 KB, patch)
2016-10-20 15:08 UTC, Maxin B. John
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Tollerton 2015-07-29 20:13:15 UTC
I suppose this qualifies as a regression of [YOCTO #4739].

To reproduce:

1) Start with a clean unmodified oe-core, no layers (I used master but this reproduces on fido)
2) Create meta/recipes-core/useraddtest-a.bb:

SUMMARY = "useradd test A"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                    file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

ALLOW_EMPTY_${PN} = "1"
inherit allarch useradd
USERADD_PACKAGES = "${PN}"

GROUPADD_PARAM_${PN} = " --system foo"
USERADD_PARAM_${PN} = "-N -g foo foo"



3) Create meta/recipes-core/useraddtest-b_1.0.bb:

DEPENDS += "useraddtest-a"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                    file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

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

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


4) Build useraddtest-b for qemux86: `bitbake useraddtest-b`
5) Build useraddtest-b for qemuarm: `MACHINE=qemuarm bitbake useraddtest-b`

The qemuarm build fails when building useraddtest-b with:

| DEBUG: Executing shell function do_install
| chown: invalid user: 'foo:foo'
Comment 1 Maxin B. John 2015-10-01 09:05:35 UTC
Recreated the failure on master branch (commit: 979de7703cf3e468aa2923da1445138e1c93d234 ) 

for qemux86:
$ bitbake useraddtest-b

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: QA Issue: useraddtest-b: /useraddtest-b/usr/share/foo is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]
NOTE: Tasks Summary: Attempted 732 tasks of which 709 didn't need to be rerun and all succeeded.

for qemuarm:
$ MACHINE=qemuarm bitbake useraddtest-b

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Function failed: do_install (log file is located at /home/maxin/poky/build/tmp/work/armv5e-poky-linux-gnueabi/useraddtest-b/1.0-r0/temp/log.do_install.16684)
ERROR: Logfile of failure stored in: /home/maxin/poky/build/tmp/work/armv5e-poky-linux-gnueabi/useraddtest-b/1.0-r0/temp/log.do_install.16684
Log data follows:
| DEBUG: Executing shell function do_install
| chown: invalid user: 'foo:foo
Comment 2 Maxin B. John 2016-04-07 15:10:18 UTC
One ugly work-around is to add this line in useradd.bbclass:

do_install[nostamp] = "1"

Other obvious way will be not to use the users/groups created by useradd inheriting packages in other packages.
Comment 3 Maxin B. John 2016-04-12 10:53:32 UTC
As RP mentioned here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=7724#c16

Reverting the commit 0aed04a49ec13c3331169ca4fd2c820b03faf19c help in resolving this bug:
commit 0aed04a49ec13c3331169ca4fd2c820b03faf19c
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Tue Sep 23 20:01:28 2014 +0100

    layer.conf: Add in useradd dependencies as ABISAFE dependencies
    
    Currently allarch recipes using useradd rebuild each time MACHINE
    changes which is not desireable. Adding the useradd dependencies
    to this list ensures they do not change under these circumstances.
    
    (From OE-Core rev: 7743a309017f0fb9286f00b1f6f546ee95c05303)
    
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 4 Maxin B. John 2016-04-15 12:12:18 UTC
This bug is quite similar to the issue already reported in #7724: 
https://bugzilla.yoctoproject.org/show_bug.cgi?id=7724

Late for 2.1. Moving to 2.2
Comment 5 Maxin B. John 2016-06-28 09:09:24 UTC
Moving to M2
Comment 6 Maxin B. John 2016-10-11 12:07:10 UTC
As per the comment, tried to save copies of the original master/group entries. However, it is really difficult to keep track when we clean the "base-passwd" package.

Couldn't resolve it on time. Moving to 2.3
Comment 7 Maxin B. John 2016-10-20 15:08:33 UTC
Created attachment 3484 [details]
proposed fix

update sstate_rundepfilter in sstatesig.py by providing a special case for useradd packages
Comment 8 Maxin B. John 2016-12-12 13:53:49 UTC
patch sent to oe-core mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2016-December/130047.html
Comment 9 Richard Purdie 2017-01-23 15:57:29 UTC
I'd suggest this is retested now recipe specific sysroots has merged as I'm hoping this solves the problem.
Comment 10 Maxin B. John 2017-01-24 14:54:34 UTC
(In reply to comment #9)
> I'd suggest this is retested now recipe specific sysroots has merged as I'm
> hoping this solves the problem.

Tested with both latest "master" and "rpurdie/wip-rss". Still the error seems to be there (reproducible in the first build itself - no need for second build which depends on sstate)

Have also updated the "useraddtest-b.bb" from 
DEPENDS += "useraddtest-a"
to
RDEPENDS_${PN} += "useraddtest-a"

This doesn't seems to have an effect on the build failure.

# bitbake useraddtest-b
...
| chown: invalid user: ‘foo:foo’
| WARNING: /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/useraddtest-b/1.0-r0/temp/run.do_install.22893:1 exit 1 from 'chown foo:foo /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/useraddtest-b/1.0-r0/image/usr/share/foo'
| ERROR: Function failed: do_install (log file is located at /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/useraddtest-b/1.0-r0/temp/log.do_install.22893)
ERROR: Task (/home/maxin/clone/poky/meta/recipes-core/useraddtest/useraddtest-b.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 634 tasks of which 0 didn't need to be rerun and 1 failed.
Comment 11 Leonardo Sandoval Gonzalez 2017-04-12 19:12:38 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > I'd suggest this is retested now recipe specific sysroots has merged as I'm
> > hoping this solves the problem.
> 
> Tested with both latest "master" and "rpurdie/wip-rss". Still the error
> seems to be there (reproducible in the first build itself - no need for
> second build which depends on sstate)

Can you test the scenario with https://patchwork.openembedded.org/series/6324/ ?

> 
> Have also updated the "useraddtest-b.bb" from 
> DEPENDS += "useraddtest-a"
> to
> RDEPENDS_${PN} += "useraddtest-a"
> 
> This doesn't seems to have an effect on the build failure.
> 
> # bitbake useraddtest-b
> ...
> | chown: invalid user: ‘foo:foo’
> | WARNING:
> /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/
> useraddtest-b/1.0-r0/temp/run.do_install.22893:1 exit 1 from 'chown foo:foo
> /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/
> useraddtest-b/1.0-r0/image/usr/share/foo'
> | ERROR: Function failed: do_install (log file is located at
> /home/maxin/clone/poky/build/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/
> useraddtest-b/1.0-r0/temp/log.do_install.22893)
> ERROR: Task
> (/home/maxin/clone/poky/meta/recipes-core/useraddtest/useraddtest-b.bb:
> do_install) failed with exit code '1'
> NOTE: Tasks Summary: Attempted 634 tasks of which 0 didn't need to be rerun
> and 1 failed.
Comment 12 Maxin B. John 2017-04-13 14:02:02 UTC
> Can you test the scenario with
> https://patchwork.openembedded.org/series/6324/ ?
> 
Applying this patch and adding DEPENDS += "shadow-native" to useraddtest-b.bb (as per RP's suggestion) fixes this error.