Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  22] [ 0]  / answers: 1 / hits: 145469  / 2 Years ago, sat, april 30, 2022, 7:59:08

How can I disable avahi-daemon and can you explain to me how it runs if it appears as a service but it itsn't in rcN.d?






You can stop reading here. In fact, please do unless you want to TEACH a noob some Ubuntu. The question above should be clear enough to be answered. The rest is just me calling out for some more structured way of finding one's way around Ubuntu. I can more or less use other "UNIX-like" systems.



I am a beginner so if I act nonsensically, consider me your daily WTF but do help me improve, please.



At every boot, /sbin/init seems to be launching a process called avahi-daemon



# initctl list | grep avahi
avahi-daemon start/running, process 1280


as user avahi



# id avahi
uid=107(avahi) gid=118(avahi) groups=118(avahi)


a ps -efww ef shows 2 processes active, both called avahi-daemon, and the PPID of the first avahi-daemon is indeed 1, the second process is just a child of the first. The PPID = 1 is what makes me think this was auto-started.






Optionally:



I don't really know how to check properly what gets executed at system startup, thinking about it.



Is this the way to get a list of services that run at startup? initctl list | sort






anyway, I seem to be able to temporarily stop this "service" through this command:



service avahi-daemon stop


or indeed this command



/etc/init.d/avahi-daemon stop


directly, which is what this /usr/sbin/service seems to be using:



env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE"


When launched, the script reminds me that I am controlling an "Upstart" service, and that I should use the simpler invocation stop avahi-daemon. I guess I will need to learn about Upstart but for now, all I need to learn is this:



how do I disable services in Ubuntu?



Here is what I tried (this should be the proper way to do it, or is it not?):



update-rc.d avahi-daemon disable


but it complains:



System start/stop links for /etc/init.d/avahi-daemon do not exist


so I went hunting for the path to the binary:



# Let me know if there is a better way to get the path above
readlink "/proc/$(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`)/exe"


which is this:



/usr/sbin/avahi-daemon


and anything that could be considered an "executable file" in etc:



find /etc -type f -name '*avahi*' -perm -u+x


thinking I would find startup scripts in /etc/rcN.d. I found other things instead:



/etc/dhcp/dhclient-exit-hooks.d/zzz_avahi-autoipd
/etc/dhcp/dhclient-enter-hooks.d/avahi-autoipd
/etc/resolvconf/update-libc.d/avahi-daemon
/etc/network/if-up.d/avahi-autoipd
/etc/network/if-up.d/avahi-daemon
/etc/network/if-down.d/avahi-autoipd
/etc/avahi/avahi-autoipd.action


seems like this avahi-daemon thing is being launched on network state changes? Is there a better way to hunt down binaries automatically started on a system?



I would have normally obliterated the symlinks in the various rc{3,5}.d at this stage but now I am not too sure. What exactly starts this beast? How to disable it without apt-get remove or apt-get purge?



It does not have too many resources open, as far as I can see:



lsof -p $(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`)


nor does it use too many CPU cycles, based on a quick glance at htop.



I wrote this one-liner to see if it goes funky on CPU util over a period of one minute, and it never does, but let me know if there are better ways to check that:



for i in {1..59}; do ps -p $(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`) --no-headers -o pcpu; sleep 1; done

More From » services

 Answers
3

Upstart startup scripts live in /etc/init, where you can find avahi-daemon.conf. All things listed in initctl list match to scripts in /etc/init, and they are not executable, thus your find missed them.



To disable a Upstart controlled service, see Upstart cookbook on disabling services: either add # to start on line, or use override files (example: sudo sh -c "echo manual > /etc/init/avahi-daemon.override").


[#34732] Sunday, May 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lotceptin

Total Points: 374
Total Questions: 106
Total Answers: 118

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
;