Speeding up FreeBSD jail start times
SoftwareI love FreeBSD jails. They predate Docker et.al. by more than a decade, and I’d say they’re still more useful under most circumstances; especially when one uses them in conjunction with OpenZFS.
Their only source of frustration for me has been slow starts, to the point where some jails are beaten by VMs on my bhyve and Xen boxes. It happens so infrequently that I never bothered to check why; it was just something I noticed on my personal machines.
This weekend I was deploying a new VM to consolidate more stuff (Mastodon post here), like a gentleman. For these I wrote out config to /etc/hosts within each jail so I could communicate via hostname. These jails booted instantly.
It took me longer than it should to realise that sendmail(8) was the culprit, which just like on a real server, requires a fully-qualified domain name (FQDN) configured or it will sit there on a new box waiting for an inordinate amount of time. That’s it!
I’ve now updated my jail initialisation scripts to write out a proper hosts file every time. As I said on Mastodon, I’ve always done this for client deployments, but the cobbler’s kids go barefoot.