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.
10
  • Whats the output of sudo fuser /etc/subgid ?
    – heemayl
    May 24, 2015 at 15:18
  • testuser is not in the sudoers file. This incident will be reported.
    – gtaflow
    May 24, 2015 at 15:20
  • No, run it as user base
    – heemayl
    May 24, 2015 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, 2015 at 15:22
  • 1
    I edited my question to reply to you @Takkat
    – gtaflow
    May 24, 2015 at 15:34

1 Answer 1

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.

5
  • Is there a command to force deletion of the file? I'm installing nautilus to do it.
    – gtaflow
    May 24, 2015 at 16:50
  • @gtaflow it's likely owned by root. sudo rm /etc/subgid.lock should do it.
    – muru
    May 24, 2015 at 16:51
  • muru, what puzzled me is that reboot does not solve the issue, should not reboot make things even if a process has leftovers as far as lock files are concerned?
    – heemayl
    May 24, 2015 at 16:57
  • @heemayl not unless the lock file is on a transient file system like tmpfs.
    – muru
    May 24, 2015 at 16:58
  • Ah..makes sense..
    – heemayl
    May 24, 2015 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .