Tag: xp


Linksys NSLU2: print server with CUPS

Apr 24, 2008 Author Nik

Installing and configuring CUPS with an HP PhotoSmart 8150 was ridiculously easy, since CUPS comes complete with HPIJS (the HP linux print drivers). The printer is attached via a USB hub on port 1.

Installing CUPS

First off, install CUPS and its documentation package. Strangely enough, the docs include a lot of the files required to run the CUPS web interface.

ipkg install cups
ipkg install cups-doc

First of all, edit the CUPS config file.

vi /opt/etc/cups/cupsd.conf

There are a few lines which restrict access to CUPS to only the 192.168.0.0/24 network. This is fine for a lot of people, but if your network doesn’t use that range of addresses, you need to edit them accordingly.

Now you need to make sure your printer is connected to the Slug. By default, CUPS has no permissions on the device that represents the printer (/dev/lp0). Fix that with:

chmod 777 /dev/lp0

Next you need to put the startup script in /opt/etc/init.d so that CUPS can start automatically. Most other packages do this as part of their installation/configuration process, but with CUPS this has to be done manually. Also, start CUPS.

cp /opt/doc/cups/S88cups /opt/etc/init.d
/opt/doc/cups/S88cups

Now you can use a web browser to browse to http://your-slug:631 (where your-slug is the host name or IP address of your Slug) and use the CUPS web interface to manage your printer. Under Manage Printers you’ll see there’s already an HP 990c installed. While the HP990c apparently works with the majority of printers, I prefer to use the right driver for my printer – so I deleted the HP 990c, then went through the ‘Adding a printer to CUPS’ process.

Adding a printer to CUPS

From the main page in the CUPS web interface, click Add Printer. You will probably be presented with the message 426 Upgrade Required. This means that CUPS requires that your browser switches from http to https, but can’t do it automatically – you need to click the link, and you’ll be asked to provide a valid username and password to continue. Using root here is fine.

On the page that follows, give your printer a name – bear in mind this name will be part of the printer’s URL, so it can’t contain spaces, hashes or slashes. Provide a description and the location if you want, too.

On the next page, choose your printer from the drop-down list. CUPS queries the printer for this information, so it’s pretty accurate. If your printer isn’t listed, you probably forgot to change the permissions on /dev/lp0 as described above.

CUPS will then display a list of drivers, and you’ll probably not see your printer there. So head over to http://www.linuxprinting.org/printer_list.cgi, search for your printer, and download the PPD file for it. Once that’s done, return to the CUPS page. Click Browse… and select the PPD you downloaded, then click Add Printer. You’re done.

All you need to do now is click the Printers tab at the top of the page, and start your printer if it isn’t already started.

Note that your printer needs foomatic-rip if your Printers page shows a message such as this:

Filter “foomatic-rip” for printer “HP-PhotoSmart-8150″ not available: No such file or directory

My testing showed that my printer worked fine without foomatic-rip, but the printer needed to be started manually every time CUPS (or the Slug) restarted. There is probably a setting in the configuration file to force a printer to attempt to start regardless of errors, but I found installing foomatic-rip to be a cleaner fix:

cd /opt/lib/cups/filter
wget http://www.linuxprinting.org/foomatic-rip
wget http://www.linuxprinting.org/foomatic-gswrapper
chmod 755 foomatic-rip foomatic-gswrapper
/opt/etc/init.d/S88cups restart

No more error message, and the printer starts automatically when CUPS starts.

It is also worth backing up the /opt/etc/cups/printers.conf file. CUPS has a tendency to overwrite it with a file of the wrong format when you click on certain options in the web interface, resulting in 403 Forbidden errors when you try to access the web interface.

cp /opt/etc/cups/printers.conf /opt/etc/cups/printers.conf.backup

Using a CUPS printer in Windows

In Windows Vista, installing the printer is simple. Open the Control Panel, go to Printers, and then Add Printer. Select Add a network, wireless or Blutooth printer, and click Stop on the next page of the wizard; it won’t detect the printer, but you can add it easily, so click The printer that I want isn’t listed.

In the Select a shared printer by name text field, enter http://your-slug:631/printers/printer-name. You need to replace your-slug with either the host name or IP address of your Slug, and printer-name with the printer name you chose. Click Next. You will then be presented with a list of printer drivers to choose from. The list contains all the drivers that shipped with your release of Windows Vista plus all those that you have installed. If you don’t see the right printer driver in the list, visit your printer manufacturer’s website to download the right driver, and install it.

In Windows XP, open the Control Panel, go to Printers and Faxes, and then Add a Printer. Select Connect to a printer on the Internet or on a home or office network, and in the URL field enter http://your-slug:631/printers/printer-name. You need to replace your-slug with either the host name or IP address of your Slug, and printer-name with the printer name you chose.

Windows XP doesn’t have as comprehensive a driver database as Windows Vista, so the likelihood is that your printer won’t be shown in the dialog you see next (unless you had already installed your printer drivers on that computer). Download the drivers from your manufacturer’s website (or use the printer’s driver disk), and select Have Disk. Locate the driver and click OK, then choose the exact printer from the list that follows.

Issues

On Windows XP, certain actions or operations will cause a crash in Word 2003 and Word 2007 if a CUPS printer is installed and set as the default printer, but the CUPS server is unavailable.

The action that triggers the crash does not obviously relate the problem to the printer’s availability, but removing the printer (or setting a different printer to default) will prevent the problem – as will ensuring CUPS is always online and available to Windows XP clients.

This doesn’t seem to happen on Windows Vista.

If this information was useful, please leave a comment to let me know!

Bad Behavior has blocked 19 access attempts in the last 7 days.

Bear