CUPS Print Server

With this guide we will configure a MyBook World to act as a print server for a connected USB printer. After installing CUPS, we will demonstrate the administrative web interface, add a Printer and show how to print from Mac or Windows clients.

For an alternative guide see MyBook World Edition White Light Print Server (worked for me).

Prerequisites

See other guides on this site for more details:

  • Enable Optware package repositories
  • recover-gcc compiler if you have a newer Firmware.
  • Disable Mionet (recommended, you can put that memory to better use)
  • Check the USB printer is detected

[root@nas ~]# lsusb
Bus 001 Device 003: ID 04e8:3268 Samsung Electronics Co., Ltd
Bus 001 Device 001: ID 0000:0000

Installation

Install the cups and cups-doc packages as a minimum. You probably also want cups-pdf package for pdf support, and cups-driver-gutenprint which contains a vast array of print drivers for various models. Check against the supported list at gutenprint.

exclamation.png

Warning: It is crucial to install the cups-doc package, it contains the entire web interface! If you omit this package, you see only 'Error 404' pages when trying to follow the rest of the instructions.

[root@nas ~]# /opt/bin/ipkg install cups
Installing cups (1.3.5-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/cups_1.3.5-1_arm.ipk
Installing libjpeg (6b-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libjpeg_6b-2_arm.ipk
Installing libpng (1.2.24-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libpng_1.2.24-1_arm.ipk
Installing zlib (1.2.3-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/zlib_1.2.3-2_arm.ipk
Installing libtiff (3.8.2-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libtiff_3.8.2-1_arm.ipk
Installing libstdc++ (6.0.3-6) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libstdc++_6.0.3-6_arm.ipk
Installing openssl (0.9.7m-3) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/openssl_0.9.7m-3_arm.ipk
Installing openldap-libs (2.3.38-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/openldap-libs_2.3.38-1_arm.ipk
Installing libdb (4.2.52-3) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libdb_4.2.52-3_arm.ipk
Installing gdbm (1.8.3-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/gdbm_1.8.3-2_arm.ipk
Installing cyrus-sasl-libs (2.1.22-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/cyrus-sasl-libs_2.1.22-2_arm.ipk
Configuring cups
Configuring cyrus-sasl-libs
Configuring gdbm
Configuring libdb
Configuring libjpeg
Configuring libpng
Configuring libstdc++
Configuring libtiff
Configuring openldap-libs
Configuring openssl
Configuring zlib
Successfully terminated.

[root@nas ~]# /opt/bin/ipkg install cups-pdf
Installing cups-pdf (2.4.6-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/cups-pdf_2.4.6-2_arm.ipk
Installing ghostscript (8.61-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/ghostscript_8.61-1_arm.ipk
Installing fontconfig (2.5.0-0) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/fontconfig_2.5.0-0_arm.ipk
Installing expat (2.0.1-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/expat_2.0.1-1_arm.ipk
Installing freetype (2.1.10-4) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/freetype_2.1.10-4_arm.ipk
Installing gconv-modules (2.2.5-7) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/gconv-modules_2.2.5-7_arm.ipk
Configuring cups-pdf
Configuring expat
Configuring fontconfig
Configuring freetype
Configuring gconv-modules
Configuring ghostscript
Successfully terminated.

[root@nas ~]# /opt/bin/ipkg install cups-doc
Installing cups-doc (1.3.5-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/cups-doc_1.3.5-1_arm.ipk
Configuring cups-doc
Successfully terminated.

[root@nas ~]# /opt/bin/ipkg install cups-driver-gutenprint
Installing cups-driver-gutenprint (5.1.3-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/cups-driver-gutenprint_5.1.3-1_arm.ipk
Configuring cups-driver-gutenprint
Successfully terminated.

At this point, if you launch cupsd, you will have the following error
/opt/sbin/cupsd: can't resolve symbol '__guard'

This is why it is necessary to recompile the cups :

Create a temporary folder for CUPS :

mkdir /shares/internal/PUBLIC/Mybook
mkdir /shares/internal/PUBLIC/Mybook/cups

Download CUPS 1.3.7 :

cd /shares/internal/PUBLIC/Mybook/cups
wget http://www.cups.org/software.php?VERSION=1.3.7&FILE=cups/1.3.7/cups-1.3.7-source.tar.gz /shares/internal/PUBLIC/Mybook/cups
tar xf cups-1.4svn-r7679-source.tar.gz

Recompile and install Cups :

cd /shares/internal/PUBLIC/Mybook/cups/cups-1.3.7
./configure
make
make install
ldconfig

Configure the cupsd.conf file

Copy /opt/etc/cups/cupsd.conf to /etc/cups/cupsd.conf
cp /opt/etc/cups/cupsd.conf /etc/cups/cupsd.conf

Make the following configuration changes to /etc/cups/cupsd.conf

Line Old Value New Value Reason
219 # MaxJobs 500 MaxJobs 50 Reduce overheads on an embedded system!
?? # User lp User sys Swap the user and group, then uncomment the lines (we don't have an 'lp' user)
# Group sys Group lp
456 # MaxClients 100 MaxClients 10 As above
838 AuthType Basic Require valid-user Obsolete configuration values
839 AuthClass System
844 Allow From 192.168.1.0/24 Allow From 192.168.0.0/16 Fix for wider range of home networks
846 # Encryption Required Encryption Never Temporary fix for SSL issue (see above)

Replace "Deny All" by "Deny None"

Create SSL Certificates

Before allowing 'Administrative' actions, the default CUPS configuration requires the web session between the user and CUPS to be encrypted (HTTPS). This is to secure the root password, which we need to present to CUPS.

Normally platform init.d scripts would create the SSL key if it is missing, but to keep out init scripts simple we will do it manually. You will get the odd security warning since this certificate has not been signed by any root hosts, but you can keep warnings to a minimum by ensuring the 'Common Name' matches the hostname of your device.

[root@nas ~]# openssl req -new -x509 -keyout /etc/cups/ssl/server.key -out /etc/cups/ssl/server.crt -days 365 -nodes -config /opt/share/openssl/openssl.cnf  
Generating a 1024 bit RSA private key
.........................++++++
....................++++++
writing new private key to '/etc/cups/ssl/server.key'

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.

Country Name (2 letter code) [AU]:UK
State or Province Name (full name) [Some-State]:London
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]: MyBook World
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []: nas
Email Address []:
[root@nas cups]#

Bring up the server and check logs

[root@nas ~]# ldconfig
[root@nas ~]# /sbin/cupsd
[root@nas ~]# tail -n 100 /var/log/cups/error_log

Then visit the CUPS web-page in your regular web browser. The address is the same as your MyBook, but use port 631 and HTTPS, e.g.
https://nas:631

nas-cups1.png

Adding a Printer

We can now Go to 'Administration' -> 'Find New Printers'. This page interrogates all of the 'backend' providers in cups for new devices and is fairly reliable for USB printers. I recommend you accept the default naming of the printer then click Next.

nas-cups2.png

Click Add this printer,

You may be asked for a user : a popup is displayed :

I entered user : root
Password : root
If you have used the Martin hinner's hack, the the root password is blank…

nas-cups3.png

Choose the raw option

Then, in the printers properties, most of the options should be left at default. It is important for European users to set the paper size to A4 here!

On your XP Computer,
In Windows XP, use "Add Printer" to add a new network printer, selecting "Connect to a printer on the Internet",
and using a URL of https://192.168.1.4:631/printers/Canon_iP3000_USB_1.
select the printer driver for this printer as you would for a locally connected printer.
The ip address 192.168.1.4 should be replaced with the one of your MB and the "Canon_iP3000_USB_1" is the queue name defined in the cups webinterface:

CupsQueueName.JPG

Init scripts

Symlink from /etc/init.d to /opt/doc/cups/Sxxxxxx scripts and fix the path /opt/sbin/cupsd to /usr/sbin/cupsd in the scripts.

Troubleshooting

If the SSL certificate generation has failed you will have problems with the SSL transport for the CUPS website on the My Book, watch out for these messages in the logs:

I [05/Feb/2008:23:31:50 +0000] Generating SSL server key and certificate…
E [05/Feb/2008:23:31:50 +0000] Unable to create SSL server key and certificate - the openssl command stopped with status 1!
I [05/Feb/2008:23:31:50 +0000] Generating SSL server key and certificate…
E [05/Feb/2008:23:31:50 +0000] Unable to create SSL server key and certificate - the openssl command stopped with status 1!

Bugs in the ox-nas USB driver?

$ dmeg
<6>usb 1-1: new full speed USB device using oxnas-ehci and address 3
<3>usb 1-1: device descriptor read/64, error -110
<3>usb 1-1: device descriptor read/64, error -110
<6>usb 1-1: new full speed USB device using oxnas-ehci and address 4
<3>usb 1-1: device descriptor read/64, error -110
<3>usb 1-1: device descriptor read/64, error -110
<6>usb 1-1: new full speed USB device using oxnas-ehci and address 5
<3>usb 1-1: device not accepting address 5, error -110
<6>usb 1-1: new full speed USB device using oxnas-ehci and address 6
<3>usb 1-1: device not accepting address 6, error -110

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License