While creating a new user account on one my servers running FreeBSD 12, I encountered the following error:
root@nas2:~ # adduser Username: devops Full name: Ansible Operator Uid (Leave empty for default): Login group [devops]: Login group is devops. Invite devops into other groups? : Login class [default]: Shell (sh csh tcsh nologin) [sh]: Home directory [/home/devops]: Home directory permissions (Leave empty for default): Use password-based authentication? [yes]: no Lock out the account after creation? [no]: no Username : devops Password : <disabled> Full Name : Ansible Operator Uid : 1002 Class : Groups : devops Home : /home/devops Home Mode : Shell : /bin/sh Locked : no OK? (yes/no): yes pw: user 'devops' disappeared during update adduser: ERROR: There was an error adding user (devops). Add another user? (yes/no): no Goodbye!
According to a discussion on a FreeBSD forum, the problem could have caused by the databases being out of sync.
The fix was simple enough.
root@nas2:~ # /usr/sbin/pwd_mkdb -p /etc/master.passwd root@nas2:~ # getent passwd devops devops:*:1002:1002:Ansible Operator:/home/devops:/bin/sh