[Bug 1158686] [NEW] When restarting avahi-daemon cups does not reconnect to it - workaround

Till Kamppeter 1158686 at bugs.launchpad.net
Fri Mar 22 09:25:39 UTC 2013


Public bug reported:

I use CUPS with shared printers and the shared printers are Bonjour-
broadcasted by Avahi. This works well when avahi-daemon is started
before cups and both keep running. But if I restart (stop and start
gain) avahi-daemon while CUPS is running, CUPS does not reconnect to
avahi-daemon again and so stops broadcasting. What I expect is that CUPS
reconnects after the restart of avahi-daemon. This can easily happen if
for example the avahi-daemon package gets updated, avahi-daemon crashes,
or the admin changes the configuration of avahi-daemon.

I am using Ubuntu Raring (13.04) with CUPS 1.6.2.

The real fix would need to be done in CUPS and therefore I did the
following upstream bug report:

https://www.cups.org/str.php?L4300

For the time being until CUPS gets fixed I suggest the following
workaround:

If one adds the following lines to the end of the /etc/init/avahi-
daemon.conf file

----------
post-start script
    if lpstat -h localhost -r 2>/dev/null | grep -qv not; then
        killall -HUP cupsd
    fi
end script
----------

the CUPS daemon gets kicked after starting avahi-daemon and so
reconnects. The "if" only comes true if "lpstat" is present and the
answer of "lpstat -h localhost -r" does not contain "not", meaning that
the CUPS daemon is running.

This works at least for restarting the avahi-daemon by "stop avahi-
daemon; ...; start avahi-daemon" (what happens when updating avahi-
daemon) or by the "respawn" (what happens when avahi-daemon crashes).

It does not work with "restart avahi-daemon". Any addition to my
suggested workaround to make this work is welcome.

Can this workaround be applied to Raring? Thanks.

** Affects: avahi (Ubuntu)
     Importance: High
         Status: New

** Changed in: avahi (Ubuntu)
   Importance: Undecided => High

** Changed in: avahi (Ubuntu)
    Milestone: None => ubuntu-13.04

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to avahi in Ubuntu.
https://bugs.launchpad.net/bugs/1158686

Title:
  When restarting avahi-daemon cups does not reconnect to it -
  workaround

Status in “avahi” package in Ubuntu:
  New

Bug description:
  I use CUPS with shared printers and the shared printers are Bonjour-
  broadcasted by Avahi. This works well when avahi-daemon is started
  before cups and both keep running. But if I restart (stop and start
  gain) avahi-daemon while CUPS is running, CUPS does not reconnect to
  avahi-daemon again and so stops broadcasting. What I expect is that
  CUPS reconnects after the restart of avahi-daemon. This can easily
  happen if for example the avahi-daemon package gets updated, avahi-
  daemon crashes, or the admin changes the configuration of avahi-
  daemon.

  I am using Ubuntu Raring (13.04) with CUPS 1.6.2.

  The real fix would need to be done in CUPS and therefore I did the
  following upstream bug report:

  https://www.cups.org/str.php?L4300

  For the time being until CUPS gets fixed I suggest the following
  workaround:

  If one adds the following lines to the end of the /etc/init/avahi-
  daemon.conf file

  ----------
  post-start script
      if lpstat -h localhost -r 2>/dev/null | grep -qv not; then
          killall -HUP cupsd
      fi
  end script
  ----------

  the CUPS daemon gets kicked after starting avahi-daemon and so
  reconnects. The "if" only comes true if "lpstat" is present and the
  answer of "lpstat -h localhost -r" does not contain "not", meaning
  that the CUPS daemon is running.

  This works at least for restarting the avahi-daemon by "stop avahi-
  daemon; ...; start avahi-daemon" (what happens when updating avahi-
  daemon) or by the "respawn" (what happens when avahi-daemon crashes).

  It does not work with "restart avahi-daemon". Any addition to my
  suggested workaround to make this work is welcome.

  Can this workaround be applied to Raring? Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/avahi/+bug/1158686/+subscriptions




More information about the foundations-bugs mailing list