Getting CUPS working with Slackware 9.0



I'm a little inflexible in some things. When I get something working, I often leave it like that for years and only ever upgrade or fine-tune if there is a need or if I'm forced into it. I like the "good-enough" approach. I get things working good enough, and then leave them alone until it's no longer good enough.

Take my Linux printing for example. I've cobbled together a simple home-made approach that has served me well for many many years. When all I had on the network was a HP laser printer, then that's all I needed. But we've recently added a new printer, and I plan on upgrading to a more powerful laser printer, so the simple approach was no longer good enough.

I got Anne a Hewlett Packard HP 2210 printer. This is more than a printer. It's a colour inkjet printer, that will accept digital camera memory sticks and print directly from them, and it's a scanner, and a photocopier and a fax. All of that in a small and robust package, and it didn't cost much either. Thanks, Sam's Club.

I've approached CUPS a few times in the past, and given up rapidly. It wasn't time, and I didn't need it, so I never put any effort into it. Now that Anne is using Linux and not Windows, I didn't want to put any impediments in the way of that arrangement, so I had to make this printer work well under Linux. There are several print mechanisms I could choose from, but the local Linux User Group is enthusiastic about CUPS and I've been exposed to the benefits and wonder for a while. So CUPS it would be.

I visited the Linux Printing site, and the CUPS site. Plenty of information there, but it didn't really help me at the beginning of the installation phase. I'll go back to them later when my knowledge has increased and I have a chance of understanding them.

I installed it and made it work. This is how I did it. I'll note again, that this is all done from a Slackware perspective.



Installation was easy. The CUPS package is included on the second Slackware cdrom in the extras directory. CUPS 1.1.18 was the version there. The latest version on the Web site is 1.1.19, but I'll go to the extra trouble of downloading it sometime in the future if I need it. What was on the cdrom was good enough. I have a big enough hard disk to not miss a a gig, so I keep the complete set of Slackware installation packages on my hard disk. Copied them there after installation in case I ever needed to remove or add any packages. Good idea, and I've used it frequently to add new stuff. This was one of those times.

  • cd /data/slackware/extras/cups-1.1.18
  • pkgtool
  • Pressed Enter.
  • All done.

That was easy. Installation was done. Now for configuration and setup. How to do it? I went and had a look in /usr/doc/cups and browsed the documentation in there. The system administration manual (sam.html) was the one to use. Did a lot of reading in there first to work out how to proceed.

First of all, I found the file /etc/cups/cupsd.conf and browsed through it. I changed a few things.

  • changed ServerName
  • changed ServerAdmin
  • changed SystemGroup to sys, which is the Slackware approach

Went to my /etc/group file and made sure that my main login was added to the sys group.

Also found cupsdconf, a KDE tool that will modify /etc/cups/cupsd.conf for you. It comes with some help, so it might help make sense of some of the options.

Had a look at /etc/rc.d/rc.cups. Made sure it was executable. Looked inside, looked a bit crappy, but basically okay. I don't like the basic rc. scripts that are supplied, and I usually rewrite them to eliminate the stuff that doesn't apply. After making backup copies of course. rc.cups really needs to have most of the crap stripped out. I'll do that later when I have time.

Now how to call rc.cups and start cupsd and not lpd at boot time? I grepped for lpd in /etc/rc.d and it showed that rc.M was the file to check. I looked in there, and saw that CUPS is already catered for. If /etc/rc.d/rc.cups is there and executable, then it will start. If it's not there, then lpd will be started. That's good. Patrick has already catered for CUPS being used. Nothing for me to do, as it's already been done.

Time to get the CUPS daemon running.

  • Checked if lpd was still running. It was.
  • Killed lpd.
  • Started cupsd with "/etc/rc.d/rc.cups".
That was easy and didn't give me any problems.



At this point, I had two choices. I could go with the command line or I could go with the pretty GUI approach. Being an anti-GUI sort of guy, I went with the command line.

I had to add a printer. So I used the lpadmin program. Lots of research needed first. "man lpadmin", "lpadmin" with no parameters. Read sam.html. One of my printers is attached to my box via the parallel port. I checked my original /etc/printcap and found where it was attached. I read and worked out which PPD file (Postscript Printer Description) I needed. I put all this together and made my first tentative approach.

lpadmin -p laserjet -E -v parallel:/dev/lp0 -m laserjet.ppd

I had another HPLJ6L printer on the network, attached to a HP JetDirect print server, and that was on the network and not attached directly. That required a different approach.

lpadmin -p netprinter -E -v socket:// -m laserjet.ppd

No errors. Good stuff. Now to set it as default printer.

lpadmin -d laserjet

Still no problems. Looking good. Now to enable it ready for printing.

/usr/bin/enable laserjet

Initially I tried using "enable" by itself, but that got all ballsed up with the bash builtin command, so I had to specify the location of the program exactly with "/usr/bin/enable".

At this point, it was working. I could print using lp and a2ps, and print from Mozilla and Open Office and Abiword and anything else I tested. It all looked pretty good, except that a2ps had the edges trimmed off. I tried fiddling with lpoptions and changing widths and margins and stuff, but none of that worked. Okay, time to check out the Web interface to CUPS admin and see if that could help.

Web interface


This was easy. Too easy. Seductive. I aimed Mozilla at "localhost:631" and up came the CUPS connection. This was nice.

  • I chose Manage Printers.
  • The printer I had set up was shown.
  • I clicked on Modify Printer.
  • Location and description were fine, so I left them as is and clicked on Continue.
  • The Device was fine, so I left it alone too, and clicked on Continue.
  • It constructed the device URI for me, the thing I had already manually entered with lpadmin earlier. Good confirmation that I got it right back then. Clicked Continue.
  • Chose the make. HP. Clicked Continue.
  • Now the next choice was interesting. I looked through all the options, and settled on HP Laserjet 6 with CUPS-Gimp-Print. I think I know what that means. Because my printer doesn't do Postscript, and the output from print jobs is in Postscript, the Postscript has to be converted to something else (PCL in my HP case) for printing to take place. That conversion can be done with Ghostscript, which is what I had been using with my old print mechanism. CUPS is offering to do the conversion with Gimp-Print. Good thing I installed the Gimp when I installed Slackware. That looked good, so I said okay and clicked Continue.
  • And that was it. It said the printer had been modified okay. I clicked on the link to my printer and went back to the menu for that printer. Nice graphics, by the way.
  • Now I wanted to fine-tune things so I clicked on Configure Printer.
  • Lovely. All these wonderful options popped up for me to choose. I fiddled a bit but basically left them the same, and clicked on Continue. The defaults were good enough for me.
  • Went to print a test page and ran into problems. I ended up with two problems.
    • Even though I accessed the GUI by using localhost in the browser, because I had set ServerName in /etc/cups/cupsd.conf to my local host's name, the links had the server name applied. I had a conflict between my /etc/hosts file and my browser's "ignore proxy for" setting. This was easily fixed by adjusting the browser's "ignore proxy for" setting.
    • On another system, I had a similar problem printing a test page. It was related to the ServerName thing, but wasn't to do with the proxy settings. I ended up fixing this by modifying /etc/cups/cupsd.conf and adding the line "Allow From 192.168.10.*" to each of the sections "Location /", "Location /printers/laserjet" and "Location /admin", straight after the line "Allow From". That made it work, but I'm not sure why. I'll keep nibbling at this problem until I understand it and work out what happened and why, and then I'll put the answer here. In the meantime, this makes it work, and that's good enough for now.

And that, basically, was that. When I attempted printing with a2ps again, it worked fine. No margin problems at all. This is one time when I liked the convenience of the GUI.

PPD Files for my printers


My next task was to find a PPD file for the new printer, the HP2210, and get that running. I did a fair bit of reading on the Linux Printing site. The HP2210 is supported completely. It took a while to work out what I needed. Hewlett-Packard have apparently done a good and have supplied print mechanisms for almost all their printers. The ones that I use are supported - HPLJ6L and HP2210. I followed the link from the Linux Printing Site to the HP Linux Inkjet Project. I downloaded the latest version of hpijs, and then read the file hpijs_readme.html. That indicated if I did a default installation, it would install the Foomatic database thing, as well as all the HP drivers. It was supposed to be painless. I still don't quite understand this Foomatic thing, but I was willing to experiment. So I followed the instructions in the hpijs_readme.html file.

  • ./configure
  • make
  • make install
  • killall -HUP cupsd

And that was that. I fired up the browser interface and modified my current printer, the HPLJ6L. This time, I had a lot more options to choose from in the HP category. I left behind the "HP Laserjet 6 Series, CUPS+Gimp-Print", and chose the new option "HP Laserjet 6L, Foomatic + hpijs". It accepted it, I printed a test page, and all was well.

So now I can attach the HP2210, and choose "HP PSC 2210, Foomatic + hpijs" and that should give me access to the colour printing and all the other good things.

Print Control at Application Level


I had been given lots of advice about setting up CUPS, and several people had mentioned a program that could be slotted into applications to allow print control at the application level. qtcups was mentioned. I didn't have qtcups on my system, so I went to freshmeat to search for it. I found it, but found this notice:

QtCUPS is obsolete and currently unmaintained. It has been superseded by
the KDEPrint framework and more specifically by the kprinter
command-line utility, which provides the same features as QtCUPS plus a
bunch of fixes and new features.

They do make the last version available for download, but it looks as if qtcups is not something to use for the future. They mentioned kprinter as a replacement. That's useful if you didn't install KDE. Luckily I did install KDE. I don't use it, but I use a lot of the small applications with my window manager of choice (fvwm2). So I had kprinter.

I tried it with Mozilla. Chose File -> Print -> Properties, then replaced the contents of the "Printer Command" field with the single word "kprinter". Saved it by pressing the Okay button. Did a test print, and the kprinter dialog box popped up. First time I did this, I had to go down the bottom of the dialog box and change "Print system currently used" to be CUPS. The documentation notes that the CUPS support is very good. It just worked and I was very happy.

I wanted to do the same thing with OpenOffice, but I've been told that OpenOffice is already CUPS aware. I haven't seen any evidence of it yet, but I am probably looking in the wrong places.

Network Printing


I had been told that all the printers on the network would be able to be seen automatically. That didn't happen to me. I went hunting for why not. First step - look in the configuration file /etc/cups/cupsd.conf.

Here I found the cause of the problem. The default was to have BrowseAddress set off by default. I uncommented the first line and set it to my network broadcast address -, then I restarted CUPS with "/etc/rc.d/rc.cups restart". I did that on all the computers on the network that had CUPS running, and when all of them had been restarted, all the printers were seen automatically. All computers had access to all the printers in the house. Excellent.

End Result


My CUPS runneth over.