Missing FreeBSD map file

Today I learned FreeBSD can’t lodge email reports for root if aliases.db was never created, either in bsdinstall or your jail.

Long story short, I was seeing this after sudo-ing into a new instance:

[date] [hostname] sudo: [user]: user NOT in sudoers ; [..]

Heh, my bad. But then this appeared:

SYSERR(root): hash map "Alias0": missing map file /etc/mail/aliases.db
No such file or directory

Huh. So just to try, I “created” the file thusly:

# touch /etc/mail/aliases.db

Needless to say, that didn’t work! The solution, ironically from some ancient Red Hat docs:

# makemap hash /etc/mail/aliases.db < /etc/mail/aliases

This command must be run after creating an /etc/mail/aliases file. You also need to run it if you make any changes.

Happy long weekend!