Wednesday, December 19, 2012

Possible solution to disappearing CUPS printers (and blocking autodetection)

At work, there's been random instances of CUPS printers self-deleting their print queues. Xubuntu production machines, using CUPS 1.5.x and mostly Brother IPv6-compatible printers of different ages and makes. If you search for this behavior online, there's a random mismash of questions like this going back over 10 years.

One thing that does stick out in the present: the fact that Apple took over CUPS a few years ago, and they are heavy users of zeroconf / DNS-SD. Most Ubuntu systems come loaded with Avahi as part of the core software bundle: Avahi's job is to talk to printers and Apple equipment. A coworker and I figured maybe this auto-detection was causing network printers to wipe out manual print queues.

Step 1: disable auto-detection. sudo cupsctl --no-remote-printers is supposed to do this by itself; but a user on the source blog said it stopped working in CUPS 1.4.2. CUPS 1.4 came out around the time Apple took over, and it shows further adoption of DNS-SD. If you restart CUPS after this, and pull up the option to add a new printer, the DNS-SD printers will still be listed.

Step 2: disable Avahi. Stopping a service is easy enough, but what about after reboots? And removing the avahi-daemon never seems to last long: other core packages use it as a dependency. So we disable it: sudo sh -c "echo 'manual' > /etc/init/avahi-daemon.override" seems to work upon reboot.

It might be some time before we're certain we're on the right path with this approach. At the very least, you can disable auto-detection of printers on your Ubuntu systems.

No comments:

Post a Comment