Workaround to avahi-daemon upgrade in Debian/GNU Linux

This quick entry is about a problem which I had when I upgraded my Debian box, the point is the avahi-daemon package upgrade process it’s not possible because it’s not able to stop the daemon properly. I looked for information about this trouble and I found these opened bug’s 768949 and 768620 but it seems that there’s a workaround.

An explanation about this package can be found executing this:
$ aptitude show avahi-daemon|grep -i -A 10 ^description

Description: Avahi mDNS/DNS-SD daemon
Avahi is a fully LGPL framework for Multicast DNS Service Discovery. It allows programs to publish and discover services and hosts running on a local network with no specific configuration. For example you can plug into a network and instantly find printers to print to, files to look at and people to talk to.
This package contains the Avahi Daemon which represents your machine on the network and allows other applications to publish and resolve mDNS/DNS-SD records.
Homepage: http://avahi.org/

Output in previous upgrade:
Current status: 1 update [-108].

This is the error trying to upgrade the package:
# aptitude dist-upgrade
The following packages will be upgraded:
avahi-daemon
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/87.4 kB of archives. After unpacking 0 B will be used.
Do you want to continue? [Y/n/?]
Reading changelogs... Done
(Reading database ... 295641 files and directories currently installed.)
Preparing to unpack .../avahi-daemon_0.6.31-4+b2_amd64.deb ...
Job for avahi-daemon.service canceled.
invoke-rc.d: initscript avahi-daemon, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Job for avahi-daemon.service canceled.
invoke-rc.d: initscript avahi-daemon, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/avahi-daemon_0.6.31-4+b2_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Errors were encountered while processing:
/var/cache/apt/archives/avahi-daemon_0.6.31-4+b2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Failed to perform requested operation on package. Trying to recover:

Now we’re going to apply the workaround, disabling avahi-daemon:

# systemctl disable avahi-daemon
Synchronizing state for avahi-daemon.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d avahi-daemon defaults
Executing /usr/sbin/update-rc.d avahi-daemon disable
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).
Removed symlink /etc/systemd/system/dbus-org.freedesktop.Avahi.service.
Removed symlink /etc/systemd/system/sockets.target.wants/avahi-daemon.socket.

And then we try again upgrade our system and as you can see the process can be finished:
# aptitude dist-upgrade
The following packages will be upgraded:
avahi-daemon
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/87.4 kB of archives. After unpacking 0 B will be used.
Do you want to continue? [Y/n/?]
Reading changelogs... Done
(Reading database ... 295641 files and directories currently installed.)
Preparing to unpack .../avahi-daemon_0.6.31-4+b2_amd64.deb ...
Warning: Stopping avahi-daemon.service, but it can still be activated by:
avahi-daemon.socket
Unpacking avahi-daemon (0.6.31-4+b2) over (0.6.31-4) ...
Processing triggers for dbus (1.8.16-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up avahi-daemon (0.6.31-4+b2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).

Current status: 0 updates [-1].

It’s time to enable the avahi-daemon:
# systemctl enable avahi-daemon
Synchronizing state for avahi-daemon.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d avahi-daemon defaults
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).
insserv: warning: current start runlevel(s) (empty) of script `avahi-daemon' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `avahi-daemon' overrides LSB defaults (0 1 6).
Executing /usr/sbin/update-rc.d avahi-daemon enable
Created symlink from /etc/systemd/system/dbus-org.freedesktop.Avahi.service to /lib/systemd/system/avahi-daemon.service.
Created symlink from /etc/systemd/system/sockets.target.wants/avahi-daemon.socket to /lib/systemd/system/avahi-daemon.socket.

Checking daemon status:
$ systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled)
Active: active (running) since Thu 2015-04-02 09:07:26 CEST; 1h 29min ago
Main PID: 19187 (avahi-daemon)
Status: "avahi-daemon 0.6.31 starting up."
CGroup: /system.slice/avahi-daemon.service
├─19187 avahi-daemon: running [fisher2.local]
└─19188 avahi-daemon: chroot helper

I hope this help you if you found the same problem upgrading your system.

Have fun!

“None but ourselves can free our minds.”
–Bob Marley

4 thoughts on “Workaround to avahi-daemon upgrade in Debian/GNU Linux

  1. Although I wasn’t doing a dist-upgrade disabling the service and then doing the apt upgrade did the trick. Thanks for the helpful tip.

    Best,
    DM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s