Avahi "Host name conflict" in FreeBSD jail
Nov 25, 2018
Recently I set up a jail on my FreeBSD 11 server to run CUPS and share a printer with AirPrint. However, Avahi would fail to sucessfully start, looping forever through numbered host names. Here's an excerpt from /var/log/messages:
Nov 25 13:16:12 cups avahi-daemon[39901]: Host name conflict, retrying with cups-6
Nov 25 13:16:13 cups avahi-daemon[39901]: Host name conflict, retrying with cups-7
Nov 25 13:16:14 cups avahi-daemon[39901]: Host name conflict, retrying with cups-8
Nov 25 13:16:15 cups avahi-daemon[39901]: Host name conflict, retrying with cups-9
Nov 25 13:16:16 cups avahi-daemon[39901]: Host name conflict, retrying with cups-10
I tried recommendations from this Github issue and others, such as disabling IPv6, editing the avahi hosts file, and manually specifying the host name, with no effect.
In another jail I run a file server that's also advertized over Bonjour with Avahi. I discovered with some testing that if only one jail, the cups or the file sharing one, was running at a time then Avahi would advertize the services of that jail successfully. If both jails were running then only the first would work.
Thus, the solution was to only run Avahi in one jail at a time. I ended up installing CUPS in the file server jail and now Avahi runs fine.