Fix FreeBSD 'Address family not supported by protocol' error at dovecot startup

Posted by Orville Bennett on 15 February 2024
Read time: about 2 minutes

I ran into an interesting error while rebuilding our e-mail infrastructure recently. Dovecot would not start in its FreeBSD 14.0 jail, even though the ports it was trying to listen on weren't being used.

The error I was getting was:

master: Error: service(imap-login): listen(::, 993) failed: Address family not supported by protocol

I initially wondered if it was due to my use of bastille as a jail manager. I transitioned away from iocage because it only works with ZFS filesystems and I was now on a UFS system. Bastille however works with both UFS and ZFS file systems.

This is my 3rd jail manager migration, moving from ezjail to iocage and now to bastille. But I digress.

Coming back to my error above, a quick internet search made clear what should have been inferred from the error above. Dovecot was attempting to bind to the IPv6 port 993, and since I had not set up IPv6 networking for this jail, that would never have worked.

All that was necessary was to change the listen directive in the dovecot.conf configuration file, and the dovecot service started properly again.

So this

listen = *, ::

was changed to this:

listen = *

Apparently I'm learning this for the second time. I'm deploying these config changes with an an infrastructure as code (IAC) tool now however, so if/when I enable IPv6 networking, the dovecot config will be updated accordingly. And if/when I move to another server this change will already be baked into my committed config.