Using a Driverless Printer on Debian (Without Avahi) (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Fri, 11 Feb 2022

Using a Driverless Printer on Debian (Without Avahi)

It's nice to be back on a relatively minimal Debian install, instead of Ubuntu-with-everything. But one thing that I have to admit I appreciated about Ubuntu: printing "just worked". Turn on a printer, call up the print menu in any app, and the printer I turned on would be there in the menu, without any need of struggling with CUPS configurations.

Ubuntu was using Avahi, the Linux version of Apple's Zeroconf/Bonjour framework, to discover printers. I knew that I'd probably need to install Avahi if I wanted easy printer configuration on Debian. But as it turned out, getting printing working was both harder, and easier.

Trying (Unsuccessfully) the Avahi Way

I found two Debian pages on configuring printers that looked useful: System Printing and CUPS Driverless Printing. The latter seemed to be what I wanted, so that one is mostly what I followed. That involved installing: apt install printer-driver-all cups-browsed avahi-utils. I also added myself to the lpadmin group.

(Note: the Debian Wiki page CUPS Print Queues: cupsbrowsed says that cups-browsed isn't needed for a simple home network any more, but I had been following the System Printing wiki which recommends it.)

After the install, CUPS and the Avahi daemon were both running. (I needed to log out and back in to get the lpadmin group permissions.)

As suggested in the Debian wiki page, I edited /etc/cups/cups-browsed.conf and uncommented the CreateIPPPrinterQueues Driverless line, then ran systemctl restart cups-browsed.

This is supposed to create a print queue for driverless printers, but it doesn't: the print dialogs in Firefox, GIMP and LibreOffice all listed nothing beyond "Print to PDF".

So I tried the other page, CUPS Driverless Printing, which uses a different approach. The section "Creating a Driverless Print Queue with lpadmin (Short Version)" says to obtain the printer's URI with driverless, and in my case it saw both printers available on the local net:

$ driverless                                                          ~
ipp://Brother%20HL-3170CDW%20series._ipp._tcp.local/
ipp://Dell%20Printer%20E310dw._ipp._tcp.local/

Looks like progress! The page then says to set up the queue with

lpadmin -p  -v  -E -m everywhere
But for me, that produced:
$ lpadmin -p color -v 'ipp://Brother%20HL-3170CDW%20series._ipp._tcp.local/' -E -m everywhere
lpadmin: Unable to connect to "BRN3C2AF4251DEE.local:631": Name or service not known

I puttered around for quite a while trying to fix this: apparently it has to do with MDNS not being served, which is related to /etc/nsswitch.conf. Apparently if MDNS is working correctly, you're supposed to be able to do things like ping Brother%20HL-3170CDW%20series._ipp._tcp.local, which didn't work on my system either.

Some source suggest that changing the host line in that file to hosts: files mdns4_minimal [NOTFOUND=return] dns might make MDNS work, but it didn't make any difference for me.

The Easier, Non-Avahi Way

As I was fiddling with this, though, I saw a couple of discussion threads that suggested using a URL made of the IP address on the local net, e.g. ipp://192.168.0.154/ipp/print. So I scanned the network to figure out my printer's IP, then tried:

$ lpadmin -p QUEUENAME -v ipp://192.168.1.WHATEVER/ipp/print -E -m everywhere

And it worked! Now an entry for colorlaser showed up in every program I tried, and I printed a nice photo from GIMP.

To use this, I didn't need any of that avahi or cups-browsed machinery; I was able to apt purge cups-browsed avahi-utils avahi-daemon libavahi-core7 libdaemon0 and the printer queue I'd set up still worked.

So in the end, probably all I really needed to install was apt install printer-driver-all, followed by finding the printer's IP address and then lpadmin -p colorlaser -v ipp://192.168.1.122/ipp/print -E -m everywhere and I would have been up and printing.

Tags: , , ,
[ 18:14 Feb 11, 2022    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus