Setting up Airprint on QNAP NAS with Canon MX 870 MFC

I recently bought a QNAP TS-219 II NAS and am quite happy with it. The best thing is, that you can log in via SSH and do your own stuff. This own stuff includes installing packages using ipkg and even compiling your own code. It may not be as nice as your Ubuntu build environment, but still handy.

My Canon MX 870 multi functional device does have Ethernet and Wifi, but no Airprint support. Since the NAS is on 24/7 anyway, it is the ideal negotiator between my iOS devices and my printer. Unfortunately, the gutenprint version on the NAS is too old to support my (and many other Canon) printer – so we have to update.

To find out whether your printer is supported by gutenprint, look at the Supported Printer Page. If it is supported, you are lucky. However, it is still possible, that your *current* version of gutenprint is too old. You can find your current version of gutenprint like so:

Now go and look in the Release Notes (change the link to the latest version, start from here) of gutenprint, if support for your priner has been added on a version that is newer than the currently installed version. My printer became supported in version 5.2.7 so I had to upgrade. If your printer is supported in your release, skip directly on to Enable Airprint.

This blog post is based on the superb tutorial in the synology forum by tomas123. I had to change some elements in the (original german) tutorial to make it run on QNAP devices as well.

Installing OptWare

To do the following, you will need to have “OptWare” installed. Do that in the “QPKG Center” in the QNAP Webinterface. After installing it, you have to enable it. Furthermore, please enable the SSH access to your device.

Setting up the Build Environment

To build your own code on the QNAP, you will need compilers and other handy stuff. So first of all, log into your NAS via SSH:

This will take a while, but it is worth the wait. Now, I had to do a couple of additional steps to get anything to build.

Fix automake to avoid using threads in Perl

Open /opt/share/automake-1.12/Automake/Config.pm and set perl_threads to 0.

$ vim /opt/share/automake-1.12/Automake/Config.pm

Go to line 35 and change it to match this:

our $perl_threads = 0;

Fix autoconf to use the correct path to automake

Open /opt/bin/automake and modify the path to automake.

$ vim /opt/bin/automake

And now change line 5228 to match the following:

my $traces = ($ENV{AUTOCONF} || '/opt/bin/autoconf') . " ";

Set a proper working path

This step is necessary, since the default PATH setting lets all tools look first in /bin and /sbin. However, the busybox tools setting there do not have the functionality that we need and many build scripts, etc. will fail. Therefore, open /etc/profile in your editor and navigate to line 52.

$ vim /etc/profile

Make sure, that /opt/bin and /opt/sbin are prepended to the PATH. To put it simple, make the line look like this:

export PATH=/opt/bin:/opt/sbin:$PATH

Now log out and reconnect to the NAS via SSH for the changes to take effect!

Install CUPS

First of all, install the OptWare included version of CUPS and the Webinterface:

$ ipkg install cups cups-doc cups-dev

Then stop CUPS to avoid doing any damage.

$ /etc/init.d/cupsd.sh stop

Download, Build and Install Gutenprint

Now, we can download the latest version of gutenprint. I have downloaded version 5.2.29, but I guess that newer version should also work. You can find the download archives on the sourceforge project page. The direct download to the version that I have used is this. If you need support for newer printers (the last release is from 2012), then go fo the latest CVS version.

If you want to connect your printer and your NAS via Ethernet, you will need the canon network drivers. If you connect directly via USB, I guess you can skip this step. I have to confess though, that I did not try it without Ethernet. I also suspect, that this step is optional, if you will install your printer without using the Canon network printer way using regular LPD and a fixed IP.

You can get the necessary source directly on the sourceforge project page. I have used the latest version 1.2.1, but I guess that newer version will work equally good. The direct download link is here.

Install the Printer – Canons way

I have to admin, that I do not know the advantage of doing it this way. For me, it seems like a stupid proprietary way – but I will guide you through it anyway. If you are more like me, you will probably use the LPD way in the next section.

Go to the Webinterface of your CUPS:

http://ip-of-your-nas:631/admin

Log in with the admin account of your QNAP. Navigate to “Add Printer” and select “Canon network printer”.

FIXME

Install the Printer – the LPD way

Straight forward, but you will need to know the IP address of your printer. However, knowing the address is always a good idea. You can find it out either via your routers webinterface (if you are lazy and do not want to get up) or you go to the printer and figure it out via the display and the menus.

Once you have your address, go to the Webinterface of your CUPS:

http://ip-of-your-nas:631/admin

Log in with the admin account of your QNAP. Navigate to “Add Printer” and select “LPD/LPR-Host oder -Drucker” (or the english equivalent thereof). Enter the following address into the next textfield:

lpd://ip-of-your-printer/L1

On the next page, enter your information about the printer and do not forget to enable sharing it! Now select the appropriate driver and you are done.

Enable Airprint

Install dependencies

The following packages are necessary to run python and to allow PDF conversion:

$ ipkg install python26 ghostscript

Install pycups

To enable Airprint, we will use the airprint-generate.py. For this, we also need the pycups library. I have used version 1.9.62 but I guess that newer version will also work.

Try printing with iOS

3 Comments

Fan of Kupferstecker07.05.2017 at 15:19:40

Thank you for this tutorial. I have spent many(!) hours trying to figure out how to connect my Brother MFC-9320CW laser printer via WLAN to my QNAP TS-251 NAS and share it to other devices including Apple devices (i.e. AirPrint, which my printer does not support out of the box). Solutions via Optware (now Entware) just did not work for me. However yesterday I was finally able to solve my problem by installing the app “Container Station” onto my NAS, setting up a Debian XLC container and installing and running Cups right there. Credit goes to Kupferstecker (forum.qnapclub.de #38087)). Happy to supply further details in case someone is interested.

… now that I finally got AirPrint to work, it seems that AirPrint is rather inflexible – but perhaps I am just overlooking something? Via iPhone or iPad and via configuration of CUPS I can set the following: