Call for testing: OpenPrinting's CUPS Snap

@ogra, thanks, instructions above updated.

1 Like

It’s really hard to kill it permanently :smiley:

sudo systemctl disable cups-browsed
sudo systemctl stop cups-browsed
sudo systemctl disable cups
sudo systemctl disable cups.socket
sudo systemctl stop cups

reboot

> systemctl status cups

● cups.service - CUPS Scheduler
     Loaded: loaded (/lib/systemd/system/cups.service; disabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-03-13 18:14:51 +07; 17s ago
TriggeredBy: ● cups.socket
       Docs: man:cupsd(8)
   Main PID: 829 (cupsd)
      Tasks: 1 (limit: 4654)
     Memory: 6.4M
     CGroup: /system.slice/cups.service
             └─829 /usr/sbin/cupsd -l

мар 13 18:14:51 ubuntu20 systemd[1]: Started CUPS Scheduler.
мар 13 18:14:51 ubuntu20 /hpfax[844]: [844]: error: Failed to create /var/spool/cups/tmp/.hplip

Is it something trigger by connected printer?

> lsusb | grep HP
Bus 001 Device 008: ID 03f0:002a HP, Inc LaserJet P110

@adasiko @ogra probably the safest (but not the correctest) method for testing, at least for the time being until we found the correct way is:

sudo chmod -x /usr/sbin/cupsd
sudo chmod -x /usr/sbin/cups-browsed
sudo systemctl stop cups-browsed
sudo systemctl stop cups

Preventing starting CUPS either manually or via a dependency:

sudo systemctl mask cups

PS: unmask for reverse operation.

@adasiko Does this mean that for switching from the system’s CUPS to the Snap I have to run

sudo systemctl mask cups-browsed
sudo systemctl stop cups-browsed
sudo systemctl mask cups
sudo systemctl stop cups

and that is all to do before installing/starting the CUPS Snap?

Think that some sort of it…

I have HP P1102 over USB in Raspberry Pi with Ubuntu Server 20.04. And Ubuntu Desktop 20.04 in same local network.

Printer had not been found automatically. I added it manually over web interface (just one click in founded list).

Description:	HP LaserJet Professional p1102s Printer
Location:	
Driver:	Local Raw Printer (grayscale, 2-sided printing)
Connection:	dnssd://HP_LaserJet_Professional_P1102%20%40%20ubuntu._ipp._tcp.local/cups?uuid=a24df837-8136-34ed-5ed3-92078c855bc5
Defaults:	job-sheets=none, none media=unknown 

Sent test page from web interface and

Unable to locate printer “ubuntu.local”

Is it some sort of DNS problems? Or may be it has some sort of “bad” drivers (proprietary HP plugins)?
PS: printer works fine from many devices

@adasiko, first, where did you install the CUPS Snap? On the Raspberry Pi? On your Ubuntu Desktop? On both? Which web interface did you use? The one of the CUPS running on your Raspberry Pi? On your desktop? Or of the PostScript Printer Application on your Raspberry Pi?

Note that with the CUPS Snap and the PosyScript Printer Application no proprietary HPLIP drivers or plugins are involved, but if I check on a standard, classic setup with CUPS and HPLIP, your printer model requires the proprietary plugin from HP:

$ lpinfo -m | grep -i P1102
foo2zjs:0/ppd/foo2zjs/HP-LaserJet_Pro_P1102.ppd HP LaserJet Pro P1102 Foomatic/foo2zjs-z2 (recommended)
foo2zjs:0/ppd/foo2zjs/HP-LaserJet_Pro_P1102w.ppd HP LaserJet Pro P1102w Foomatic/foo2zjs-z2 (recommended)
hplip:0/ppd/hplip/HP/hp-laserjet_professional_p1102.ppd HP LaserJet Professional p1102, hpcups 3.21.2, requires proprietary plugin
hplip:1/ppd/hplip/HP/hp-laserjet_professional_p1102.ppd HP LaserJet Professional p1102, hpcups 3.21.2, requires proprietary plugin
hplip:2/ppd/hplip/HP/hp-laserjet_professional_p1102.ppd HP LaserJet Professional p1102, hpcups 3.21.2, requires proprietary plugin
drv:///hpcups.drv/hp-laserjet_professional_p1102.ppd HP LaserJet Professional p1102, hpcups 3.21.2, requires proprietary plugin
hplip:0/ppd/hplip/HP/hp-laserjet_professional_p1102s.ppd HP LaserJet Professional p1102s, hpcups 3.12.2, requires proprietary plugin
hplip:0/ppd/hplip/HP/hp-laserjet_professional_p1102w.ppd HP LaserJet Professional p1102w, hpcups 3.21.2, requires proprietary plugin
drv:///hpcups.drv/hp-laserjet_professional_p1102w.ppd HP LaserJet Professional p1102w, hpcups 3.21.2, requires proprietary plugin
$

Therefore it will not work with the PostScript Printer Application (it is not a PostScript printer). What you have to check is whether it simply works as a driverless (AirPrint, IPP Everywhere, Mopria) printer. In this case the CUPS Snap would pick it up fully automatically.

Could you run the command

driverless

on the Raspberry Pi, where you have connected the printer to USB and post the output here?

Raspberry Pi has casual CUPS from DEB repository. And proprietary plugin installed by hp-setup.

CUPS from SNAP on another Desktop Ubuntu (x64 PC).

From Raspberry Pi CUPS web interface:

HP LaserJet Professional p1102, hpcups 3.20.3, requires proprietary plugin

It’s proprietary plugin version 3.20.3 https://developers.hp.com/hp-linux-imaging-and-printing/binary_plugin.html

And I think that nothing driverless things on Raspberry Pi :confused:

> driverless -v
DEBUG: Started ippfind (PID 2834)
DEBUG: Started post-processing (PID 2835)
DEBUG: PID 2834 (ippfind) stopped with status 1!
DEBUG: PID 2835 (Post-processing) exited with no errors.

I don’t know how AirPrint works. But I can print from my iPhone by default.

@adasiko, first test whether you printer works on the Raspberry Pi. Print a file from a terminal on the Pi or print a test page from the Pi’s CUPS web interface. Make sure that your Pi shares the printer (CUPS must share printers in general and each printer needs to be shared individually). Probably this works already, your iPhone talking with the CUPS of the RaspBerry Pi. AirPrint as a server works on Ubuntu’s CUPS already for several years (as distro patch as CUPS upstream was maintained by Apple) but this support was rather rudimentary, not allowing to set options on the iPhone. Newer CUPS (2.4.x) which is maintained by OpenPrinting and not by Apple has full AirPrint support (for example the CUPS Snap).

If the Pi and your client machine running the CUPS Snap are in the same subnet, the CUPS Snap should see the printers on the Pi and automatically create a queue.

Your manual queue should principally work, the problem you mention seems to be a DNS problem. Can you log into the Pi via ssh ubuntu.local? Does a browser on your client display the Pi’s web interface via http://ubuntu.local:631/?

All works. But not with snap cups web interface on Desktop Ubuntu. Снимок экрана от 2021-03-19 23-03-35|690x460

And auto discovering also work while adding printer. Снимок экрана от 2021-03-19 23-00-24|690x406

@adasiko soall works, also printing from the client, only the CUPS web interface of the Pi does not work?

Check whether the web interface is activated on the Pi’s CUPS. Run

cupsctl

on the Pi or llok into the Pi’s cupsd.conf. Look for a WebInterface entry and whether it is set to yes.

Server (Raspberry Pi) works fine with printer over USB and CUPS as DEB package. I do not install CUPS SNAP version on “Print Server” aka Raspberry Pi.

Only printing from client does not work with CUPS as SNAP package. Clear Desktop Ubuntu (with preinstalled CUPS as DEB package) works fine with this printing over Ethernet.

screen 2021-03-20 13-21-44|690x439

Yes. It’s DNS problem https://askubuntu.com/a/1277030/356454

  1. Clean Ubuntu Desktop installation with DEB CUPS - all works fine. ping ubuntu.local - OK (It’s print server on Raspberry Pi)

  2. Turn Off DEB CUPS services. Install SNAP CUPS. Add Printer from Web interface (it’s discovering fine with ubuntu.local name). Printing does not work - "Unable to locate printer “ubuntu.local” ping ubuntu.local - OK One line to /etc/hosts

192.168.181.2 ubuntu.local

And printing is working (without restart any services).

But ping is always working without problems… And original (DEB) CUPS working with it too… :thinking:

CUPS DEB has this connection:

implicitclass://HP_LaserJet_Professional_P1102_ubuntu/

SNAP CUPS this:

dnssd://HP_LaserJet_Professional_P1102%20%40%20ubuntu._ipp._tcp.local/cups?uuid=a24df837-8136-34ed-5ed3-92078c855bc5

@adasiko Is your CUPS Snap connected with the avahi-control interface?

Could you run

 snap connections | grep cups:

and paste the output here?

If it is not connected, run

sudo snap connect cups:avahi-control

Does printing with the snapped CUPS now work?

Yes

> snap connections cups
Interface                Plug                          Slot                      Notes
avahi-control            cups:avahi-control            :avahi-control            -
cups                     -                             cups:cups                 -
cups-control             cups:cups-internal            cups:cups-control         -
home                     cups:home                     :home                     -
network                  cups:network                  :network                  -
network-bind             cups:network-bind             :network-bind             -
network-manager-observe  cups:network-manager-observe  :network-manager-observe  -
raw-usb                  cups:raw-usb                  :raw-usb                  -
system-files             cups:etc-cups                 :system-files             -

@adasiko On the machine where you have the CUPS Snap running, could you run the command

sudo snap run --shell cups.cupsd

You will get a root prompt. In this shel you are under the same restrictions as your snapped cupsd. Run the command

ippfind

here and post what you get. Do you get results? Is ubuntu.local under them?
Now run

ipptool -tv URI get-printer-attributes.test

with the URIs from your ippfind output. Do you get valid printer attributes? Or do you get some kind of error output?
You can get back to your normal shell with the exit command.

adasiko@ubuntu20:~$ ping ubuntu.local -c 1
PING ubuntu.local (192.168.181.2) 56(84) bytes of data.
64 bytes from 192.168.181.2 (192.168.181.2): icmp_seq=1 ttl=64 time=0.470 ms

--- ubuntu.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.470/0.470/0.470/0.000 ms
adasiko@ubuntu20:~$ sudo snap run --shell cups.cupsd
root@ubuntu20:/home/adasiko# ippfind
ipp://ubuntu.local:631/printers/HP_LaserJet_Professional_P1102
root@ubuntu20:/home/adasiko# ipptool -tv ipp://ubuntu.local:631/printers/HP_LaserJet_Professional_P1102 get-printer-attributes.test
ipptool: Unable to connect to "ubuntu.local" on port 631 - Name or service not known
root@ubuntu20:/home/adasiko# 

One line “192.168.181.2 ubuntu.local” in /etc/hosts and all works. But simple ping works without it…

@adasiko Could you check the syslog (/var/log/syslog file or journalctl command) whether at the point in time when ipptool had answered ipptool: Unable to connect to "ubuntu.local" on port 631 - Name or service not known to you, whether there are messages containing audit and DENIED? This way we could see whether the CUPS Snap’s security shield is blocking DNS.

If you cannot determine the exact time when you have issued the ipptool command, simply repeat the commands from above.

Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.

It’s systemd-resolved…

@adasiko I do not get such messages, for me all is working correctly, I can print with the CUPS Snap to a remote printer without any problems. I have Ubuntu Hirsute (upcoming 21.04).