Disabling avahi-daemon

In a troubling sign for Linux systems, I discovered a while ago that avahi-daemon was running on my system. Avahi is a service that allows for autodiscovery of network services on the local subnet, and avahi-daemon is the program that advertises services to other computers (ie makes your computer promiscuous). I’m really not interested in running programs I don’t need, and I especially don’t want avahi-daemon running. The curious thing was that I had never enabled it. By some means or another, avahi-daemon was running, and I needed it dead.

Since systemd has taken over the world, the obvious method to do this is:

# systemctl stop avahi-daemon
# systemctl disable avahi-daemon

But at next boot, avahi-daemon was running again! What the …? There was some kind of message about socket activation, so I tried

# systemctl disable avahi-daemon.socket

But still avahi-daemon starts with the system.

In frustration, I tried removing the avahi package from my system, but unfortunately it’s a dependency for stuff like scanning and printing – they need it to discover services on the network, and only use the client library.

At this point I began to find agreement with the Lennart Poettering haters (which seems a reasonable direction to vent, since Poettering is responsible for both avahi and systemd, one of which seems to be at fault). Then, a flash of inspiration. If I can’t prevent avahi-daemon from getting started, I can at least prevent it from doing anything. This turns out to be easier than expected! In /etc/avahi/avahi-daemon.conf, make these two settings thus:

use-ipv4=no
use-ipv6=no

Voila! Now avahi-daemon fails, as it has no networking enabled. There are other possibilities in that file too, such as deny-interfaces and disable-publishing.

So in the short term, my problem is fixed! But in the long term I’m a little less optimistic about this tendency for the computer to do what it wants, regardless of what it’s told to do.