Centos Cannot Lock etcpasswd; Try Again Later
nine Answers nine
If no .lock files are present but you still cannot create a user try the following
sudo mount -o remount,rw / If logged in as root then apply
mount -o remount,rw /
Jawa
three,559 13 gold badges xxx silverish badges 36 bronze badges
answered Oct three, 2014 at 7:22
4
The user you are running the commands as lack the required privileges. Modify to root user by issuing the command
su - or if you have/apply sudo
sudo <command to run> answered Jun thirteen, 2011 at vii:eighteen
inquaminquam
303 1 silver badge 8 bronze badges
If you have -R /some/chroot added to your useradd command, that might be the trouble.
I thought information technology meant that the user would be jailed upon login, merely that'southward non the example. Past looking at strace output, I saw useradd chrooted into the specified directory, after which of form information technology cannot find /etc/passwd anymore. So I'm not certain what the option is for, but there's your (well, my) problem.
answered Jun 17, 2017 at 20:17
LucLuc
ii,373 ii aureate badges 23 silver badges 34 bronze badges
2
-
This was exactly what I was trying. Afterwards removing the
-R [dir]option I was able to create the user.Oct eleven, 2018 at 18:55
-
Dainty approximate! Thank you. I also understood that the chroot for
useraddis not what you think information technology is :) It just uses the specified dir as a root for the user's system. It's useful for cloned isolated sub-OS, which is rarely what you lot desire...Sep 7, 2019 at xiii:45
That's because you don't have permissions for those operations
- You can't read
/etc/shadow - You lot can't directly change
/etc/passwd
You tin can change both files through specialized commands (e.g yous can change your password).
answered Jun 13, 2011 at 7:xvi
1
-
to change password, utilize " passwd <username> "
Jun xiii, 2011 at 7:21
I ran into this when a deejay 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 continue:
sudo rm /etc/passwd.lock sudo rm /etc/shadow.lock sudo rm /etc/group.lock sudo rm /etc/gshadow.lock answered Aug 2, 2012 at 21:20
This tin also be caused by running out of infinite on the root filesystem. Use strace to exist sure. strace is your friend.
answered Jan 28, 2012 at 22:12
Robin GreenishRobin Light-green
1,263 1 gilt badge 12 silvery badges 28 bronze badges
two
-
I've been reading many threads with my problem and that was actually the solution. Should be ane of the first things to check when having any filesystem problems, I judge. I'thousand using
dfinstead ofstracethough. How wouldstraceassistance me? Never used itApr 14, 2014 at 10:11
-
Well, if y'all already guessed that the problem might be running out of infinite, then df can help. Simply strace volition tell y'all what the mistake lawmaking was when information technology tried to lock the file, and so it should remove the guesswork. The style I commonly call strace is
strace -f -eastward trace=filecommand since this normally gives the nigh useful results.Apr 14, 2014 at eleven:03
A demo of this error on Ubuntu 14.04:
user@mybox:/domicile$ sudo useradd eric user@mybox:/domicile$ userdel eric userdel: Permission denied. userdel: cannot lock /etc/passwd; attempt again later on. sudo gives you the permission to lock it.
user@mybox:/abode$ sudo userdel eric user@mybox:/abode$ answered Sep 17, 2014 at xx:45
Eric LeschinskiEric Leschinski
6,448 half dozen aureate badges 43 silver badges 49 bronze badges
answered May 19, 2017 at 23:45
Had same effect, since /etc was total. This is why /etc/passwd could not be written. Make sure that you have plenty space on /etc, if non and so enlarge it or clean unnecessary stuff.
answered January iii, 2018 at 15:39
colemanthishatthe.blogspot.com
Source: https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later
This solved the issue I had after booting into recovery fashion by editing the grub entry
Feb ane, 2017 at 8:16
simply where shall i look for the
.lockfiles? thank you to @trevorRobinson it seems i should look in/etc/, correct?Feb 13, 2017 at 13:32
What if it says
mountain: cannot remount /dev/dm-0 read-write, is write-protected. I'thousand in ChromeOS (Linux) with Dev Mode enabled.Apr 22, 2017 at v:51
Why isn't this the accepted answer??
Jul xx, 2017 at 7:22