With several commands in Linux, I get the error:
cannot lock /etc/passwd; try again later.
Does anybody know how to solve it? Also I don't get in my /etc/shadow directory.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
If you have
-R /some/chroot added to your
useradd command, that might be the problem.
I thought it meant that the user would be jailed upon login, but that's not the case. By looking at strace output, I saw useradd chrooted into the specified directory, after which of course it cannot find /etc/passwd anymore. So I'm not sure what the option is for, but there's your (well, my) problem.
Look for /etc/group.lock, /etc/passwd.lock and /etc/shadow.lock files and remove them.
Be careful to only remove the files ending in 'lock' or else you might damage your system.