Before extrapolating all the details, here is a brief summary of the problem task I addressed as well as the solution, hopefully allowing you to decide if this article is what you are looking for. Specifically, if you are reading this now, you are likely trying to print from a remote Window machine on your Linux-based client. I got it working!
- At my Ubuntu PC, I wanted to print from a remote Windows machine, connected via Citrix.
- On a Windows PC connecting to a remote Windows machine via Citrix, this is effectively automatic and straightforward.
- From Ubuntu, the remote Windows machine did not recognize my local Brother printer.
- You must set up your local printer via CUPS on your local Ubuntu client.
- You must also install a legacy HP PostScript (PS) printer driver on the remote Windows machine.
- You may need to experiment with the CUPS printer driver setup to find the right configuration.
As stated above, I simply wanted to print from a remote Windows machine on my Linux PC. To set the stage, here are the pertinent physical and virtual assets involved:
- My Linux PC - I have a quad-core Intel i7-8700K-based PC as my main home computer. I have both Windows 10 and Linux installed (dual-boot). My Linux distribution and version is Ubuntu 20.04 LTS.
- My Printer - My home printer is a Brother MFC-J995DW. It connects wirelessly via my home network to my PC.
- Remote Windows Machine - I wanted to print from a remote cloud-based Windows 10 desktop. I have no issues connecting to this remote machine in either my Windows or Ubuntu PC setups.
- Citrux Workspace - I am using Citrix Workspace in both Windows and Ubuntu to connect to the remote Windows machine.
In my Windows build, I can print from the remote machine via Citrix with no effort at all. Citrix Workspace automatically configures my local Brother printer as an available printer on the remote machine. Absolutely no manual configurations are necessary.
At this point you may be wondering, if I can print from Windows but not Ubuntu, why not just use Windows whenever I need to Citrix print? A very fair question, considering that my need to print from Citrix is extremely rare. In the longer-term grand scheme, I hope to use Linux as my exclusive home PC. So understanding how to address even relatively small matters such as printing are heavily important to me if I am ever going to attain my Linux-only goal.
Why I want to run an exclusive Linux-based home PC is likely the topic for another article. I built my current PC in mid-2018; I cannot believe it will be four years old this year! I am working on a PC "mid-life" refresh, which may also become the topic of an article. I hope to get at least 2-3 more years out of my PC before I build the next, which, if things go according to plan, will be fully Linux-based.
Confused by the Citrix Instructions
So Windows-based local printing is fine, but I could not even see my local Brother printer on the remote Windows machine when I connected by Citrix Workspace in Ubuntu. Troubleshooting began.
Results from Internet searches for "linux citrix printing" all seem to funnel eventually to this Citrix support article entitled, "Citrix Workspace App for Mac and Linux fail to Redirect Local printer to Citrix Sessions." Upon finding this I thought, great, this should be a straightforward step-by-step to fix Linux printing, and I'll be on my way. But this cautionary statement made me overthink the article and I was thoroughly confused, initially:
"This article is intended for Citrix administrators and technical teams only. Non-admin users must contact their company’s Help Desk/IT support team..."
Administrators? Technical team? I immediately thought this meant needing to modify server-side Citrix settings or policies I have no control over. The subsequent instructions were about installing an outdated printer driver in Window, which also confused me as I (incorrectly) assumed the solution would lie exclusively in my Ubuntu system.
Foolishly, I abandoned this article and tried other search vectors. I went on an extreme tangent and started reading about Citrix's Linux Virtual Delivery Agent. To say this setup is technically dense is an understatement and is truly intended for Citrix professionals. I just wanted to print! I was not even going to attempt a VDA setup - all risk and likely no reward. At the time I nearly decided to abandon my aspiration of local Citrix Linux printing, as it seemed far more hassle than it would ever be worth (and ultimately this VDA setup would have been completely wrong).
Understanding the Key - CUPS
I cannot recall how I found it, but through all my search variations, I finally learned about CUPS - Common UNIX Printing System. As explained on Wikipedia, CUPS is:
"...a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer."
Linux of course being Unix-like, this immediately made me realize there must be a connecting between enabling a CUPS printer setup and Citrix printing in Linux. I revisited that original Citrix article on Linux local printer redirects failing, and the light bulb started to go on for me when I re-read about the Citrix Universal Printer Driver (UPD).
The Citrix UPD is a key concept here. As explained in an article at Gotham Technology Group, "Citrix UPD relies on a series of printer drivers to be installed on the VDA machine." In my case, the "VDA" is the remote Windows 10 desktop I wanted to print from. The Gotham article further explains (emphasis mine):
"The HP Color LaserJet 2800 Series PS printer driver from Hewlett Packard is used by Mac and Linux clients, which require PostScript printer format. In Windows 7 and 2008 R2, this printer driver was included in the operating system. Starting with Windows 10 and Window 2012, this print driver is no longer included in the operating system. During the client printer mapping process, if this driver is missing, the printer fails to map."
This is the moment I truly understood what was going on. For whatever reason (bad design and planning?), the Citrix Workspace app, or some subordinate component, is relying on a completely archaic HP printer driver to properly map printers on remote machines. So the original Citrix instructions now made complete sense to me - the HP 2800 driver must be installed on the remote Windows machine to allow the local Linux Citrix client to map the local printer!
And that "administrator" cautionary alert made sense to me as well now. Yes, you need privileges on the remote Windows machine to install printer drivers. Fortunately, though I am not an admin on the remote machine, I was still able to install the HP 2800 driver.
Finding the Right CUPS Printer Driver Configuration
Getting the HP 2800 driver installed on the remote Windows machine, however, was only step one of two to fully enabled printing from Linux. This first part effectively ensured that the remote machine would be able to understand and process the printer mapping requests coming from the local Linux client via Citrix Workspace. The other and more arduous task was to set up the right CUPS printer configuration in Ubuntu.
This should be mostly the same across Linux distributions, but Ubuntu has its own article explaining the CUPS Printer Server, how to install CUPS, though I performed no apt install specifically for CUPS. I did, however, install the Debian-based "Driver Install Tool" from Brother for my printer. The description for this tool explains:
"The tool will install LPR, CUPSwrapper driver and scanner driver (for scanner models)."
I assume this tool installed the needed CUPS Print Server if it was not already present.
To access your local CUPS Printer server, you can either go to the "Additional Printer Settings" in Ubuntu's Setup or access access the CUPS Printer Server directly from http://localhost:631. In playing around with both the setup GUI and localhost address, the latter URL option is far more flexible and configurable, a requirement I soon discovered for the next setup tasks.
Going the http://localhost:631 route, I added a few test printer drivers. My Brother printer was discoverable on my network, so after several seconds, a few Brother options always appeared.
After I "added" these printers in CUPS (and I could see them in Ubuntu's Printer setup), I connected to the remote Windows desktop via Linux Citrix Workspace. Initially, it appeared to be a success, as I could see the new printers I created in Ubuntu! However, this was not the end, for neither of the two printers did anything, they just gave printer errors.
Preparing for All Combinations
I kept mixing-and-matching the discoverable printers/protocols with the available drivers, but could not find one that worked. A few spat out blank pages from my printer, which I took as a good sign, demonstrating there was some sort of Ctrix-to-Ubuntu-to-printer communication happening.
Here was the moment I needed to determine how to effectively troubleshoot finding the correct CUPS configuration. CUPS showed three available versions of my Brother printer from which I could choose up to five different drivers. So a possible 15 combinations!
Borrowing a technique I use in astrophotography for finding the best exposure and ISO settings for the planets, I decided to bite the bullet and set up every printer configuration. It turned out to be only 14. Here are the details of all 14 test printer configurations in my Ubuntu CUPS Printer Server:
You can see that some of the printers defaulted to the "local" printer, and some had the same description which could only be distinguished by their connection strings, which are not shown.
All five of the 01-05 printers connected via a dnssd:// string. 01 was a "local" printer and the middle three leveraged "driverless" CUPS drivers. The 05 printer used the HP Color LaserJet 2800 PostScript driver (i.e. I wanted to see if matching the client driver to the remote HP driver worked).
The 11-14 printers used either an ldp:// or ipp:// connection string.
The 21-25 printers used an ipp:// connection string.
These different network protocols are explained at cups.org. In quick summary, dnssd is a commonly-supported protocol known as Bonjour, IPP is Internet Printing Protocol, and LDP is the Line Printer Daemon Protocol.
Testing the Printers
Having added all of these printers, my methodology was to log into the remote Windows machine via Citrix on Ubuntu and try out every available printer, one by one, against a remote PDF file. I recorded the results as follows, noting the printers that worked with a double asterisk:
- TESTPRINTER01 - queued to printer but quickly ended, no printer activity
- **TESTPRINTER02 - complete success!
- **TESTPRINTER03 - complete success!
- **TESTPRINTER04 - complete success!
- TESTPRINTER05 - stuck at printing/nothing happened
- TESTPRINTER11 - printer error within Ubuntu
- TESTPRINTER12 - printer error within Ubuntu
- TESTPRINTER13 - printer error within Ubuntu
- TESTPRINTER14 - fast queue complete but nothing happened at printer
- TESTPRINTER21 - queue appeared to finish, but nothing happened at printer
- TESTPRINTER22 - appeared to work, but slow, unclear if this was a successful print from this queue or a prior delayed job
- TESTPRINTER23 - appeared to work, but slow, unclear if this was a successful print from this queue or a prior delayed job
- **TESTPRINTER24 - complete success!
- TESTPRINTER25 - fast queue complete but nothing happened at printer
In summary of the printer drivers that worked:
- All of the Bonjour printers using the appropriate "driverless" CUPS driver for my Brother printer worked.
- The IPP printer using the appropriate "driverless" CUPS driver for my Brother printer worked.
How It Looked in Citrix
On the remote Windows desktop, all of my local Ubuntu CUPS printers were visible in printer drop-downs:
Note the designation for each, labeled as Citrix Universal Printer Drivers / PostScript. Interestingly, checking on the advanced properties, each printer (which all map to my local Brother printer) is designated as an HP Color LaserJet 2800 printer:
Cleanup and Future Plans
If you would like me to clarify any part of my setup, or explain a facet I did not cover, please leave a comment down below.
Important to note is that whenever I performed a new CUPS printer setup locally, I restarted the remote Windows machine. I don't know if this was truly necessary, as some of my later tests indicated that new CUPS printers were detected whenever the Citrix connection was re-established, though the prior printers (like all the test printers) remained. The remote restart cleared out locally-deleted CUPS printers from the remote machine.
I plan to try this general procedure on my MacBook, since the Citrix instructions indicate this should also work for local printing in MacOS. I will create a follow-up article to show those results.
Finally, worth mentioning are my future home computing plans, barring no disruptive technology paradigms within the next two to three years. I envision my computing setup to be:
- Linux-base, likely Ubuntu, custom-built PC rig for image editing and gaming
- MacBook for remote and mobile computing
- Apple ecosystem (MacBook, iPhone, iPads) for consistency across emails, tasks, calendars, and drawing/sketching
- Some semblance of a Windows-last-resort option, using Wine in Linux, my legacy Surface laptop, a VirtualBox running Windows, or a combination of all
Perhaps this computing setup, too, will be extrapolated in a future article!