pw: user 'git_daemon' disappeared during update

Posted on Wed 01 February 2017 in FreeBSD, passwd, git

Ran into the following error on FreeBSD the other day while trying to install git:

root@host:~ # pkg install -y git
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        git: 2.11.0_3

Number of packages to be installed: 1

The process will require 23 MiB more space.
[1/1] Installing git-2.11.0_3...
===> Creating groups.
Using existing group 'git_daemon'.
===> Creating users
Creating user 'git_daemon' with uid '964'.
pw: user 'git_daemon' disappeared during update
pkg: PRE-INSTALL script failed

After a bit of poking around I found out that there was something wrong with my passwd database. Looks like it wasn't quite up to date, so I just rebuilt it and was then able to install error-free:

root@host:~ # cp /etc/master.passwd ~/
root@host:~ # pwd_mkdb /etc/master.passwd