chsh corrupts /etc/pwd.db

Andrea Brancatelli abrancatelli at schema31.it
Thu Aug 22 11:16:01 UTC 2019


On 2019-08-22 12:43, Miroslav Lachman wrote:

>> I run in to something similar from time to time from about 10.x or 8.x (i skipped 9.x)
>> I do not remember exactly what command did the corruption, if it was vipw or chsh or something else to manipulate user database. The fix was easy - run it again or use pwd_mkdb
> 
> I searched our archive of issues and found it. It was error with "pw" command which sometimes failed in very weird way:
> 
> # pw useradd -n user1 -u 1003 -G wheel -s /bin/tcsh -m -M 0700 -c "User One"
> 
> pw: user 'user1' disappeared during update
> 
> It was on FreeBSD 8.x. So it is different error than yours.

It still happens nowadays when you upgrade from FreeBSD 10.x to 11.x or
from 11.x to 12.x. 

It doesn't happens deterministically but after upgrading the machines I
often find myself with PKG unable to upgrade some programs because it
cannot delete/add users. 

The fix is, as already said, pwd_mkdb (-p)

---

Andrea Brancatelli


More information about the freebsd-stable mailing list