7

I am running Kali 2.0 64-bit, and I recently noticed that avahi-daemon is starting at boot time, listening on several udp ports.

How do I disable it completely, without purging the package itself?

I have tried sudo rcconf --off avahi-daemon

But there is a warning: Service 'avahi-daemon' is already off. Skipping...

I then tried sudo update-rc.d -f avahi-daemon remove

It doesn't produce any errors, nor warnings, but avahi-daemon still persists at boot time.

I then tried editing the /etc/default/avahi-daemon file by adding AVAHI_DAEMON_START = 0

But that doesn't work either.

I finally used the UPSTART manual override -->> echo manual | sudo tee /etc/init/avahi-daemon.override

And still no go.

Please help,

I am at my wits's end!

Thank you.

13

sudo systemctl disable avahi-daemon to disable boot time startup.

A few other options are systemctl list-units for a list of all known units, systemctl enable to enable boot time startup, systemctl start to start the service from terminal, but not enable boot time loading and systemctl stop to stop a service which has been started. man systemctl and man systemd will provide complete set of options.

Most (not all though) modern Linux distributions have switched or are switching to systemd from the traditional SysV init scripts. Also, http://blog.jorgenschaefer.de/2014/07/why-systemd.html covers some of the basics of systemd.

| improve this answer | |
  • somehow, avahi-daemon wont stop even after systemctl stop avahi-daemon. The message is Warning: Stopping avahi-daemon.service, but it can still be activated by: avahi-daemon.socket. And when I see the status it restarts automatically. Ubuntu 16.04 – infoclogged Apr 11 '17 at 10:31
  • 4
    A systemd .socket unit is designed to auto-start a service whenever something else needs it. This need is detected by a connection to an IPC or network socket, which systemd then passes on to the service, similar to inetd. If you don't want this behavior, you should disable the socket unit too: systemctl disable avahi-daemon.socket. Alternatively, systemctl mask avahi-daemon.service explicitly blocks the service from starting for any reason. – telcoM Mar 22 '18 at 15:50
  • 1
    Unfortunately, after some experimentation, I've found the only way to get avahi-daemon to stop -- even momentarily -- is to disable it completely using @Daniel's answer below. The only thing I would add is the --now flag to the disable command, which both stops and disables the unit, rather than just keeping it from starting on boot: sudo systemctl disable --now avahi-daemon.socket && sudo systemctl disable --now avahi-daemon.service – kael Jun 8 '18 at 21:36
5

My solution was to edit /etc/avahi/avahi-daemon.conf and make the following change: use-ipv4=no use-ipv6=no

Then do a root@magrf# service avahi-daemon restart

Verify that avahi daemon is stopped: root@magrf# ps -ef | grep avahi root 8311 8220 0 17:50 pts/0 00:00:00 grep avahi root@magrf#

As you can see, avahi processes are not running. If restart fails, try an explicit root@magrf# service avahi-daemon stop root@magrf# service avahi-deamon start

Restart is important so avahi could re-read configuration and shutdown service processes. Then it had performed a graceful exit.

  • This is genius! avahi has been a pita for me for years, I used to chmod -x the binary and this used to work.. but nowadays that makes other gnome features hang waiting for an answer from this pinnacle of despair. – axkibe Aug 30 '19 at 14:38
3

You can disable it with:

systemctl disable avahi-daemon.socket

And

systemctl disable avahi-daemon.service
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.