How to run cups commands inside a snap

says that cups-control has been superseded by the cups interface, so i would expect the latter to provide everything you need …

perhaps @till.kamppeter can explain how it is supposed to work on UbuntuCore when you want to have a printer administration application running there …

You are right. cups-control has been superseded but on the cups interface page they are saying

The cups-control interface will continue to be available to allow printer setup tools (and general system admin tools, like this one) to be snapped.

I hope @till.kamppeter shows me the way :muscle:

At the moment I figured it out using a systemd service that I run as a workaround on Ubuntu Core systems. It does what I need but if one day I can converge all the administrative tasks into a snap that works on Ubuntu Core as well, it would be great. Still working for finding a solution. I won’t surrender (for now).

Only to get hold on the command line tools of CUPS the CUPS Snap is really overkill. It contains the CUPS daemin, its web interface, larger packages for the rendering, especially Ghostscript and QPDF, and also cups-browsed. I also do not know what stage-snaps: [cups] exactly does, whether it simply adds the files of the staged Snap or whether it activates all functionality of it (fire up an own copy of the contained daemons). So I recommend stage-packages: [cups-client] here to stage only the Debian package with the command line tools.

2 Likes

a stage snap only adds the contents but not the startup files or anything from the apps: section of the snap you include. it is good to get the binaries you want from the snap you stage, but you have to care for i.e. starting a daemon yourself in case you want this.

1 Like

Thanks, so the CUPS Snap is still overkill here as it contains the unnecessary executables cupsd, cups-browsed, gs, CUPS filters, and other auxiliary files … The Debian package cups-client actually contains only the CLI tools of CUPS.

1 Like

To be able to do administrative tasks on CUPS (creating/modifying/removing queues, changing server settings, deleting someone else’s jobs, …) out of a Snap, independent which type of app (GUI, CLI, daemon, …) one has to plug cups-control, and NOT cups. The cups interface allows only listing printers, options, and jobs, printing jobs. and deleting one’s own jobs. Therefore cups-control is a “dangerous” interface which needs manual connection or permission of the Snap Store team for auto-connection, in contrary to cups being a “safe” interface which just auto-connects.

Note also that the command line tool lpinfo, even being totally read-only, is an administrative tool and its operations (list available devices, list available drivers) are considered administrative and therefore you need to plug cups-control to use this tool or do its operations via CUPS API or equivalent IPP requests to the CUPS daemon out of a Snap.

If you see a non-administrartive operation getting blocked or any operation from a classically installed tool or application, this is a bug, please report it.

Thank you for all this information. So I was on the right way using the cups-control interface and actually is working fine on Ubuntu 20.04. In fact, my printer-admin snap, after running the command snap connect printer-admin:cups-control gets the right access to the cups admin tools. However, when I install my snap on Ubuntu Core, I cannot connect it to the cups-control interface due to this error: error: snap "snapd" has no "cups-control" interface slots.

So, it might be that snapd behaves differently on Ubuntu Core. I believe there is no issue with cups snap itself (but I might be wrong).

Ubuntu Core is supposed to not have CUPS included in the immutable core and as it is the immutable distro Ubuntu Core, it cannot have the Debian package of CUPS installed. Therefore the snapd of Ubuntu Core having a cups-control slot does not make sense. The only way to have CUPS on Ubuntu Core is to have the CUPS Snap installed (I hope you have done so, if not, please install it).

The CUPS Snap needs a slot for administrative requests from other Snaps, this I really need to investigate and if this is missing, it is actually a bug.

To start the investigations I want you to try the following (on Ubuntu Core):

snap connect printer-admin:cups-control cups:cups-control

First, post the terminal output of this command here. If what you got is not an error message, try out whether your printer-admin is able to do administrative operations with the snapped CUPS. Please tell your results here, and also post the error messages in case of a failure. Also attach your CUPS error_log here, which is the following file:

/var/snap/cups/current/var/log/error_log

Independent whether you succeed to do administrative operations after doing the command above, run also the following command

snap connect printer-admin:cups-control cups:cups-server

and proceed as I described above. Does this also work?

Background: The slot named cups-server of the CUPS Snap I have introduced as an internal interface for the components of the CUPS Snap for a cups-control plug connecting to it. If the first or both of the above commands fail, I will need a way to get a working cups-control slot added to the CUPS Snap, assuring that there is no clash with the cups-control slot of snapd running on classic distros.

Also a Snap plugging cups-control and having gotten the auto-connect permission would need to plug snapd’s cups-control slot on a classic distro and the CUPS Snap’s cups-control slot on an all-Snap (Ubuntu Core) distro. Perhaps here also work on snapd would be needed.

Thanks mate. Yes, absolutely I have installed the cups snap on Ubuntu Core because, as you said, CUPS is not included in the immutable core of the OS.

I have investigated the things you mentioned.

On Ubuntu Core I ran:

snap connect printer-admin:cups-control cups:cups-control

and I got the same error:

error: snap "cups" has no slot named "cups-control"

Since my snap runs automatic checks using some cups admin commands, the log file /var/snap/cups/current/var/log/error_log repeatedly shows this:

D [26/Jun/2023:23:36:16 +0200] [Client 12243] POST / HTTP/1.1
D [26/Jun/2023:23:36:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [26/Jun/2023:23:36:16 +0200] [Client 12243] Read: status=200, state=6
D [26/Jun/2023:23:36:16 +0200] [Client 12243] Authorized as root using PeerCred.
D [26/Jun/2023:23:36:16 +0200] [Client 12243] 2.0 CUPS-Get-Devices 1
D [26/Jun/2023:23:36:16 +0200] CUPS-Get-Devices
D [26/Jun/2023:23:36:16 +0200] cupsdIsAuthorized: username="root"
D [26/Jun/2023:23:36:16 +0200] [Client 12243] AppArmor profile is 'snap.printer-admin.printer-init'.
E [26/Jun/2023:23:36:16 +0200] [Client 12243] Unable to check snap context: (null): error running snapctl: cannot use --apparmor-label check with cups:cups-control
E [26/Jun/2023:23:36:16 +0200] [Client 12243] Returning HTTP Forbidden for CUPS-Get-Devices (no URI) from localhost
D [26/Jun/2023:23:36:16 +0200] [Client 12243] cupsdSendHeader: code=403, type="text/html", auth_type=0
D [26/Jun/2023:23:36:16 +0200] [Client 12243] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [26/Jun/2023:23:36:16 +0200] [Client 12243] Closing connection.
D [26/Jun/2023:23:36:16 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"

I confirm that connecting to the cups-server interface works. I ran the command:

snap connect printer-admin:cups-control cups:cups-server

and as you can see I successfully connect to the cups-server interface

Interface           Plug                              Slot                 Notes
cups                printer-admin:cups                cups:cups            -
cups-control        printer-admin:cups-control        cups:cups-server     manual

Now something seems happening but the server closes the connection with the client due to broken pipe errors:

D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Accepted from localhost (Domain)
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Waiting for request.
D [27/Jun/2023:00:08:16 +0200] Expiring subscriptions...
D [27/Jun/2023:00:08:16 +0200] [Client 12260] POST / HTTP/1.1
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Active clients"
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Read: status=200, state=6
D [27/Jun/2023:00:08:16 +0200] [Client 12260] No authentication data provided.
D [27/Jun/2023:00:08:16 +0200] [Client 12260] 2.0 CUPS-Get-Devices 1
D [27/Jun/2023:00:08:16 +0200] CUPS-Get-Devices
D [27/Jun/2023:00:08:16 +0200] cupsdIsAuthorized: username=""
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Returning HTTP Unauthorized for CUPS-Get-Devices (no URI) from localhost
D [27/Jun/2023:00:08:16 +0200] [Client 12260] cupsdSendHeader: code=401, type="text/html", auth_type=0
D [27/Jun/2023:00:08:16 +0200] [Client 12260] WWW-Authenticate: Basic realm=\"CUPS\", PeerCred, Local trc=\"y\"
D [27/Jun/2023:00:08:16 +0200] [Client 12260] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:00:08:16 +0200] [Client 12260] Closing connection.
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:00:08:16 +0200] [Client 12261] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:00:08:16 +0200] [Client 12261] Accepted from localhost (Domain)
D [27/Jun/2023:00:08:16 +0200] [Client 12261] Waiting for request.
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Active clients"
D [27/Jun/2023:00:08:16 +0200] [Client 12262] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:00:08:16 +0200] [Client 12262] Accepted from localhost (Domain)
D [27/Jun/2023:00:08:16 +0200] [Client 12262] Waiting for request.
D [27/Jun/2023:00:08:16 +0200] [Client 12261] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:00:08:16 +0200] [Client 12261] Closing connection.
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Accepted from localhost (Domain)
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Waiting for request.
D [27/Jun/2023:00:08:16 +0200] [Client 12262] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:00:08:16 +0200] [Client 12262] Closing connection.
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:00:08:16 +0200] [Client 12263] POST / HTTP/1.1
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Read: status=200, state=6
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Authorized as root using PeerCred.
D [27/Jun/2023:00:08:16 +0200] [Client 12263] 2.0 CUPS-Get-Devices 1
D [27/Jun/2023:00:08:16 +0200] CUPS-Get-Devices
D [27/Jun/2023:00:08:16 +0200] cupsdIsAuthorized: username="root"
D [27/Jun/2023:00:08:16 +0200] [Client 12263] AppArmor profile is 'snap.printer-admin.printer-init'.
E [27/Jun/2023:00:08:16 +0200] [Client 12263] Unable to check snap context: (null): error running snapctl: cannot use --apparmor-label check with cups:cups-control
E [27/Jun/2023:00:08:16 +0200] [Client 12263] Returning HTTP Forbidden for CUPS-Get-Devices (no URI) from localhost
D [27/Jun/2023:00:08:16 +0200] [Client 12263] cupsdSendHeader: code=403, type="text/html", auth_type=0
D [27/Jun/2023:00:08:16 +0200] [Client 12263] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:00:08:16 +0200] [Client 12263] Closing connection.
D [27/Jun/2023:00:08:16 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:00:08:17 +0200] Expiring subscriptions...

One further idea to solve the cups-control dilemma with classic distro versus Core:

snapd which provides the cups-control slot :cups-control provides it only if (I do not which criteria here is actually used) it is running on a classic distro OR if a classic CUPS installation (DEB/RPM/source) exists. This means that snapd simply does not have a :cups-control slot on Ubuntu Core.

What it should do is in case of not finding an evidence of a classic distro/classic CUPS to check for the CUPS Snap and connect the domain socket of the CUPS Snap with the :cups-control slot

Can you tell me which version of the CUPS Snap you are using (snap list | grep cups)?

You are right. I don’t know either what snapd evaluates before making available the cups-control slot. For sure on Ubuntu 20.04, which comes with CUPS on board, snapd provides me the cups-control slot. I will conduct tests on other versions of Ubuntu and using other distros as well.

Definitely I will test this workaround too and I let you know.

I’m using this CUPS snap version:

cups 2.4.6-1 962 latest/stable openprinting** -

This is the very latest one.

This is an excerpt of your posted error_log. Have a look at the third line of it (Unable to ...). This seems to be a bug in libsnapd-glib, in the client code for a snapped application to talk with snapd. It seems to have appeared in newer libsnapd-glib versions as they come with core22, the snapd of core20 was working correctly here. I have observed the same bug when I recently updated the CUPS Snap still before switching to core20 but using a too new libsnapd-glib. After using the correct libsnapd-glib the bug went away, and then some days ago I switched to core22 and now the bug shows up again.

@drcoccodrillus, could you please switch the “cups” Snap to the Edge channel and let it update to 2.4.6-2 (will arrive in the Snap Store in around 15 min, at least for amd64).

Do

sudo snap refresh --edge cups

Check the version via

snap list | grep cups

Once on the CUPS Snap 2.4.6-2 please repeat the test of

snap connect printer-admin:cups-control cups:cups-server

Does your app (and all steps I asked for) now work?

Here I am.

I installed the new cups snap from the edge channel.

This is the output when running snap list | grep cups

cups 2.4.6-2 965 latest/edge openprinting** -

Now my printer-admin snap seems working fine. In fact, I see the result of lpinfo -v appearing in my log file:

cat /var/snap/gaap-utils/common/printer_init.log

Tue Jun 27 14:01:05 CEST 2023 - usb://C56/Thermal%20Printer?serial=<UNUSED> - printer initiated

The above printer URI in the log file is coming from lpinfo. For what I see, I believe that things are working now.

Furthermore, from /var/snap/cups/current/var/log/error_log now I see nice things:

D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:14:20:49 +0200] [Client 405] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:14:20:49 +0200] [Client 405] Accepted from localhost (Domain)
D [27/Jun/2023:14:20:49 +0200] [Client 405] Waiting for request.
D [27/Jun/2023:14:20:49 +0200] Expiring subscriptions...
D [27/Jun/2023:14:20:49 +0200] [Client 405] POST / HTTP/1.1
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Active clients"
D [27/Jun/2023:14:20:49 +0200] [Client 405] Read: status=200, state=6
D [27/Jun/2023:14:20:49 +0200] [Client 405] No authentication data provided.
D [27/Jun/2023:14:20:49 +0200] [Client 405] 2.0 CUPS-Get-Devices 1
D [27/Jun/2023:14:20:49 +0200] CUPS-Get-Devices
D [27/Jun/2023:14:20:49 +0200] cupsdIsAuthorized: username=""
D [27/Jun/2023:14:20:49 +0200] [Client 405] Returning HTTP Unauthorized for CUPS-Get-Devices (no URI) from localhost
D [27/Jun/2023:14:20:49 +0200] [Client 405] cupsdSendHeader: code=401, type="text/html", auth_type=0
D [27/Jun/2023:14:20:49 +0200] [Client 405] WWW-Authenticate: Basic realm=\"CUPS\", PeerCred, Local trc=\"y\"
D [27/Jun/2023:14:20:49 +0200] [Client 405] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:14:20:49 +0200] [Client 405] Closing connection.
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:14:20:49 +0200] [Client 406] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:14:20:49 +0200] [Client 406] Accepted from localhost (Domain)
D [27/Jun/2023:14:20:49 +0200] [Client 406] Waiting for request.
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Active clients"
D [27/Jun/2023:14:20:49 +0200] [Client 407] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:14:20:49 +0200] [Client 407] Accepted from localhost (Domain)
D [27/Jun/2023:14:20:49 +0200] [Client 407] Waiting for request.
D [27/Jun/2023:14:20:49 +0200] [Client 406] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:14:20:49 +0200] [Client 406] Closing connection.
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:14:20:49 +0200] [Client 408] Server address is "/var/snap/cups/common/run/cups.sock".
D [27/Jun/2023:14:20:49 +0200] [Client 408] Accepted from localhost (Domain)
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for request.
D [27/Jun/2023:14:20:49 +0200] [Client 407] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:14:20:49 +0200] [Client 407] Closing connection.
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:14:20:49 +0200] [Client 408] POST / HTTP/1.1
D [27/Jun/2023:14:20:49 +0200] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [27/Jun/2023:14:20:49 +0200] [Client 408] Read: status=200, state=6
D [27/Jun/2023:14:20:49 +0200] [Client 408] Authorized as root using PeerCred.
D [27/Jun/2023:14:20:49 +0200] [Client 408] 2.0 CUPS-Get-Devices 1
D [27/Jun/2023:14:20:49 +0200] CUPS-Get-Devices
D [27/Jun/2023:14:20:49 +0200] cupsdIsAuthorized: username="root"
D [27/Jun/2023:14:20:49 +0200] [Client 408] AppArmor profile is 'snap.printer-admin.printer-init'.
D [27/Jun/2023:14:20:49 +0200] [Client 408] Snap with cups-control plug - allowed.
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[0] = "/snap/cups/965/lib/cups/daemon/cups-deviced"
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[1] = "1"
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[2] = "0"
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[3] = "15"
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[4] = "584788"
D [27/Jun/2023:14:20:49 +0200] [CGI] argv[5] = "requested-attributes=all"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[0] = "CUPS_CACHEDIR=/var/snap/cups/965/var/cache"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[1] = "CUPS_DATADIR=/snap/cups/965/share/cups"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[2] = "CUPS_DOCROOT=/snap/cups/965/share/cups/doc"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[3] = "CUPS_REQUESTROOT=/var/snap/cups/965/var/spool"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[4] = "CUPS_SERVERBIN=/snap/cups/965/lib/cups"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[5] = "CUPS_SERVERROOT=/var/snap/cups/common/etc/cups"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[6] = "CUPS_STATEDIR=/var/snap/cups/965/var/run"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[7] = "HOME=/var/snap/cups/965/var/spool/tmp"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[8] = "LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/cups/965/lib:/snap/cups/965/usr/lib:/snap/cups/965/lib/x86_64-linux-gnu:/snap/cups/965/usr/lib/x86_64-linux-gnu"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[9] = "PATH=/snap/cups/965/lib/cups/filter:/snap/cups/965/usr/sbin:/snap/cups/965/usr/bin:/snap/cups/965/sbin:/snap/cups/965/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[10] = "SERVER_ADMIN=root@ubuntu"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[11] = "SOFTWARE=CUPS/2.4.6"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[12] = "TMPDIR=/var/snap/cups/965/var/spool/tmp"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[13] = "USER=root"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[14] = "CUPS_MAX_MESSAGE=2047"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[15] = "CUPS_SERVER=/run/cups/cups.sock"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[16] = "CUPS_ENCRYPTION=IfRequested"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[17] = "IPP_PORT=631"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[18] = "AUTH_TYPE=PeerCred"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[19] = "LANG=en.UTF8"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[20] = "REDIRECT_STATUS=1"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[21] = "GATEWAY_INTERFACE=CGI/1.1"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[22] = "SERVER_NAME=localhost"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[23] = "SERVER_PORT=631"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[24] = "REMOTE_ADDR=localhost"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[25] = "REMOTE_HOST=localhost"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[26] = "SCRIPT_NAME=/"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[27] = "SCRIPT_FILENAME=/snap/cups/965/share/cups/doc/"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[28] = "REMOTE_USER=root"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[29] = "SERVER_PROTOCOL=HTTP/1.1"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[30] = "HTTP_USER_AGENT=CUPS/2.4.1 (Linux 5.15.0-75-generic; x86_64) IPP/2.0"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[31] = "REQUEST_METHOD=POST"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[32] = "CONTENT_LENGTH=72"
D [27/Jun/2023:14:20:49 +0200] [CGI] envp[33] = "CONTENT_TYPE=application/ipp"
D [27/Jun/2023:14:20:49 +0200] cupsdAddCert: Adding certificate for PID 22039
D [27/Jun/2023:14:20:49 +0200] [CGI] Started /snap/cups/965/lib/cups/daemon/cups-deviced (PID 22039)
I [27/Jun/2023:14:20:49 +0200] [Client 408] Started "/snap/cups/965/lib/cups/daemon/cups-deviced" (pid=22039, file=26)
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/beh (PID 22040)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/dnssd (PID 22041)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/driverless (PID 22042)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/driverless-fax (PID 22043)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/http (PID 22044)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/https (PID 22045)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/implicitclass (PID 22046)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/ipp (PID 22047)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/ipps (PID 22048)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/lpd (PID 22049)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/parallel (PID 22050)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/proxy (PID 22051)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/serial (PID 22052)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/snmp (PID 22053)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/socket (PID 22054)
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Started backend /snap/cups/965/lib/cups/backend/usb (PID 22056)
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_LENGTH, data_remaining=2147483647, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] Script header: Content-Type: application/ipp
D [27/Jun/2023:14:20:49 +0200] [Client 408] Script header:
D [27/Jun/2023:14:20:49 +0200] [Client 408] Sending status 200 for CGI.
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdSendHeader: code=200, type="(null)", auth_type=0
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"beh\"...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22040 (beh) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [CGI] /snap/cups/965/lib/cups/backend/driverless-fax: 14: //lib/cups/backend/driverless: not found
E [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22043 (driverless-fax) stopped with status 127!
D [27/Jun/2023:14:20:49 +0200] [CGI] Unable to create Avahi client.
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"https\"...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22041 (dnssd) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22045 (https) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"ipps\"...
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"socket\"...
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"ipp\"...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22051 (proxy) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22048 (ipps) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22047 (ipp) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22054 (socket) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"lpd\"...
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"http\"...
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22046 (implicitclass) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22044 (http) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22049 (lpd) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22050 (parallel) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22052 (serial) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [CGI] Loading USB quirks from \"/snap/cups/965/share/cups/usb\".
D [27/Jun/2023:14:20:49 +0200] [CGI] Loaded 119 quirks.
D [27/Jun/2023:14:20:49 +0200] [CGI] list_devices
D [27/Jun/2023:14:20:49 +0200] [CGI] libusb_get_device_list=5
D [27/Jun/2023:14:20:49 +0200] [CGI] Started ippfind (PID 22059)
D [27/Jun/2023:14:20:49 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:49 +0200] [CGI] Flushed attributes...
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] Found device \"usb://C56/Thermal%20Printer?serial=<UNUSED>\"...
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:49 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:49 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22056 (usb) exited with no errors.
D [27/Jun/2023:14:20:49 +0200] [CGI] ippfind: Unable to use Bonjour: Daemon not running
E [27/Jun/2023:14:20:49 +0200] [CGI] ippfind (PID 22059) stopped with status 2!
E [27/Jun/2023:14:20:49 +0200] [cups-deviced] PID 22042 (driverless) stopped with status 2!
D [27/Jun/2023:14:20:50 +0200] Expiring subscriptions...
D [27/Jun/2023:14:20:51 +0200] [cups-deviced] PID 22053 (snmp) exited with no errors.
D [27/Jun/2023:14:20:51 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:51 +0200] Expiring subscriptions...
D [27/Jun/2023:14:20:51 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:51 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:51 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:51 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:51 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:51 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:51 +0200] [Client 408] CGI data ready to be sent.
D [27/Jun/2023:14:20:51 +0200] PID 22039 (/snap/cups/965/lib/cups/daemon/cups-deviced) exited with no errors.
D [27/Jun/2023:14:20:51 +0200] [Client 408] con->http=0x555e4babd880
D [27/Jun/2023:14:20:51 +0200] [Client 408] cupsdWriteClient error=0, used=0, state=HTTP_STATE_POST_SEND, data_encoding=HTTP_ENCODING_CHUNKED, data_remaining=0, response=(nil)(), pipe_pid=22039, file=26
D [27/Jun/2023:14:20:51 +0200] [Client 408] Waiting for CGI data.
D [27/Jun/2023:14:20:51 +0200] [Client 408] Sending 0-length chunk.
D [27/Jun/2023:14:20:51 +0200] [Client 408] Flushing write buffer.
D [27/Jun/2023:14:20:51 +0200] [Client 408] New state is HTTP_STATE_WAITING
D [27/Jun/2023:14:20:51 +0200] [Client 408] Waiting for request.
D [27/Jun/2023:14:20:51 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Active clients"
D [27/Jun/2023:14:20:51 +0200] [Client 408] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [27/Jun/2023:14:20:51 +0200] [Client 408] Closing connection.
D [27/Jun/2023:14:20:51 +0200] cupsdSetBusyState: newbusy="Not busy", busy="Not busy"
D [27/Jun/2023:14:20:52 +0200] Expiring subscriptions...

I will keep developing other features of my snap based on cups admin utilities.

2 Likes

One important note: I have renamed the plugs and slots for the cups-control interfaces of the CUPS Snap in the --edge channel. The slot is now named cups-control, so the manual connection command changes to

snap connect printer-admin:cups-control cups:cups-control

This renaming is to improve interface intuitiveness and consistency for users of client Snaps.

1 Like

The actual solution of this problem will be discussed in this thread. Please continue discussion there. Thanks.

1 Like