Solved Error adding new user ?

Code:
# adduser
Username: db51
Full name: db51.ofloo.net
Uid (Leave empty for default):
Login group [db51]:
Login group is db51. Invite db51 into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]:
Home directory [/home/db51]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]:
Username   : db51
Password   : <disabled>
Full Name  : db51
Uid        : 1025
Class      :
Groups     : db51
Home       : /home/db51
Home Mode  :
Shell      : /bin/sh
Locked     : no
OK? (yes/no): y
pw: user 'db51' disappeared during update
adduser: ERROR: There was an error adding user (db51).
Add another user? (yes/no):

Code:
# grep db51 /etc/passwd
db51:*:1025:1025:db51.ofloo.net:/home/db51:/bin/sh

Code:
# grep db51 /etc/master.passwd
db51:*:1025:1025::0:0:db51.ofloo.net:/home/db51:/bin/sh

Code:
# grep db51 /etc/group
db51:*:1025:

Code:
# cap_mkdb /etc/master.passwd
# id db51
id: db51: no such user

vipw https://forums.freebsd.org/threads/git_daemon-disappeared-during-update.63255/ solved this.

But what caused this?
 
Version FreeBSD 12.1-RELEASE-p5 GENERIC amd64

I'm not sure it was there suddenly after upgrading to that version. I might be able to produce this, this runs inside a bhyve vm, and i still got snapshots from before the upgrade.

So i could rollback and redo the upgrade and see if it happens again.
 
No this time arround I upgraded from i think version 12.1p4 could be p3 not entirely sure.
 
Note:
Upgrade = 1x.y to 1z.v or to 1v.z;
Update = 1x.y-pM to 1x.y-pN

So you did not upgrade but updated your system. Perhaps then /etc/passwd was corrupted by a power loss or other extraorordinary interrruptions or distortions. You want to run fsck(8) on your boot volume. Anyway, sometimes this happens, and for what else reason do we have the recovery command /usr/sbin/pwd_mkdb -p /etc/master.passwd
 
My first though was if maybe it's a race condition within pw_user.c. Didn't go deep into src. It would be interesting to see if this can be reproduced at least somehow.
 
I am able to reproduce it consistently.

Code:
root@generic:~ # uname -a
FreeBSD generic 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  arm64
root@generic:~ # adduser
Username: pranav
Full name: Pranav Raval
Uid (Leave empty for default):
Login group [pranav]: wheel video
Login group is wheel video. Invite pranav into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/pranav]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username   : pranav
Password   : *****
Full Name  : Pranav Raval
Uid        : 1002
Class      :
Groups     : wheel video
Home       : /home/pranav
Home Mode  :
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
pw: group `wheel video' does not exist
adduser: ERROR: There was an error adding user (pranav).
Add another user? (yes/no): no
Goodbye!
root@generic:~ #
 
First when I tried it on my machine I got the same error. I did repeat it few times, error occurred. I toggled the debugging in the script to see what it does when the cmd fails and error disappeared. Now I can add the user without a problem. Any other (random) user I tried to add is OK now. Hm..
 
Back
Top