User application Snap plugging "cups" does not set CUPS_SERVER

Bug #1964262 reported by Till Kamppeter
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Invalid
Undecided
Unassigned

Bug Description

See also

https://forum.snapcraft.io/t/cups-interface-merged-into-snapd-additional-steps-to-complete/

for some background information.

I am on Jammy, amd64.

For the development of the new "cups" interface of snapd I did the following test:

1. Install snapd Snap from edge, gave me version 2.54.4+git1072.g87e5a7c

2. Get CUPS Snap from GIT repo: https://github.com/OpenPrinting/cups-snap, apply following patch:

----------
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -59,6 +59,7 @@ slots:
     interface: cups-control
   cups:
     interface: cups
+ cups-socket-directory: $SNAP_COMMON/run

 apps:

----------

Build the Snap with "snapcraft snap" and install it with "sudo snap install --dangerous SNAPFILE"

3. Get test-snapd-cups-consumer from GIT: https://github.com/snapcore/test-snapd-cups-consumer/
Build and install this Snap, as you did with the CUPS Snap, no patches needed here.

4. Connect the "cups" interface:

sudo snap connect test-snapd-cups-consumer:cups cups:cups

Now you should have all set up. So run the application of the test Snap:

test-snapd-cups-consumer.cups

It starts a shell inside the Snap harness so that you can do tests there. CUPS command line tools are installed there.

In the shell run:

$ echo $CUPS_SERVER
$ lpstat -H
$ lpstat -v
$ exit

You see that the CUPS_SERVER environment variable is no set and the lpstat commands refer themselves to the system's CUPS (/run/cups/cups.sock) and not to the Snap's CUPS (/var/cups/cups.sock).

$ snap list
Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical✓ base
chromium 99.0.4844.51 1926 latest/stable canonical✓ -
core 16-2.54.3 12725 latest/stable canonical✓ core
core18 20211215 2284 latest/stable canonical✓ base
core20 20220304 1376 latest/edge canonical✓ base
cups 2.4.1-3 x22 - - -
cups-admin-test 0.1.0 x5 - - -
cups-admin-test-no-control 0.1.0 x10 - - -
ghostscript-printer-app 1.0 x130 - - -
gimp 2.10.28 383 latest/stable snapcrafters -
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 161 latest/stable canonical✓ -
gnome-3-34-1804 0+git.3556cb3 77 latest/stable/… canonical✓ -
gnome-3-38-2004 0+git.1f9014a 99 latest/stable canonical✓ -
gtk-common-themes 0.1-59-g7bca6ae 1519 latest/stable/… canonical✓ -
gutenprint-printer-app 1.0 x35 - - -
hplip-printer-app 1.0 x3 latest/edge - -
ipp-usb 0.9.19+git7.72a1620 x3 - - -
kde-frameworks-5-core18 5.61.0 32 latest/stable kde✓ -
kde-frameworks-5-qt-5-15-core20 5.79.0 14 latest/stable kde✓ -
multipass 1.8.0 6130 latest/stable canonical✓ -
ps-printer-app 1.0 x76 latest/edge - -
rasterview 1.8 222 latest/stable michaelrsweet -
snap-store 3.38.0-66-gbd5b8f7 558 latest/stable/… canonical✓ -
snapcraft 6.0.2 7010 latest/stable canonical✓ classic
snapd 2.54.4+git1072.g87e5a7c 15211 latest/edge canonical✓ snapd
telegram-desktop 3.4.3 3544 latest/stable telegram.desktop -
test-snapd-cups-consumer 1.0 x2 latest/edge - -
zoom-client 5.9.6.2225 170 latest/stable ogra -

$ snap connections | grep cups
avahi-control cups:avahi-control :avahi-control manual
avahi-observe cups-admin-test-no-control:avahi-observe :avahi-observe manual
avahi-observe cups-admin-test:avahi-observe :avahi-observe manual
cups cups-admin-test-no-control:cups cups:cups manual
cups test-snapd-cups-consumer:cups cups:cups manual
cups-control chromium:cups-control :cups-control -
cups-control cups-admin-test:cups-control :cups-control manual
cups-control cups:cups-internal cups:cups-control manual
home cups-admin-test-no-control:home :home -
home cups-admin-test:home :home -
home cups:home :home -
network cups-admin-test-no-control:network :network -
network cups-admin-test:network :network -
network cups:network :network -
network test-snapd-cups-consumer:network :network -
network-bind cups:network-bind :network-bind -
network-manager-observe cups:network-manager-observe :network-manager-observe manual
raw-usb cups:raw-usb :raw-usb manual
system-files cups:etc-cups :system-files manual

$

summary: - User application Snap pluggin "cups" does not set CUPS_SERVER
+ User application Snap plugging "cups" does not set CUPS_SERVER
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

$ snap version
snap 2.54.4+git1072.g87e5a7c
snapd 2.54.4+git1072.g87e5a7c
series 16
ubuntu 22.04
kernel 5.15.0-18-generic

Revision history for this message
Ian Johnson (anonymouse67) wrote :

I can't reproduce this in a jammy VM when building the test-snapd-cups-consumer snap from git revision 4f25c2f7cff6ba1d13149c19d52177004615ebaf with the cups snap on edge (revision 664):

ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ snapcraft snap
...
Snapping |
Snapped test-snapd-cups-consumer_1.0_amd64.snap
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ sudo snap install cups --edge
cups (edge) 2.4.1-3 from OpenPrinting✓ installed
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ sudo snap install --dangerous test-snapd-cups-consumer_1.0_amd64.snap
2022-03-11T08:45:56-06:00 INFO failed to update "cups", will not have required content "foo": snap has no updates available
test-snapd-cups-consumer 1.0 installed
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ snap connections test-snapd-cups-consumer
Interface Plug Slot Notes
content test-snapd-cups-consumer:foo-install-cups - -
cups test-snapd-cups-consumer:cups cups:cups -
cups-control test-snapd-cups-consumer:cups-control - -
network test-snapd-cups-consumer:network :network -
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ test-snapd-cups-consumer.cups
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@sparkling-zebu:/home/ubuntu/test-snapd-cups-consumer$ echo $CUPS_SERVER
/var/cups/cups.sock
ubuntu@sparkling-zebu:/home/ubuntu/test-snapd-cups-consumer$ ^C
ubuntu@sparkling-zebu:/home/ubuntu/test-snapd-cups-consumer$ exit
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ snap list cups
Name Version Rev Tracking Publisher Notes
cups 2.4.1-3 664 latest/edge openprinting✓ -
ubuntu@sparkling-zebu:~/test-snapd-cups-consumer$ snap version
snap 2.54.4+git1079.gbf8d25c
snapd 2.54.4+git1079.gbf8d25c
series 16
ubuntu 22.04
kernel 5.15.0-18-generic

Changed in snapd:
status: New → Incomplete
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Till confirmed to me that he cannot reproduce this anymore either, so I'm going to close this bug.

Changed in snapd:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.