[Pkg-shadow-devel] useradd fails (cannot lock /etc/passwd)

Nicolas François nicolas.francois at centraliens.net
Thu Nov 12 12:49:32 UTC 2009


Hello,

On Thu, Nov 12, 2009 at 12:29:12PM +0100, 9jd5b2 at gmail.com wrote:
> 
> I have a problem using useradd from shadow-4.1.4.2.
> 
> After having issued "useradd john" I get the following error message:
> useradd: cannot lock /etc/passwd; try again later
> 
> "ls -l /etc/passwd" returns:
> -rw-r--r-- 1 root root 32 Nov 10 19:06 /etc/passwd
> 
> "cat /etc/passwd" returns:
> root:x:0:0:root:/root:/bin/bash

> [ strace extract ]

That must be when useradd tries to lock the /etc/passwd file with
(the standard API) lckpwdf().

> open("/etc/.pwd.lock", O_WRONLY|O_CREAT|O_CLOEXEC, 0600) = 3

The file could be created.

> rt_sigaction(SIGALRM, {0x7f9723414f60, ~[], SA_RESTORER,
> 0x7f9723377db0}, {SIG_DFL, [], 0}, 8) = 0
> rt_sigprocmask(SIG_UNBLOCK, [ALRM], [], 8) = 0
> alarm(15)                               = 0

An alarm is set to avoid failing to lock for too much time.

> fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) =
> -1 EACCES (Permission denied)

This is not normal, and I have no idea why this fails.
Since you mentioned that the box might not be configured properly, I
would be tempted to look in this direction.


Best Regards,
-- 
Nekral



More information about the Pkg-shadow-devel mailing list