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:

$ ipkg list | grep gutenprint
cups-driver-gutenprint - 5.2.6-1 - CUPS driver from Gutenprint.
gutenprint - 5.2.6-1 - Gutenprint.

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:

$ ssh admin@NAS

Now install all necessary packages

$ ipkg update
$ ipkg install optware-devel make autoconf libtool automake gcc perl grep gawk popt sed

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/ and set perl_threads to 0.

$ vim /opt/share/automake-1.12/Automake/

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/ 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.

$ wget ""

Unzip the archive and build:

$ tar -xvjf gutenprint-5.2.9.tar.bz2
$ cd gutenprint-5.2.9
$ ./
$ ./configure CC="/opt/bin/gcc -std=gnu99 -I/opt/include -L/opt/lib" --prefix=/opt --includedir=/opt/include --with-cups=/opt --disable-cups-ppds --disable-cups-level3-ppds --without-foomatic --disable-libgutenprintui2 --disable-nls --disable-static
$ make
$ make install

Make the Init Script start our CUPS

Open /etc/init.d/ in your editor

$ vim /etc/init.d/

And change line 220 to match the following:

/opt/sbin/cupsd -c /etc/config/cups/cupsd.conf

Start CUPS

/etc/init.d/ start

Now you should be able to access the webinterface of CUPS via:


Log in with the admin account of your QNAP.

Install Canon Network drivers (only if you want to connect to your printer via Ethernet instead of USB)

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.

So, go to your terminal, download, unzip, configure and build:

$ wget
$ tar -xvzf cups-bjnp-1.2.1.tar.gz
$ cd cups-bjnp-1.2.1
$ ./configure --prefix=/opt
$ make

To install the tool, copy it into the cups folder:

$ cp bjnp /opt/lib/cups/backend/

Restart CUPS:

$ /etc/init.d/ restart

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:


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


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:


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:


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 For this, we also need the pycups library. I have used version 1.9.62 but I guess that newer version will also work.

$ wget
$ tar -xvjf pycups-1.9.62.tar.bz2
$ cd pycups-1.9.62
$ python2.6 install


Download the script:

$ wget --no-check-certificate
$ chmod +x
$ python2.6

A service file for your printer has been generated. Copy it to the folder where avahi looks for them:

$ cp YOUR-PRINTER-FILE.service /etc/avahi/services

And restart avahi:

/etc/init.d/ restart

Add the proper mimetypes for iOS 6

iOS 6 needs mimetypes that are non standard on the QNAP. For more information see here and here. To fix this, manually crate the following files:


# "$Id: $"
# AirPrint type
image/urf urf string(0,UNIRAST<00>)
# End of "$Id: $".


# "$Id: $"
# AirPrint
# Updated list with minimal set 25 Sept
image/urf application/pdf 100 pdftoraster
# End of "$Id: $".

Restart CUPS afterwards:

/etc/init.d/ restart

Try printing with iOS

If it is not working, check the individual steps for anything that went wrong.

In any case, please leave a comment with feedback!


  1. Fan of Kupferstecker

    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 ( #38087)). Happy to supply further details in case someone is interested.

  2. Fan of Kupferstecker

    … 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:

    Number of copies
    Page from / until
    Color / black and white

    Media Size
    Print Quality
    Media Type
    Manual Feed
    Secure Print (does someone know what that is?)
    Toner Save
    Colour Mode
    Improve Grey Colour
    Enhance Black Printing
    Halftone Screen Lock (does someone know what that is?)
    High Quality Image Printing

    Further settings like border size oder zoom level do not seem to be possible. Or am I perhaps overlooking something and it is possible (for instance via iPad or via avahi daemon configuration)?

  3. bastian (Post author)

    I believe you cannot set those values through AirPrint. However, you can define the defaults for the printer in CUPS and those will be used by AirPrint.


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.