Herr Bischoff

pw: user 'postfix' disappeared during update

While upgrading via pkg, at postfix, the following error occured:

pw: user 'postfix' disappeared during update
Adding user 'postfix' to group 'mail'.
pw: user `postfix' does not exist
pkg: PRE-INSTALL script failed

Thanks to this entry from the FreeBSD mailing list, I was able to correct the issue. It appears to be a problem with the password database that somehow got corrupted. The solution is to generate a new one:

pwd_mkdb /etc/master.passwd

After that, the upgrade works smoothly.

Bonus tip: use vipw to edit the password file. It’s the password equivalent to visudo.