Bug 9022

Summary: Replace retry logic in useradd with flocks
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Kai Kang <kai.kang>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: dl9pf, kai.kang, meta.mr.watcher, meta.watcher, randy.macleod
Version: 2.1   
Target Milestone: 2.1   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2016-02-01 16:46:37 UTC
Instead of spinning on useradd, checking that it actually did what we asked it to do, we could just flock $syscconfdir before running the commands.
Comment 1 Randy MacLeod 2016-02-04 16:24:12 UTC
We have a fix in our local branch that doesn't seem to  have been sent to the oe-core email list likely since Kai thought it was a work-around. I'm going to assign this to Kai and ask him to send this patch to the list.

WR branch:
commit dfd6e7a8ec8fe36eb1d96f4127cb5d599ceedacf
Author: Kai Kang <kai.kang@windriver.com>
Date:   Wed Aug 5 10:33:11 2015 +0800

    useradd_base.bbclass: fix simultaneous with flock
    
    Issue: LIN8-643
    
    When perform useradd during populate sysroot, it locks files passwd.lock
    and group.lock at same time. And then it meets a dead lock issue.
    
    Use flock to reslove it by using an universal lock file for all the
    user and group related operations. The lock file is put in image dir
    /tmp. /tmp will be mounted as a tmpfs, so the lock file will not be
    visible when boot the target.
    
    (LOCAL REV: NOT UPSTREAM) -- Workaround
    
    Signed-off-by: Kai Kang <kai.kang@windriver.com>
    Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Comment 2 Ross Burton 2016-02-04 16:37:07 UTC
Oh that's certainly a good start, thanks Randy/Kai.
Comment 3 Ross Burton 2016-04-14 20:01:27 UTC
Fixed in oe-core 2ebf697b46c42cee8bfa6d2e6087397f8cce385c.
Comment 4 Jan-Simon Moeller 2016-07-11 07:56:27 UTC
Can this be backported to jethro ?