Useradd: Cannot Lock /etc/passwd; Try Again Later
ix Answers 9
If no .lock files are present merely you still cannot create a user try the following
sudo mount -o remount,rw / If logged in equally root and so utilise
mountain -o remount,rw /
Jawa
3,549 xiii gilt badges 30 silver badges 36 bronze badges
answered Oct 3, 2014 at seven:22
4
The user you are running the commands as lack the required privileges. Alter to root user by issuing the command
su - or if y'all have/use sudo
sudo <command to run> answered Jun thirteen, 2011 at seven:18
inquaminquam
293 1 argent bluecoat 8 statuary badges
If you have -R /some/chroot added to your useradd control, that might be the problem.
I thought it meant that the user would be jailed upon login, but that's not the case. Past looking at strace output, I saw useradd chrooted into the specified directory, later which of course information technology cannot notice /etc/passwd anymore. So I'1000 not sure what the option is for, but there's your (well, my) problem.
answered Jun 17, 2017 at twenty:17
LucLuc
ii,323 2 gold badges 23 silver badges 33 bronze badges
two
-
This was exactly what I was trying. Later removing the
-R [dir]choice I was able to create the user.October 11, 2018 at 18:55
-
Dainty guess! Thank you. I also understood that the chroot for
useraddis not what yous recall it is :) It but uses the specified dir as a root for the user'southward system. It'due south useful for cloned isolated sub-Os, which is rarely what you want...Sep 7, 2019 at thirteen:45
That's because you don't accept permissions for those operations
- You can't read
/etc/shadow - You can't directly modify
/etc/passwd
You tin can alter both files through specialized commands (east.one thousand y'all can change your countersign).
answered Jun 13, 2011 at vii:16
1
-
to change countersign, utilize " passwd <username> "
Jun 13, 2011 at 7:21
I ran into this when a disk fault occurred during a userdel operation and the organization had to be rebooted. I needed to delete all four of the post-obit files to go along:
sudo rm /etc/passwd.lock sudo rm /etc/shadow.lock sudo rm /etc/group.lock sudo rm /etc/gshadow.lock answered Aug two, 2012 at 21:20
This can also be acquired by running out of space on the root filesystem. Use strace to be certain. strace is your friend.
answered Jan 28, 2012 at 22:12
Robin GreenRobin Green
1,253 12 silverish badges 28 bronze badges
2
-
I've been reading many threads with my problem and that was actually the solution. Should be one of the first things to bank check when having any filesystem problems, I guess. I'm using
dfinstead ofstracethough. How wouldstraceaid me? Never used itApr 14, 2014 at x:11
-
Well, if you already guessed that the problem might exist running out of infinite, then df can help. But strace will tell you what the mistake code was when it tried to lock the file, and so it should remove the guesswork. The way I normally call strace is
strace -f -east trace=filecommand since this usually gives the most useful results.April 14, 2014 at xi:03
A demo of this error on Ubuntu 14.04:
user@mybox:/dwelling house$ sudo useradd eric user@mybox:/abode$ userdel eric userdel: Permission denied. userdel: cannot lock /etc/passwd; try again after. sudo gives y'all the permission to lock it.
user@mybox:/home$ sudo userdel eric user@mybox:/home$ answered Sep 17, 2014 at twenty:45
Eric LeschinskiEric Leschinski
6,388 half-dozen gold badges 43 argent badges 49 statuary badges
answered May 19, 2017 at 23:45
Had same issue, since /etc was full. This is why /etc/passwd could not exist written. Make sure that you lot take enough space on /etc, if non and then enlarge information technology or clean unnecessary stuff.
answered Jan 3, 2018 at 15:39
Source: https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later
This solved the issue I had later on booting into recovery mode by editing the grub entry
February i, 2017 at 8:16
but where shall one look for the
.lockfiles? thanks to @trevorRobinson it seems ane should look in/etc/, right?Feb 13, 2017 at xiii:32
What if it says
mountain: cannot remount /dev/dm-0 read-write, is write-protected. I'm in ChromeOS (Linux) with Dev Mode enabled.Apr 22, 2017 at v:51
Why isn't this the accepted reply??
Jul 20, 2017 at 7:22