0

When I try to create a new user account with command sudo adduser test-ser, I receive this error: sudo adduser test-user

Adding user test-user ...
Adding new group test-user (1069) ...
Adding new user 'test-user' (1032) with group 'test-user' ...
useradd: existing lock file /etc/subgid.lock without a PID
useradd: cannot lock /etc/subgid; try again later.
adduser: '/usr/sbin/useradd -d /home/test-user -g test-user -s /bin/bash -u 1032 test-user' returned error code 18. Exiting.

When I try to delete an already existing account I receive this error:

sudo deluser --remove-home existinguser  
Looking for files to backup/remove ...
Removing user `existinguser' ...
Warning: group `existinguser' has no more members.
userdel: existing lock file /etc/subgid.lock without a PID
userdel: cannot lock /etc/subgid; try again later.
/usr/sbin/deluser: `/usr/sbin/userdel existinguser' returned error code 18. Exiting.
gtaflow
  • 3
  • 3
  • Whats the output of `sudo fuser /etc/subgid` ? – heemayl May 24 '15 at 15:18
  • `testuser is not in the sudoers file. This incident will be reported.` – gtaflow May 24 '15 at 15:20
  • No, run it as user `base` – heemayl May 24 '15 at 15:21
  • Erm... You posted 2x the same command output in your question. You probably copied the wrong command? And what about a reboot? That helps sometimes with lockfiles and does not hurt. – Byte Commander May 24 '15 at 15:22
  • `sudo fuser /etc/subgid` if i do this command as user `base` nothing happens: `base@base-vb:~$ sudo fuser /etc/subgid base@base-vb:~$ ` i already rebooted but nothing :) – gtaflow May 24 '15 at 15:23
  • [We should not create a new account with `useradd`. Use `adduser` instead](http://askubuntu.com/questions/139304/useradd-seems-to-have-failed-in-lubuntu-12-04) – Takkat May 24 '15 at 15:26
  • 1
    I edited my question to reply to you @Takkat – gtaflow May 24 '15 at 15:34
  • I formatted my question correctly thanks to @heemayl :-) – gtaflow May 24 '15 at 15:38
  • @gtaflow when you add in lots of lines of code, please add 4 spaces before each line, rather than individual `code` blocks for each line. Also, rather than `
    ` just add 2 spaces at the end of the line.
    – Tim May 24 '15 at 15:41
  • Help me guys!!! – gtaflow May 24 '15 at 16:06

1 Answers1

1
useradd: existing lock file /etc/subgid.lock without a PID

SInce it's this lock file that's causing the problem, and since it is without a PID (meaning there's no running process that's holding the lock and this is just some leftover of a previous attempt), I think you can delete it safely. Then try again.

muru
  • 193,181
  • 53
  • 473
  • 722