Usermod Cannot Lock etcpasswd; Try Again Later

9 Answers 9

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 use

                mount -o remount,rw /                              

user avatar

Jawa

3,559 13 gold badges 30 silver badges 36 bronze badges

answered Oct 3, 2014 at 7:22

user avatar

4

  • This solved the issue I had after booting into recovery mode by editing the grub entry

    Feb 1, 2017 at 8:16

  • but where shall one look for the .lock files? thanks to @trevorRobinson it seems one should look in /etc/, correct?

    Feb 13, 2017 at 13:32

  • What if it says mount: cannot remount /dev/dm-0 read-write, is write-protected. I'm in ChromeOS (Linux) with Dev Mode enabled.

    Apr 22, 2017 at 5:51

  • Why isn't this the accepted answer??

    Jul 20, 2017 at 7:22

The user you are running the commands as lack the required privileges. Change to root user by issuing the command

              su -                          

or if you have/use sudo

              sudo <command to run>                          

answered Jun 13, 2011 at 7:18

user avatar

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.

answered Jun 17, 2017 at 20:17

user avatar

2

  • This was exactly what I was trying. After removing the -R [dir] option I was able to create the user.

    Oct 11, 2018 at 18:55

  • Nice guess! Thank you. I also understood that the chroot for useradd is not what you think it is :) It only 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 want...

    Sep 7, 2019 at 13:45

That's because you don't have permissions for those operations

  • You can't read /etc/shadow
  • You can't directly modify /etc/passwd

You can change both files through specialized commands (e.g you can change your password).

answered Jun 13, 2011 at 7:16

1

  • to change password, use " passwd <username> "

    Jun 13, 2011 at 7:21

I ran into this when a disk error occurred during a userdel operation and the system had to be rebooted. I needed to delete all four of the following files to proceed:

              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

user avatar

This can also be caused by running out of space on the root filesystem. Use strace to be sure. strace is your friend.

answered Jan 28, 2012 at 22:12

user avatar

2

  • I've been reading many threads with my problem and that was actually the solution. Should be one of the first things to check when having any filesystem problems, I guess. I'm using df instead of strace though. How would strace help me? Never used it

    Apr 14, 2014 at 10:11

  • Well, if you already guessed that the problem might be running out of space, then df can help. But strace will tell you what the error code was when it tried to lock the file, so it should remove the guesswork. The way I usually call strace is strace -f -e trace=file command since this usually gives the most useful results.

    Apr 14, 2014 at 11:03

A demo of this error on Ubuntu 14.04:

              user@mybox:/home$ sudo useradd eric user@mybox:/home$ userdel eric userdel: Permission denied. userdel: cannot lock /etc/passwd; try again later.                          

sudo gives you the permission to lock it.

              user@mybox:/home$ sudo userdel eric user@mybox:/home$                          

answered Sep 17, 2014 at 20:45

user avatar

answered May 19, 2017 at 23:45

user avatar

Had same issue, since /etc was full. This is why /etc/passwd could not be written. Make sure that you have enough space on /etc, if not then enlarge it or clean unnecessary stuff.

answered Jan 3, 2018 at 15:39

user avatar

updegraffsinse1964.blogspot.com

Source: https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later

0 Response to "Usermod Cannot Lock etcpasswd; Try Again Later"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel