Subject: Cannot install a Samba printer

From: Richard Lawrence <[email-masked]>
Date: Wed, 21 Dec 2022 17:17:02 +0100

Dear Guix maintainers,

I have been trying to set up a Guix system install at work and have hit
a wall related to installing a Samba printer. I believe this is a bug in
the way that either CUPS or Samba are packaged in Guix (but I'm very new
to Guix, so please bear with me). Specifically, installing Samba needs
to provide a link somewhere to the smbspool program in order to make
CUPS aware of it as a backend.

Here are the steps that led me to this issue:

0) I setup CUPS to run in my OS config like:

            (service cups-service-type
                     (cups-configuration
                      (default-paper-size "A4")
                      (web-interface? #t)))

(I have also added my user to the groups "lp" and "lpadmin", though I'm
not sure if that's important.)

1) I tried to add a Samba printer using the system-config-printer program,
following the instructions from my employer 
(https://zid.univie.ac.at/uprint/anleitungen/unter-linux-installieren/).
This goes smoothly until the last step; after entering the printer name,
description, and location, and clicking "Apply", a dialog appears asking
me to authenticate. No matter what credentials I enter here (my own user
account, root's, or my samba domain credentials), this step fails with a
"client-error-not-possible" CUPS server error. No other information is
provided.  

Adding the printer through the CUPS web interface doesn't work either;
there is no option there to install a Samba printer. 

Here is what I've been able to learn through my own troubleshooting:

Elsewhere on the web, people who have the same issue generally report
that it's fixed by installing the "smbclient" package. Guix has no such
package; so I installed the "samba" package (although I do not want to
run a samba server) to get access to the client utilities. 

I made some progress by directly copying a working <Printer> config
for this printer from another machine into /etc/cups/printers.conf and
restarting CUPS. This at least added the printer to CUPS, so that I can
see it in the system-config-printer GUI and in the CUPS web interface.
In the latter, I now see a more informative error in the printer's
status field:

"Backend /gnu/store/xl7mglavpkc4gjh7m53d0wf55mifnqy3-cups-server-bin/lib/cups/backend/smb does not exist!"

The other machine where I have this printer configured is running Debian.
On Debian, installing the smbclient package creates a symlink at
/usr/lib/cups/backend/smb to /usr/bin/smbspool. This is what appears to
be missing in Guix.

The smbspool program is installed in Guix via the samba package at
/gnu/store/4fpyn089b3873ci591935nqd8d5g8zdw-samba-4.16.4/bin/smbspool.
(I can send jobs to the Samba printer on Guix if I manually call
smbspool.) But no corresponding symlink to this program is created in
the lib/cups/backend directory when the samba package is installed,
which appears to the source of the error above.

(It *could* be that the absence of this symlink is also the source of
the client-error-not-possible in the system-configure-printer GUI; I'm
not sure.)

I'm not sure what the right way to create such a symlink on Guix would
be, but it seems like its absence makes it impossible to install and use
a Samba printer.

As I said, I *believe* this is a bug in how Samba and/or CUPS is
packaged; but if there's some additional configuration I could do to get
this working, please let me know!

Many thanks for your help,
Richard