User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:howto:cups.server [2013/01/10 14:32]
francisco Remove part about clients as that is covered below
doc:howto:cups.server [2017/01/10 20:43] (current)
tmomas Note added regarding "unmaintained" status of CUPS
Line 1: Line 1:
 +====== CUPS Server ======
 +This HowTo provides information on installing and configuring a [[wp>​Common Unix Printing System]] on OpenWrt.
 +===== Preparation =====
 +==== Prerequisites ====
 +  - obtain [[doc:​howto:​usb.essentials]] basic USB support or ([[doc:​howto:​parport]] Parallel Port support)
 +  - drivers
 +  - kernel module for USB printers: opkg install kmod-usb-printer
 +  - Firewall: open ports    tcp and   udp.
 +CUPS mandatory uses spooling, which means that the entire print job data gets stored in a buffer (on harddisc or in RAM) before the printing is even started. Dependent of what you want to print, your resources are probably that limited that you should not use CUPS. But of course you can add resources to your hardware, like say connect a harddisc per USB.
 +  - [[doc:​howto:​]] to mount a filesystem or a SWAP partition. This should massively upgrade your endowment.
 +  - you cannot mount SWAP over network but you could mount any other filesystem over the network and park the data there, see [[doc:​howto:​server.overview#​filesystem]]
 +==== Required Packages ====
 +=== Server (OpenWrt) ===
 +^ Name ^ Version ^ Size in Bytes ^ Description ​ ^
 +| cups        |  1.4.4-1 ​     |  **2 217 619** | A printer spooling system for devices with USB or LP support.\\ **Note: ​ [[https://​​ticket/​20913|CUPS package is unmaintained]]** |
 +| zlib        |  1.2.5-1 ​     |    39 388 | Library implementing the deflate compression method ​ |
 +| libpthread ​ |  0.9.32-65 ​   |    30 717 | POSIX thread library ​ |
 +| libpng ​     |  1.2.44-1 ​    ​| ​  ​128 723 | A PNG format files handling library ​ |
 +| libjpeg ​    ​| ​ 6b-1         ​| ​   61 963 | The Independent JPEG Group'​s JPEG runtime library ​ |
 +| libstdcpp ​  ​| ​ 4.3.3+cs-65 ​ |   ​232 642 | GNU Standard C++ Library v3  |
 +| cups-bjnp ​  ​| ​  ​0.5.4-1 ​    ​| ​   11 293 | (optional) Description:​ CUPS backend for the canon printers using the proprietary USB over IP BJNP protocol. This backend allows Cups to print over the network to a Canon printer. It currently supports Cups 1.2 and Cups 1.3 and is designed by reverse engineering. ​ |
 +===== Installation =====
 +<code bash>
 +opkg install cups
 +vi /​etc/​cups.conf
 +If you have external storage, change the CUPS spool directory so that it resides on this storage:  ​
 +vi /​etc/​cups/​cupsd.conf and change- RequestRoot /​opt/​var/​spool/​cups
 +. /​etc/​init.d/​cupsd enable
 +. /​etc/​init.d/​cupsd start
 +netstat -a
 +iptables -I INPUT -j ACCEPT -i eth0.1 -p tcp --port ?????
 +iptables -I INPUT -j ACCEPT -i eth0.1 -p udp --port ?????
 +===== Configuration =====
 +==== CUPSD configuration ====
 +Use Cups own configuration Web GUI. If cups is running, you should be able to find it at [[http://​​631]] (that is port ''​631''​ of your router'​s own address). The default cups configuration in //Attitude Adjustment//​ uses the host system authentication mechanism, so in order to log in as Administrator,​ use the ''​root''​ username and its password (the same you use at the Lucy log-in screen).
 +An alternative to the Web GUI is text file configuration:​ configure ''/​etc/​cups/​cups.conf''​ according to [[http://​​man/​5/​cupsd.conf|man cupsd.conf]]. Notice that some configuration files (such as ''/​etc/​cups/​printers.conf''​) should **not** be edited while cups is running. Many cups text files are meant to be modified by the ''​lpadmin''​ command.
 +=== Permissions Problems ===
 +If you have problems with permissions,​ try to change ''/​etc/​cups/​cupsd.conf''​ to fit your local TCP/IP network:
 +Order Deny,Allow
 +Deny From All
 +Allow from
 +Allow from​24 #your ip area.
 +== Toubleshooting:​ Need drivers uploaded on power up ?==
 +Got an HP Laserjet or similar device that requires the driver to be uploaded to the printer each time it's turned on? See this post [[http://​​getting-cups-working-on-openwrt/#​comment-12|here]]
 +==== Adding Printers ====
 +Notice you can't print a testpage on the local cups, because this would need to have ghostscript installed on your embedded system.
 +=== USB printers notes and throubleshooting ===
 +There may be a problem interfacing with USB printers if usb-printers kernel module is also loaded. ​ These conflict with the cups-provided USB support. ​ There are plenty of bugs and one working solution is as follows:
 +  - Remove usblp support: opkg remove kmod-usb-printer
 +  - Edit user and group in /​etc/​cups/​cupsd.conf from ''​User Nobody/​Group Nogroup''​ to ''​User root/Group root''​
 +  - Change ACL on /​usr/​lib/​cups/​backend/​usb to 700 (''​chmod 700 /​usr/​lib/​cups/​backend/​usb''​). ​ This changes the behaviour of cups, which normally tries to execute the backend through a user account other than root.  This forces the backend to run as root from cups.
 +  - Finally, it should be possible to add printers through the web page [[http://​host:​631/​admin]] or manually. ​ The USB device name cannot be displayed through lpinfo but can instead be listed by running ''/​usr/​lib/​cups/​backend/​usb''​ as root.
 +There is a problem with the permissions on USB printers not being writable by nobody, which is what CUPS expects. ​ An alternative is to make a wrapper backend that executes a sudo script which does ''​find /​proc/​bus/​usb -type f -exec chmod +rw {} \;''​. ​ Point being, there is a permission problem between USB/udev and CUPS preventing USB-printers from working. ​ Also, CUPS is removing support or has a lot of issues currently with usblp support.
 +In Attitude Adjustment, you just need to change ACL on /​usr/​lib/​cups/​backend/​usb to 700 (''​chmod 700 /​usr/​lib/​cups/​backend/​usb''​). ​ This changes the behaviour of cups, which normally tries to execute the backend through a user account other than root.  This forces the backend to run as root from cups, the reason have been said above.
 +=== Printers must be Shared ===
 +In order to use the printers from other clients in your network, the printers must be //shared//. In the Web GUI, when adding a printer you should mark the check box ''"​Share This Printer"''​.
 +=== Adding drivers / PPDs ===
 +If you have a special [[wp>​PostScript Printer Description|PostScript Printer Description (ppd)]]-file for your printer, copy it to ''/​usr/​share/​cups/​model/''​ and restart ''​cupsd''​. Cups will install it in ''/​etc/​cups/​ppd''​ and you can choose it via the web interface. ([[http://​​631]]). You can also upload a PPD file through the web interface. **The trick here is that without Ghostscript you are unlikely to get on-router file conversion to work**. ​
 +You really get two alternatives:​
 +  - use the printer with a raw queue, and set drivers (i.e. PPD) in your computer/​laptop. In this case, the file conversion and preparation will be done on your computer/​laptop (as opposed to on the router)
 +  - add printing drivers to your router. Notice that the usual "Linux printing drivers/​filters"​ stack requires more space than a normal router has. If you've [[extroot|extended your root space]] and are willing to do some [[:​doc:​devel:​crosscompile|cross compilation]],​ you can try these unofficial packages [[https://​​FranciscoBorges/​openwrt-printing-packages|openwrt-printing-packages]]
 +=== MacOS X tip === 
 +Configure your extended printer settings. If you use the standard printer settings and add an IPP printer, MacOS X will add after the server adress /ipp . But this class etc. does not exist on your cupsd.
 +==== Client configuration ====
 +This page has good notes about configuring clients for Linux, Windows and Mac OSX:
 +The main point is that if you added printers and marked them as shared, all these operating system should be able to find it as a network printer.
 +===== Start on boot =====
 +To enable/​disable start on boot:
 +''/​etc/​init.d/​cupsd enable''​ (it creates a symlink: ''/​etc/​rc.d/​S??​cupsd -> /​etc/​init.d/​cupsd''​)
 +''/​etc/​init.d/​cupsd disable''​ (this removes the symlink).
 +===== Administration =====
 +Use Cups own Web GUI. If cups is running, you should be able to find it at http://​​631 (that is port 631 of your router'​s own address). If you did not change its configuration,​ to log in to Administration use the ''​root''​ username and its password.
 +Alternatively you can login to OpenWrt and edit ''/​etc/​cups/​cups.conf''​. Restart cupsd.
 +==== Log Messages ====
 +Check [[doc:​howto:​log.messages#​cupsd]] to learn what they mean.
 +===== Notes =====
 +  * Project Homepage [[http://​​]]
 +  * [[https://​​viewtopic.php?​pid=135838#​p135838|Notes on possibilities of using drivers]]
 +  * Package feed for cross-compiling the whole Linux printing stack for your router [[https://​​FranciscoBorges/​openwrt-printing-packages]]
 +=== OpenWrt User posts about installing CUPS ===
 +  * [[http://​​getting-cups-working-on-openwrt/​]]
 +  * [[http://​​ibbs/​forum.php?​mod=viewthread&​tid=392]]
 +  * [[http://​​2012/​01/​cups-hl-2140-usb-printer-wzr-hp-g300nh.html]]