Bug 2779

Summary: groupadd/useradd error: "tried running groupadd command 10 times without success"
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jackie Huang <jackie.huang>
Component: configurationAssignee: Jackie Huang <jackie.huang>
Status: VERIFIED WORKSFORME QA Contact:
Severity: major    
Priority: Medium CC: corneliux.stoicescu, fitzsim, jessica.zhang, konrad.scherer, msm-oss, randy.macleod, song.liu, zhenfeng.zhao
Version: 1.3   
Target Milestone: 1.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Jackie Huang 2012-07-17 09:54:44 UTC
The 10 time retry of groupadd/useradd is added in #1794 to solve the race condition problem, but it seems not solve completely:

+WARNING: groupadd command did not succeed. Retrying...
+groupadd: cannot lock /etc/group; try again later.
+WARNING: groupadd command did not succeed. Retrying...
+groupadd: cannot lock /etc/group; try again later.
+WARNING: groupadd command did not succeed. Retrying...
+groupadd: cannot lock /etc/group; try again later.
+WARNING: groupadd command did not succeed. Retrying...
+ERROR: tried running groupadd command 10 times without success, giving up
+ERROR: Function failed: useradd_sysroot (see /ba1/yow-blade13.1/builds-2012-07-12-004912/e500-kvm-guest_std/bitbake_build/tmp/work/ppce500v2-wrs-linux-gnuspe/dbus-1.4.16-r3.0/temp/do_install/log.do_install.19378 for further information)

DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
DEBUG: Executing shell function useradd_sysroot Running useradd commands...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
useradd: cannot lock /etc/passwd; try again later.
WARNING: useradd command did not succeed. Retrying...
ERROR: tried running useradd command 10 times without success, giving up
ERROR: Function failed: useradd_sysroot (see /ba1/yow-blade13.1/builds-2012-07-15-000637/ti-omap3_std_tc/bitbake_build/tmp/work/armv7a-vfp-neon-wrs-linux-gnueabi/avahi-0.6.31-r2.0/temp/do_install/log.do_install.20993 for further information)


I think we need a better sulotion to avoid tow groupadd/useradd commands running at the same time.
Comment 1 Randy MacLeod 2012-07-20 17:46:54 UTC
This is happening every couple of days in our test builds. It's clearly not a good idea to just spin a number of times, and then fail. A longer timeout might make the problem go away for a while but I think that Jackie is going to implement a blocking lock.

I bumped the priority in hopes that this defect, the intended solution and it's review get somewhat faster attention.
Comment 2 Jackie Huang 2012-09-13 03:00:27 UTC
We changed the locking for the native groupadd and useradd tools to block indefinitely rather than arbitrarily increasing the retry count or extending the timeout, and added debug messages with the patch from debian:
http://lists.alioth.debian.org/pipermail/pkg-shadow-commits/2011-July/003444.html
so that we may be able to find out the root cause, but the failure didn't happen again since then. So I think we need more info for this.
Comment 3 Matthew McClintock 2012-10-02 19:43:21 UTC
Hack work around patch:

http://gate.crashing.org/~fray/shadow-native-block-groupadd-and-useradd.patch
Comment 4 Matthew McClintock 2012-10-02 19:48:01 UTC
So I am seeing this on:

[mattsm@busy ~]$ cat /etc/issue
CentOS release 5.8 (Final)
Kernel \r on an \m

[mattsm@busy ~]$ uname -a
Linux busy.am.freescale.net 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:22:04 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

When the machine is heavily bogged down.

What type of distros/kernels are you guys seeing it on?

-M
Comment 5 Konrad Scherer 2012-10-23 18:28:14 UTC
All of our coverage builders have the same configuration:

CentOS 5.8 x86_64
Linux yow-blade1 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:43 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

Hardware: 8-12 cores and 32 to 96GB of ram, large local disk.

Each coverage builder is running 2 builds in parallel with 20 parallel packages and 20 jobs, so the machines are often heavily loaded.

Let me know if you need any more details.
Comment 6 Matthew McClintock 2012-10-23 18:43:39 UTC
(In reply to comment #5)
> All of our coverage builders have the same configuration:
> 
> CentOS 5.8 x86_64
> Linux yow-blade1 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:43 EDT 2012
> x86_64 x86_64 x86_64 GNU/Linux
> 
> Hardware: 8-12 cores and 32 to 96GB of ram, large local disk.
> 
> Each coverage builder is running 2 builds in parallel with 20 parallel
> packages and 20 jobs, so the machines are often heavily loaded.
> 
> Let me know if you need any more details.

Very similar to our setup... I don't really have other ideas though

-M
Comment 7 Randy MacLeod 2012-10-23 20:58:57 UTC
At the time that these failures were causing problems, I thought we were using a central disk array that was shared between 4-6 builders. The guess was that we had either an iSCSI protocol timeout of some lower level occasional hardware timeout but we were never able to prove it. We had to power cycle the systems
and the problem didn't occur again in the first few days. Due to work schedules, we applied the patch so that if the hang-up occurred, we'd get some log data and the hang wouldn't break a build. So as of a couple of months ago we did see some logs indicating log delays but since the build doesn't break we have mostly ignored the problem.

I see that you have the patch but it's not clear if you need the other bits:
git show d985472e0fc5f04bac49159f697e43bb349648e4 | diffstat
 classes/useradd.bbclass                                                                   |  182 ++++++++
 recipes-extended/shadow/shadow-native_4.1.4.3.bbappend                                    |    7 
 recipes-extended/shadow/shadow/add-additional-messages-to-indicate-why-locking-fail.patch |  217 ++++++++++
 recipes-extended/shadow/shadow/shadow-native-block-groupadd-and-useradd.patch             |  196 +++++++++
 4 files changed, 602 insertions(+)

If one really wanted to understand this problem then the thing to do is to run on a kernel that has a "flight recorder" and capture the recent events when the timeout occurs.
Comment 8 Matthew McClintock 2012-10-23 21:16:32 UTC
(In reply to comment #7)
> At the time that these failures were causing problems, I thought we were
> using a central disk array that was shared between 4-6 builders. The guess
> was that we had either an iSCSI protocol timeout of some lower level
> occasional hardware timeout but we were never able to prove it. We had to
> power cycle the systems
> and the problem didn't occur again in the first few days. Due to work
> schedules, we applied the patch so that if the hang-up occurred, we'd get
> some log data and the hang wouldn't break a build. So as of a couple of
> months ago we did see some logs indicating log delays but since the build
> doesn't break we have mostly ignored the problem.
> 
> I see that you have the patch but it's not clear if you need the other bits:
> git show d985472e0fc5f04bac49159f697e43bb349648e4 | diffstat
>  classes/useradd.bbclass                                                    
> |  182 ++++++++
>  recipes-extended/shadow/shadow-native_4.1.4.3.bbappend                     
> |    7 
>  recipes-extended/shadow/shadow/add-additional-messages-to-indicate-why-
> locking-fail.patch |  217 ++++++++++
>  recipes-extended/shadow/shadow/shadow-native-block-groupadd-and-useradd.
> patch             |  196 +++++++++
>  4 files changed, 602 insertions(+)
> 
> If one really wanted to understand this problem then the thing to do is to
> run on a kernel that has a "flight recorder" and capture the recent events
> when the timeout occurs.

That alone might prevent the error from occurring.

We are using a local RAID 5 array, so it's less likely to be a iSCSI issue.

-M
Comment 9 Jackie Huang 2012-11-01 07:47:27 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > At the time that these failures were causing problems, I thought we were
> > using a central disk array that was shared between 4-6 builders. The guess
> > was that we had either an iSCSI protocol timeout of some lower level
> > occasional hardware timeout but we were never able to prove it. We had to
> > power cycle the systems
> > and the problem didn't occur again in the first few days. Due to work
> > schedules, we applied the patch so that if the hang-up occurred, we'd get
> > some log data and the hang wouldn't break a build. So as of a couple of
> > months ago we did see some logs indicating log delays but since the build
> > doesn't break we have mostly ignored the problem.

The build doesn't break anymore with the patch, and looks like it never happen in yocto's testing, I think it would be fine to close it. I will reopen it if it comes out to a problem again.

> > 
> > I see that you have the patch but it's not clear if you need the other bits:
> > git show d985472e0fc5f04bac49159f697e43bb349648e4 | diffstat
> >  classes/useradd.bbclass                                                    
> > |  182 ++++++++
> >  recipes-extended/shadow/shadow-native_4.1.4.3.bbappend                     
> > |    7 
> >  recipes-extended/shadow/shadow/add-additional-messages-to-indicate-why-
> > locking-fail.patch |  217 ++++++++++
> >  recipes-extended/shadow/shadow/shadow-native-block-groupadd-and-useradd.
> > patch             |  196 +++++++++
> >  4 files changed, 602 insertions(+)
> > 
> > If one really wanted to understand this problem then the thing to do is to
> > run on a kernel that has a "flight recorder" and capture the recent events
> > when the timeout occurs.
> 
> That alone might prevent the error from occurring.
> 
> We are using a local RAID 5 array, so it's less likely to be a iSCSI issue.
> 
> -M
Comment 10 Matthew McClintock 2012-11-01 15:23:28 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > At the time that these failures were causing problems, I thought we were
> > > using a central disk array that was shared between 4-6 builders. The guess
> > > was that we had either an iSCSI protocol timeout of some lower level
> > > occasional hardware timeout but we were never able to prove it. We had to
> > > power cycle the systems
> > > and the problem didn't occur again in the first few days. Due to work
> > > schedules, we applied the patch so that if the hang-up occurred, we'd get
> > > some log data and the hang wouldn't break a build. So as of a couple of
> > > months ago we did see some logs indicating log delays but since the build
> > > doesn't break we have mostly ignored the problem.
> 
> The build doesn't break anymore with the patch, and looks like it never
> happen in yocto's testing, I think it would be fine to close it. I will
> reopen it if it comes out to a problem again.

But the patch is not in oe-core? I'm fine with closing it but it's not really fixed ;)

-M
Comment 11 Stoicescu Cornel 2012-11-06 15:11:31 UTC
Verified as per the last 2 comments. It is hard to replicate your RAID 5 and 12 core system scenario at the moment. If it is needed, we will investigate this in the future.
Comment 12 Thomas Fitzsimmons 2013-02-28 21:43:25 UTC
I'm seeing the same failure:

ERROR: tried running groupadd command 10 times without success, giving up
ERROR: Function failed: useradd_sysroot

on a 12 core RHEL-5.5 x86-64 machine, building on local disk, running a single bitbake invocation with:

BB_NUMBER_THREADS ?= "12"
PARALLEL_MAKE ?= "-j 12"

It doesn't look like the patch from comment #3 was committed upstream.  Should I just carry it locally, or can it be committed?
Comment 13 Matthew McClintock 2013-02-28 22:20:41 UTC
(In reply to comment #12)
> I'm seeing the same failure:
> 
> ERROR: tried running groupadd command 10 times without success, giving up
> ERROR: Function failed: useradd_sysroot
> 
> on a 12 core RHEL-5.5 x86-64 machine, building on local disk, running a
> single bitbake invocation with:
> 
> BB_NUMBER_THREADS ?= "12"
> PARALLEL_MAKE ?= "-j 12"
> 
> It doesn't look like the patch from comment #3 was committed upstream. 
> Should I just carry it locally, or can it be committed?

master branch?

-M
Comment 14 Thomas Fitzsimmons 2013-02-28 23:13:07 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > I'm seeing the same failure:
> > 
> > ERROR: tried running groupadd command 10 times without success, giving up
> > ERROR: Function failed: useradd_sysroot
> > 
> > on a 12 core RHEL-5.5 x86-64 machine, building on local disk, running a
> > single bitbake invocation with:
> > 
> > BB_NUMBER_THREADS ?= "12"
> > PARALLEL_MAKE ?= "-j 12"
> > 
> > It doesn't look like the patch from comment #3 was committed upstream. 
> > Should I just carry it locally, or can it be committed?
> 
> master branch?

I'm seeing the error on the denzil branch of git://git.yoctoproject.org/poky (tag: denzil-7.0.1).

I checked:

git://git.yoctoproject.org/poky
master branch
meta/recipes-extended/shadow

and

git://git.openembedded.org/openembedded-core
master branch
meta/recipes-extended/shadow

and I can't see the shadow-native-block-groupadd-and-useradd.patch changes in either place.
Comment 15 Matthew McClintock 2013-02-28 23:21:59 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #12)
> > > I'm seeing the same failure:
> > > 
> > > ERROR: tried running groupadd command 10 times without success, giving up
> > > ERROR: Function failed: useradd_sysroot
> > > 
> > > on a 12 core RHEL-5.5 x86-64 machine, building on local disk, running a
> > > single bitbake invocation with:
> > > 
> > > BB_NUMBER_THREADS ?= "12"
> > > PARALLEL_MAKE ?= "-j 12"
> > > 
> > > It doesn't look like the patch from comment #3 was committed upstream. 
> > > Should I just carry it locally, or can it be committed?
> > 
> > master branch?
> 
> I'm seeing the error on the denzil branch of git://git.yoctoproject.org/poky
> (tag: denzil-7.0.1).
> 
> I checked:
> 
> git://git.yoctoproject.org/poky
> master branch
> meta/recipes-extended/shadow
> 
> and
> 
> git://git.openembedded.org/openembedded-core
> master branch
> meta/recipes-extended/shadow
> 
> and I can't see the shadow-native-block-groupadd-and-useradd.patch changes
> in either place.

That's where I've seen it too, denzil is quite old by now so I don't expect new fixes.

You can workaround by re-running the bitbake command. Let us know if you see it in newer versions.

-M
Comment 16 Thomas Fitzsimmons 2013-02-28 23:34:24 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #13)
> > > (In reply to comment #12)
> > > > I'm seeing the same failure:
> > > > 
> > > > ERROR: tried running groupadd command 10 times without success, giving up
> > > > ERROR: Function failed: useradd_sysroot
> > > > 
> > > > on a 12 core RHEL-5.5 x86-64 machine, building on local disk, running a
> > > > single bitbake invocation with:
> > > > 
> > > > BB_NUMBER_THREADS ?= "12"
> > > > PARALLEL_MAKE ?= "-j 12"
> > > > 
> > > > It doesn't look like the patch from comment #3 was committed upstream. 
> > > > Should I just carry it locally, or can it be committed?
> > > 
> > > master branch?
> > 
> > I'm seeing the error on the denzil branch of git://git.yoctoproject.org/poky
> > (tag: denzil-7.0.1).
> > 
> > I checked:
> > 
> > git://git.yoctoproject.org/poky
> > master branch
> > meta/recipes-extended/shadow
> > 
> > and
> > 
> > git://git.openembedded.org/openembedded-core
> > master branch
> > meta/recipes-extended/shadow
> > 
> > and I can't see the shadow-native-block-groupadd-and-useradd.patch changes
> > in either place.
> 
> That's where I've seen it too, denzil is quite old by now so I don't expect
> new fixes.
> 
> You can workaround by re-running the bitbake command. Let us know if you see
> it in newer versions.

OK, so unpatched master doesn't seem to be affected by this bug, thanks.  I couldn't tell from the closure comment whether master + shadow-native-block-groupadd-and-useradd.patch didn't show the issue, or unpatched master didn't show the issue.  I guess it must have been fixed by some other change.

I'm trying to avoid manually re-running bitbake since our build is happening unattended.  I'll apply the workaround patch while I'm still on denzil, remove it when I update to something newer, then keep an eye out for this failure in the future.  Thanks for the clarification.