[HowTo] Properly disable Avahi systemd service as you cannot remove avahi package| 20180328

Issue

You want to disable Avahi services because you don't use zero-configuration networking (zeroconf) implementation or multicast DNS/DNS-SD service.

NOTICE You cannot simply remove the package avahi via pacman because it's a dependency for many packages, but you can disable (mask) the service, as described in this guide.

Solution

Create symlinks:

sudo ln -sf /dev/null /etc/systemd/system/avahi-daemon.service
sudo ln -sf /dev/null /etc/systemd/system/avahi-daemon.socket
sudo ln -sf /dev/null /etc/systemd/system/dbus-org.freedesktop.Avahi.service

Reboot to apply settings.

Now avahi services are set as masked and are not running. See results:

sudo systemctl status -l avahi-daemon.{service,socket} dbus-org.freedesktop.Avahi.service

Hide Avahi tools desktop links in applications menus

sudo bash -c "echo 'NoDisplay=true' >> /usr/share/applications/avahi-discover.desktop"
sudo bash -c "echo 'NoDisplay=true' >> /usr/share/applications/bssh.desktop"
sudo bash -c "echo 'NoDisplay=true' >> /usr/share/applications/bvnc.desktop"
sudo update-desktop-database

Revert changes (if you want re-enable avahi services)

sudo rm /etc/systemd/system/avahi-daemon.{service,socket}
sudo ln -sf /usr/lib/systemd/system/avahi-daemon.service /etc/systemd/system/dbus-org.freedesktop.Avahi.service

Reboot to apply settings.

8 Likes

[Minor edits made to correct grammar and flow]

2 Likes

Thanks :wink:

2 Likes

Forum kindly sponsored by