Henry Griggs Rambling
Recent TopicsVisit to Australia 2002
Sydney house 2002
Circular Quay 2004
Circular Quay 2002
Centrepoint Tower 2004
Oz Birds 2004
Oz Birds 2002
Bridge Climb 2002
Popular TopicsGallbladder removal
Photo of the day
Geek Alaska 2003
UK in 2003
Geek Caribbean 2002
Photo Of The Day
Getting CUPS working with Slackware 9.0
3rd July 2003
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.
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.
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.
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://192.168.10.100 -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.
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.
This was easy. Too easy. Seductive. I aimed Mozilla at "localhost:631" and up came the CUPS connection. This was nice.
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.
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.
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.
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.
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 - 192.168.45.255, 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.
If you want some more help with CUPS, try these links: