Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
2  
A for effort! –  Geoff Dec 10 '13 at 21:27
add comment

1 Answer 1

up vote 8 down vote accepted

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").

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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