Cool Solution - Printing on a Thin Client
From Univention Wiki
This article shows how to use a printer connected to an UCC thin client.
We will see how to enable support for local printers on the thin client and manually configure printer redirection from an UCS print server, or for its use from a remote XenApp session.
- 1 Introduction
- 2 Thin client as a local print server
- 3 Configuration on a UCS print server
- 4 References
Univention Corporate Client (UCC) is a solution for the central operation and administration of desktop PCs, notebooks, thin clients or kiosk systems. Clients are typically deployed (rolled out) via images. A thin client image offers a minimal desktop for remote sessions (e.g. RDP, Citrix XenApp or UCS).
Redirecting a printer on the client computer to a print server would allow printing jobs from other computers (eg. RDP server) to be printed on the thin client. This is also useful in a Home Office environment for example.
Thin client as a local print server
The idea is to install a local printing server (CUPS) on the thin client. It will manage printers that can then be used from a remote session or shared with a remote printing server.
Getting CUPS into the thin client
We will add support for local printers into the default thin-client image. So CUPS should be installed, configured (at least one local user must be allowed to add printers and share them) and set up as a service. There are several ways to add CUPS into an image, these are some of them, next section shows how to install cups on an existing image:
- without building a new UCC image
- Install CUPS via Policy, only if you won't share a local printer for other thinclients (See UCC Manual - UCC Software updates / Installing additional software section) Packages: cups cups-bsd
- The client(s) can be rebooted with rw support, updated, configured CUPS and set back to ro (See UCC Manual - UCC Persistent configuration and Overlayfs sections)
- with building a new UCC image
- The image is already built, so it should be modified and reloaded to the client(s) (explained next).
- A new image that includes the cups package can be rebuilt and rolled out to the client(s) (by adding the package 'cups' to the list, see UCC Manual - Generation of adapted images)
Modification of the image
In next examples we will install the needed extra packages into an existing image. Follow the instruction in this article to open an existing image for modification.
CUPS will use around 50MB once installed, but for the installation process, around 200MB free are needed.
~# apt-get -y --force-yes --no-install-recommends install cups cups-bsd
- Note I: cups-bsd for XenApp. The previous command installs BSD commands as well, useful to print from XenApp sessions. Citrix Receiver uses the lpr command for remote jobs, which is part of cups-bsd (a suggested package).
- Note II: dpkg Errors. dpkg will try to start the cups service after installation, showing errors:
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused invoke-rc.d: initscript cups, action "start" failed.
This is not a real problem in the chroot environment. The cups service should start properly once is rolled out and booted (the post-installation script invokes Upstart outside the chroot: UCS, which instead uses Init more here).
optionally, clean out retrieved packages:
~# apt-get clean
Since the service is not running, we won't be able to use cupsctl within the chroot environment, instead we will edit the configuration file:
~# nano -w /mnt/img/etc/cups/cupsd.conf
To allow other to see local printers: Change Browsing to 'On' and add the following lines
Port 631 Listen /var/run/cups/cups.sock
# Show shared printers on the local network. Browsing On BrowseOrder allow,deny BrowseAllow all BrowseRemoteProtocols CUPS dnssd BrowseAddress @LOCAL BrowseLocalProtocols CUPS dnssd
To share printers to the local network or to other networks, go to '<Location />' and change Allow to '@LOCAL' or to 'all'
# Restrict access to the server... <Location /> Order allow,deny Allow all </Location>
and comment out the lines 'Order allow,deny' in <Location /admin> and <Location /admin/conf>
In nano, use Ctrl X to exit, answer "yes" to save and hit ENTER
Create a local administrator
If you want to allow users to manage printers, grant a local user permissions to administer CUPS: (the local root account is also a CUPS administrator)
~# useradd -s /bin/false -G lpadmin cupsadmin ~# echo cupsadmin:Adm1n*pr1nt | chpasswd --crypt-method SHA512
- Note III: sync disks. Don't forget to run 'sync' to force a commit before leaving the chroot environment ('exit').
~# sync && exit
Unmount the image, it can now be rolled-out to the thin client, and restarted.
~# umount /mnt/img
Configuration on a UCS print server
By now the thin client should have an updated image with a CUPS server. Please verify it by opening http://localhost:631 on the thin client. Steps to add a printer, share it with the network and use it from a remote print server are described next.
Plug in and set up a local print queue
CUPS is able to recognize and manage USB/LPT printers connected locally. To test it, please make sure your printer is turned on and plugged.
Go to Administration on the Web interface. CUPS will ask for an authorized username (cupsadmin) and its password (Adm1n*pr1nt).
Add a new printer manually
In normal environments this process is automatically done by CUPS. You can find your printer under Printers.
If not: Under Printers click Add printer.
After that, your printer should appear under Local Printers:, please select it and click Continue
On the second prompt make sure you thick off the box for Sharing:  Share This Printer. Follow the prompts and choose the family of drivers for your printer. (See: CUPS documentation for further details).
Since it's shared with IPP, the local printer can now process printing jobs from other computers!
In order to save this configuration, the image must be saved with these new CUPS configuration files (mainly 'cupsd.conf' in /etc/cups. See the UCC doc as well: UCC Persistently stored system settings)
Set up the remote server and send printing jobs
With a local printing queue accessible from the network, the UCS Master can set up the printer on the print server and share it from there. We can follow the instructions on UCS Creating a printer share.
We will need:
- The name of the printer you used on the thin client (here: hp-4960).
- The IP addresses or FQDN of both, print server (here: server1.example.qa) and thin client (here: thinclient04.example.qa)
- A name for the new UCS-shared printer (here: hp4960ex)
Basically, we are telling the UCS master server that server1.example.qa will share a printer that is on thinclient04.example.qa. Such queue exists as ipp://thinclient04.example.qa/printers/hp-4960 and is going to be available to the UCS network as hp4960ex