Bug 9022 - Replace retry logic in useradd with flocks
Summary: Replace retry logic in useradd with flocks
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.1
Hardware: All Multiple
: Medium enhancement
Target Milestone: 2.1
Assignee: Kai Kang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-02-01 16:46 UTC by Ross Burton
Modified: 2016-07-11 07:56 UTC (History)
5 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 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 ?