When doing this on Ubuntu server 14.04:
camilstaps@localhost:~$ sudo useradd --home-dir /var/www/xxx.camilstaps.nl/ --no-create-home --root /var/www/xxx.camilstaps.nl/ --shell /bin/sh xxx
I'm getting the error:
useradd: cannot lock /etc/passwd; try again later.
I checked and tried the following (found the suggestions all over the internet):
- Obviously, I'm using sudo
- There exists a file /etc/.pwd.lock, but it is empty and removing it doesn't help
- There are no other *.lock files in the /etc directory
- The filesystem is not full (14G available on /)
- Rebooting the server doesn't remove the lock.
I'm stumped. How can I unlock /etc/passwd?
df -ih output
camilstaps@localhost:~$ df -ih
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda1 1,3M 228K 1,1M 18% /
none 125K 4 125K 1% /sys/fs/cgroup
udev 124K 404 123K 1% /dev
tmpfs 125K 386 124K 1% /run
none 125K 5 125K 1% /run/lock
none 125K 1 125K 1% /run/shm
none 125K 2 125K 1% /run/user
adduserinstead ofuseradd? – heemayl Feb 16 '15 at 16:04rw-r--r--- what do you mean with your second question though? – Feb 16 '15 at 16:06mount | grep ' / '– muru Feb 16 '15 at 16:12/dev/vda1 on / type ext4 (rw,errors=remount-ro)- so I guess it's not, but when an error occurs it is? I can write other files in the /etc directory normally. – Feb 16 '15 at 16:14adduserand then change the/etc/passwdentry manually to make the desired directory (using proper permissions) as the home directory for the user, although i have not checked it. – heemayl Feb 16 '15 at 16:15usermod, but it saysuser 'xxx' does not exist... – Feb 16 '15 at 16:20chrootdir. – heemayl Feb 16 '15 at 16:21df -ishow with regards to inode usage on the/filesystem? – Aaron D Feb 16 '15 at 23:49