无法在电脑中创建和删除用户帐户

无法在电脑中创建和删除用户帐户

当我尝试使用命令创建新的用户帐户时sudo adduser test-ser,收到此错误: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.

当我尝试删除一个已经存在的帐户时收到此错误:

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.

答案1

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

由于是这个锁定文件导致了问题,并且由于它没有 PID(意味着没有正在运行的进程持有该锁定,而这只是之前尝试的残留),我认为您可以安全地将其删除。然后重试。

相关内容