`cups-control` interface needs to work with CUPS Debs, CUPS Snap, and on Ubuntu Core

@jamesh I have now done the correct test for classic Ubuntu, both the with classic CUPS installation and with use of CUPS Snap as standard print system. What it requires is a Snap in the Snap Store which auto-connects cups-control (with permission of the Snap Store team). These Snaps are, according to @shanepelletier from the Snap Store team (thanks a lot):

gedit
evince
highlighterpdf
banana-accounting
libreoffice
mailspring
okular
chromium
inkscape
brave
thunderbird
firefox

So I get

$ ls -l /etc/cups/cupsd.conf
ls: cannot access '/etc/cups/cupsd.conf': No such file or directory
$ sudo snap install brave
brave 1.52.130 from Brave Software (braveāœ“) installed
$ snap connections brave | grep cups-control
cups-control              brave:cups-control              cups:cups-control               -
$ sudo snap remove --purge brave
brave removed
$ sudo mv /etc/cups/cupsd.conf.orig /etc/cups/cupsd.conf
$ ls -l /etc/cups/cupsd.conf
-rw-r--r-- 1 root lp 4568 Mar 30 22:27 /etc/cups/cupsd.conf
$ sudo snap install brave
brave 1.52.130 from Brave Software (braveāœ“) installed
$ snap connections brave | grep cups-control
cups-control              brave:cups-control              :cups-control                   -
$ 

So everything OK for classic distros like Ubuntu 23.04 and 23.10 ā€¦

For Ubuntu Core (immutable all-Snap distro) it is more tricky as all the apps in the list are GUI (desktop) apps ā€¦

1 Like

The test snapd build should work on Ubuntu Core. I suspect at least one of those snaps could install on Core too. Remember that weā€™re just interested in whether the interface connection occurs: it doesnā€™t matter if the app actually works on a non-GUI system.

I have tested on standard Ubuntu Core (not Desktop) now.

For that I have followed the Ubuntu Core setup instructions but instead of Core 20.04 used there (web page outdated!!) I used Core 22.04:

$ wget http://cdimage.ubuntu.com/ubuntu-core/22/stable/current/ubuntu-core-22-amd64.img.xz
$ unxz ubuntu-core-22-amd64.img.xz
$ sudo apt install qemu-kvm ovmf
$ qemu-system-x86_64 -smp 2 -m 2048 -net nic,model=virtio -net user,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 -vga qxl -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on -drive file=ubuntu-core-22-amd64.img,cache=none,format=raw,id=disk1,if=none -device virtio-blk-pci,drive=disk1,bootindex=1 -machine accel=kvm

After completing the setup I logged in via SSH and did

$ snap install avahi
avahi 0.8 from Ondrej Kubik (ondra) installed
$ snap install cups
cups 2.4.6-2 from OpenPrintingāœ“ installed
$ snap install brave
brave 1.52.130 from Brave Software (braveāœ“) installed
$ snap connections brave | grep cups-control
cups-control              brave:cups-control              cups:cups-control               -
$ 

So everything working correctly now! Thanks a lot, @jamesh!

And just to verify: this was after installing the test build of snapd into the Ubuntu Core system?

@jamesh, the interesting thing is that I forgot this step and it simply worked ā€¦

Thatā€™s not surprising: thereā€™d only be one cups-control slot on an Ubuntu Core system (cups:cups-control), so itā€™s expected that auto-connect would work with released snapd. The question is if it still works with the modified snapd.

It seems that the installation of the new snapd totally broke the Ubuntu Core instance. Can it be that replacing snapd by an experimental one does not work in Core?

How did it break? Did it refuse to let you install the snapd update, or did it fail after the reboot? I wonder if the problem is that the image you downloaded uses a grade: stable model, which doesnā€™t like the unpublished snapd snap?

Hereā€™s an alternative you could try:

  1. Download ubuntu-core-22-amd64-dangerous.model. This is like the standard model, but allows unpublished versions of the required snaps.
  2. Install the ubuntu-image snap with:
    sudo snap install --classic ubuntu-image
    
  3. Build an image using the custom snapd with:
    ubuntu-image snap --image-size 4G --snap snapd_whatever.snap ubuntu-core-22-amd64-dangerous.model
    

That should produce a 4GB disk image called pc.img that can be booted as before.