11

It seems that avahi-daemon process, which is unknown to me, is using excessive amounts of CPU on my system

I have tried both htop and system monitor, and only htop show the CPU use. Screenshots are included below.

What can I do to make avahi-daemon behave?

Edit: The issue often occurs when playing the game Dota 2. I've been observing this for a week.

htop

System Monitor System monitor doesn't appear to show which process is consuming CPU, unlike htop.

sudo systemctl status avahi-daemon.s* As requested by @heynnema

10
  • It turned out that 1 processor core is always maxed out for no reason, with all programs closed. To be honest I don't really know what the user avahi` is. But if it is true that avahi consumes 99% of CPU time, all 4 cores must be at full load. 1 out of 4 should be 25% (at least in the case of Windows Task Manager).
    – Livy
    Mar 31, 2019 at 19:08
  • Even if there is a single looping thread, the OS should be able to "split" the workload to all 4 cores (by running it on each core for a short period of time), resulting in 25% CPU utilization on each core. I really don't know why it is locked to a single CPU core like that.
    – Livy
    Mar 31, 2019 at 19:11
  • 1
    Edit your question with the output of sudo systemctl status avahi-daemon.s*. Report back to @heynnema
    – heynnema
    Mar 31, 2019 at 20:26
  • @heynnema I did what you requested. Please take a look, thanks. The command was run while avahi was using 100% CPU time of 1 core. If I reboot, everything is back to normal. It often occurs when I play the game Dota 2 for a while.
    – Livy
    Apr 7, 2019 at 4:02
  • @vidarlo I have limited knowledge about how the OS schedules threads for the CPU to process. But from what I have been observing for many years, single threaded programs are not locked to a single CPU core. Let's say you open 7-Zip and choose compression mode with 1 thread, you'll see the workload is split across all CPU cores in Windows Task Manager. Or maybe I am missing something here?
    – Livy
    Apr 7, 2019 at 4:03

2 Answers 2

7

Avahi daemon basically a network daemon that broadcasts your machine's IP address to the network. For example A printer broadcast its IP using Avahi daemon saying that "I am a printer and I can print your documents" if you don't have any such devices to be used in the network, you can disable the daemon using the below commands on Ubuntu

sudo systemctl disable avahi-daemon

Sometimes other software starts this daemon, so you can remove them permanently using the below commands.

apt-get remove avahi-daemon
4
  • At my office (university), there are a lot of printers, apparently linked to MacBookAir, probably shared by default instead of stay private, and even if I removed it, there are come back (under Jammy-22.04). I run sudo kill -9 <avahi-daemon pid>, and it ma fans stops to running.
    – bcag2
    Sep 30, 2022 at 8:31
  • That leads to new problems. To avoid error messages in systemd, you have to disbble the avahi socket too: sudo systemctl disable avahi-daemon.socket
    – Erich
    Jan 5, 2023 at 12:23
  • But now the the dbus-daemon complains every few seconds that cups-browsed needs avahi.
    – Erich
    Jan 5, 2023 at 12:25
  • 1
    @Erich so disable cups-browsed as well sudo systemctl disable cups-browsed.service. This is just another part of the printer-finding system. May 20, 2023 at 9:03
3

Avahi is required for multiple things regarding network and/or plug and play devices. Disabling it may disable some of services that you might need, depending on your computer use.

It was also consuming my cpu because I am part of large network, with lot's of printers.

What eventually did it for me, without disrupting print functionality is:

sudo nano /etc/avahi/avahi-daemon.conf

find ratelimit-interval-usec= and set it to 500000
find ratelimit-burst= and set that to 500
find enable-wide-area= and set that to no

press ctrl + o then save

restart avahi daemon

sudo systemctl restart avahi-daemon.service

Check CPU usage...

If above doesn't quickly resolve high CPU usage, further limitations can be done in rlimits section of avahi's config file, see man page or:

https://manpages.debian.org/testing/avahi-daemon/avahi-daemon.conf.5.en.html

For detailed instructions.

See this answer for more details about Avahi: https://unix.stackexchange.com/questions/566932/what-is-the-avahi-daemon

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .