# Cannot add user or rebuild password database



## Deleted member 10519 (Aug 9, 2014)

Hello everyone.

I've discovered that I can no longer add users on my system, but I don't know when this problem appeared. Adding a user with `adduser` fails with "User 'username' disappeared during update". I found the following instructions for fixing this, but neither works for me: running `vipw` and then saving without making any edits, and also running `pwd_mkdb -p /etc/master.passwd`.

I have since discovered that /etc/passwd and /etc/master.passed both had a duplicate "unbound" user and I thought that might be the problem, so I have manually deleted the duplicate from each file.

However, the problem persists. Running `pwd_mkdb -p /etc/master.passwd` either fails with the message "Abort", or sometimes hangs forever.

Oddly, if I copy my /etc/master.passed file to a jail then I can successfully run `pwd_mkdb -p /etc/master.passwd` there. And if I run `ezjail-admin update -b` or `ezjail-admin update -i` then it fails when executing the `pwd_mkdb ...` command.

If I run `dmesg`, then I see some messages like "pid 30941 (pwd_mkdb), uid 0: exited on signal 6".

Does anybody know what the problem is and how to fix it?


----------



## Deleted member 10519 (Aug 9, 2014)

Phew!  I've solved this problem for myself. I came across this message in the FreeBSD mailing lists which mentions multiple entries in /etc/shells. My file looked something like this:


```
# $FreeBSD: release/10.0.0/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
# $FreeBSD: release/9.1.0/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
# $FreeBSD: release/10.0.0/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
# $FreeBSD: release/9.1.0/etc/shells 59717 2000-04-27 21:58:46Z ache $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
```

This repeated for hundreds of lines.

After removing all duplicate entries, the `pwd_mkdb -p /etc/master.passwd` succeeded and I am now able to add users again.


----------



## kpa (Aug 9, 2014)

That should be reported as a bug, the code reading the /etc/shells file should be robust enough to handle such pathological cases.


----------



## Deleted member 10519 (Aug 9, 2014)

Thanks for the suggestion. I've reported a bug.


----------

