|
Printer setup Summary There are several different printing systems in Linux, and I've now explored two. The LPD (aka BSD) system is older and more primitive; it doesn't have as good drivers for my printer as the newer CUPS. CUPS can be controlled through a browser, with a very elegant interface. As of 15 September 2002, CUPS is working fine -- this is on the 2.4.19-ac4 kernel with the
correct (and updated) USB components. In fact, I can use Tim's S9000
remote printer -- they both show up in KDE's control panel and in all
applications that print. Use "lpoptions -d <printer>" to set up the default CUPS printer, Mozilla will use it. Note that Opera reads the /etc/printcap file, while cupsd generates /var/run/cups/printcap and possibly even removes the /etc/printcap file. Just adding this symlink will work -- I've not tested if cupsd will remove it:
The next thing to do is to export the printer so that it will be
seen on the Samba network. 2004-06-18: Mozilla-firefox is now using the xprt server from
xprtorg (the one from xfree86 is called xprt and is currently not
working with Mozilla). Use the esau-600 driver -- the esau-turboprint
driver is set for 30% size. I don't know how to control the xprt driver
-- editing /etc/mozilla-firefox/pref/unix.js didn't work (perhaps I
needed to restart xprt with just restart xprint -- no, still no effect. Software
Guides
PermissionsKDE's print manager (can be started with "kcmshell printmgr") doesn't allow the user that created a print job to delete it. The file is in /var/spool/cups, and only root is allowed to remove it:-rw-r----- 1 root lpadmin 136372 Nov 23 14:32 d00424-001How can you change these permissions so that at least lpadmin members can remove it? Then you can make the common user a member of the lpadmin group: adduser steen lpadminSo that narrows the problem. Cups is configured in /etc/cups/cupsd.conf -- I asked for guidance on Ubuntu forums. Print options using CUPSWhen the printer queue(s) are installed, you can issue options to
An entire and hard-to-read list of options for a queue
However, the most useful options are probably the following:
You can set your favorite default settings using
Tip: If you find some of the options do not seem to take
effect when printing a Postscript file, try "cleaning" the file first
by putting it through Files
Printers
Installation instructions KDE and CUPS Plug in the printer and use the kcontrol panel's printer
component to install it -- select "New printer" and follow the
instructions. If you want to share the printer with others on the
network, you just need to make a small change in the CUPS configuration
file, or in some case just restart CUPS. If this is a freshly
configured machine, issue cp /mantaray/config/etc/cups/cupsd.conf /etc/cups If it's an already configured machine, it's enough to issue
"just restart cupsys" and the printer should be visible and available
to the whole network. OpenOffice applications OpenOffice
applications will see the networked printers if you install the
cupsys-bsd package and say "yes" to the configuration question. You can
use this setup to pick a default one: sudo /usr/lib/openoffice/program/spadmin The
printers won't automatically be available in the printer panel. If
you've installed a new printer you don't see, press "New Printer" and
then "Add a printer" and then simply "Generic Printer". In the "Choose
a command line" dialog you'll see all the networked printers; pick the
one you just installed, and then give it a meaningful name. The driver
will be supplied by CUPS. I've added icons for Laura and Andrey; because of sudo, the program will run as user root. In addition, for some purposes -- or maybe just for
redundancy
-- it may be useful to tell OpenOffice to use the KDE printer list; you
can add it by the same procedure as above, just pick "kprinter" (the
KDE printer program) for our command line and call it "KDE Printer
Panel". Note that you can also set "kprinter" as the default print command in other applications. Mozilla and Firebird Edit /etc/mozilla-firebird/pref/unix.js by
adding printers to it. If that doesn't work, define "kprinter" as
the only printer and "kprinter --stdin" (or possibly just "kprinter") as the PostScript printer
command.
This configuration file can then be copied to /mantaray/config and from
there to all nodes using the scripts (done on 28 September 2003).
The default printer command in Firebird is lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}which means, "if the variable MOZ_PRINTER_NAME exists, then use that as the printer name, otherwise print to the default printer." To set this variable, issue this as user
root (or on all machines through the /scripts/users scripts -- the
variable is per user, not per computer): export MOZ_PRINTER_NAME=DeskJet_882CTo test that you set it successfully, issue "echo $MOZ_PRINTER_NAME". Of course this will get erased on reboot; you could perhaps put it into /etc/init.d/bootmisc (don't bother until you know this actually works). Printing
is supposed to work after installing the xprt-xprintorg package -- this is a bit of a hack, at least in Mozilla 1.4. Each user can also set his or her printer preferences in her profile page (it goes into prefs.js):
For a current list of printer names, issue "lpstat -t". This method uses the lpr command from cupsys-bsd. The file where printer preferences are stored,
~/.firefox/profile/prefs.js or ~/.mozilla/default/*.slt/prefs.js,
can in principle be propagated to all users, as long as the users have
established a profile. Other applications The Common Unix Printer System (CUPS) writes its list of
printers to /var/run/cups/printcap -- this is what KDE is reading.
However, some applications still use the old location /etc/printcap. cd /etcYou should now see the normal list of printers also in these applications. Finally, to maintain compatibility with all programs, it may be worth installing the cupsys-bsd package and responding 'yes' to the question, "Do you want to set up the BSD lpd compatibility server?" -- this would also work for OpenOffice. However, using kprinter is better since it shows you all available printers, it doesn't just print to a default. Trevi's chroot I installed cupsys-client (which has /usr/bin/lp) and some other cupsys apps in the chroot, and kprinter shows it sees the printers defined in the main root -- not sure how this works, but it does. This means I can print from acroread, using the printcommand /usr/bin/lp. Tested and works. Complications: I don't know if it works because
cupsys-driver-gutenprint was installed in chroot or not -- if it is
installed, it starts its own cupsd, which likely interferes with the
main root's cupsd. For instance, trying to start or stop cupsys in root
will produce errors, since it's really running from chroot. Try just
removing cupsys-driver-gutenprint from chroot; if you lose the ability
to print ask advice. To define fonts for the printer, issue defoma-psfont-installer I pointed it to /usr/share/cups/model/Brother/HL-1250-hl1250.ppd and defined Roman as General Family. "The hintfile for PostScript Printer fonts is created as: /etc/defoma/hints/defoma-ps.hints. You can change the hints of the fonts by editing the file." Installation history 13 October 2006 After an update, the server was again not found, and I reverted the change below (just removed those lines from /etc/kde3/kdeprintrc). I ran into the problem that KDE looks for the
print server at a /var/run port and finds nothing. Fix: add this to
/etc/kde3/kdeprintrc: [CUPS]Restores normal functionality. 6 May 2004 update For some reason the hl1250 driver stopped working. Turboprint and postscript drivers work fine. OpenOffice printing 25 September 2003 update After reinstalling all packages (I had deleted files in
/usr/share), printing from ooWriter failed. When OpenOffice starts, it
looks for /usr/sbin/lpc, which is found in various packages. I discovered a help page that refers to the OpenOffice printer admin (this is pretty crazy): cd /usr/lib/openoffice/programYou get a facility for adding printers -- but the list of printers is its own, and didn't include my Brother printer. So use these directories for adding printers: /usr/share/turboprint/ppd/However, an alternative is to just pick a random printer, and when asked for which command to send to the printer, write "kprinter" -- that way it switches you to the kprinter dialogue, which contains all the printers. A truly horrible configuration problem.
23 November 2002 update On 23 November 2002, I tried to export the HL-1450 printer to Samba, with no luck. Note that there is a conflict between the VMware samba server and Spello's own samba server: the former requires the line " socket address = 128.97.184.152" in /etc/samba/smb.conf, while the latter will be unable to use the loopback device if this is present -- that is to say, smbclient -L localhost will fail. I have been trying to add a CUPS printer to samba, which probably is the way to go -- that way we can all share printers. However, it may be too tricky to get that to work on Spello. For adding a BSD-style printer, see http://www.tldp.org/HOWTO/SMB-HOWTO-9.html Here is the recipe for adding a CUPS printer to Samba. cupsaddsmb is the program that lets you add cups printers to the samba network. Here is the information from man cupsaddsmb:
I did this. What stopping me now is that I don't have the right password for root to access localhost through samba -- no idea what's going on. I've set smbpasswd -a root but this makes no difference. Here's the content of my /etc/samba/smb.conf file, as prescribed in man cupsaddsmb:
The log file is /var/log/samba/. Part of the difficulty here is isolating the variables. I asked the password question on the samba mailing list at http://lists.samba.org/mailman/listinfo/samba on 23 November 2002 but nobody replied. Apparently you don't need to copy the Brother HL1450 PPD file from spellowin:/c:/windows/system to spello:/usr/share/cups/ppd (a new directory) -- cf. http://info.ccone.at/INFO/Samba/cups.html Note that you can browse your printers here: http://localhost:631/printers/ (user root only) Note that if I do this, the usual root password works fine, I get the vmware interfaces, and I get the printers, all nicely lined up.
You could try LinNeiborhood for a Samba Gui: http://www.bnro.de/~schmidjo/index.html Here's gubbio after all -- it works when smbclient is running under user steen:
And here's cyberspace likewise:
Note that cyberspace picks up on both workgroups. So Samba is doing stuff, and I did succeed in making it link up very nicely with the other 'puters, but I failed in making the printer available for other samba clients. The method for achieving this is truly obscure, but the trouble I ran into is even more obscure -- blocked by a password I don't know where to set. 19 November update On 19 November 2002, I discovered Opera couldn't find the newly installed CUPS printer (which is now working fine with the pixelmono driver). Opera looks in /etc/printcap, and CUPS hasn't updated it. I found the following on the web:
I made the suggested change to /etc/cups/cupsd.conf, and the printer show up in Opera, but nothing is actually printed. Konqueror prints fine. On 18 November 2002, I opened the Libranet Xadminmenu and selected "Install the CUPS printing system". It installed fine, saying I need can use the adminmenu to configure it, or go to http://localhost:631. Note that I had to mount the drive on /mnt/dvd and add a symlink /cdrom --> /mnt/dvd. I also added a symlink from /dev/cdrom to /dev/hdc. Anyway, I did this, mounted the drive, and then the adminmenu script found it. The printout was as follows:
-- and then it didn't provide the command. Finally, configuration instructions:
On 14 September 2002 I opened Yast2 and (under Misc) switched back from BSD to CUPS printing system. This was very successful -- the local Brother HL-1450 showed up (I went through a new configuration process) and so did Tim's new printer! However, when I rebooted, all traces of CUPS was gone, the printers didn't show up -- I had to run through Yast2 again to activate it. Once I did that, it worked fine, but how do I get it to start on its own? In my notes from the previous CUPS installation on gubbio, I wrote:
I checked top and verified that CUPS is not taking up any CPU power now. There is nothing on CUPS in /etc/inetd.conf -- there's a line for printer, but not through CUPS. That line is not activated on gubbio. There's nothing on CUPS in /etc/inittab. /etc/rc.config has this:
and this:
It said no; I changed it to yes. I ran SuSE conf -- I think there may be some other way to reload rc.config. Hopefully this will have started CUPS on bootup and my mission in completed. See also USB for the printer. See if you can formulate intelligible questions here and ask them in newsgroups. Perhaps the UCLA LUG is helpful -- though they all use Ret Hat. You can also remove hld when you build a new kernel -- I thought it might help my Microsoft keyboard, but there's no reason to think it can. Error messages in the ps -ax process list (*** marks new lines): ***626 ? S 0:00 sh -c gs '-dBATCH' '-dSAFER' '-dNOPAUSE' '-sDEVICE=hl1250' '-dEconoMode=0' '-dSourceTray=0' '-dPaperType=0' '-sOutputFile=|cat >&3' '-' 3>&1 1>&2 And then below: ***1043 ? S 0:00 usb:/dev/usb/lp?vendor=04f9&prod_id=000e 25 root KDE Print Test 1 Again, all this and nothing happens. The console in this case doesn't even say anything. Note that the printer is now beautifully recognized in KDE, but it doesn't actually get to the printer. In fact CUPS doesn't give up; the top -gs process has been running for an hour. Narrative Jan 2002 The printer's not working -- except it works from SuSE. None of the other programs find it, however. So the logical thing to do would be to let SuSE install it and then figure out how to tell the programs where it's located! Tools to achieve this: * checkpc Checkpc is used to check for the existence and correct permissions of entries in the printcap database. It is useful when installing a new printcap database and cleaning up existing printer spoolers. See the man file. Use -V for verbose output. Here's the first paragraph; I include the whole thing below. LPRng-3.7.4, Copyright 1988-2000 Patrick Now, note that there are several control files, which the script lists. There's /etc/lpd.conf As for the names, SuSE defines several, which is useless for me. What you should do is let SuSE define your printers, but then delete all but the main one. I picked a "generic printer" and "a PCL-6 printer (monochrome)". Name for printing is lp. For the driver I picked pxlmono -- I could have picked ljet4 or ljet5mono. I expect all three will work fine. Resolution 600x600 -- that's not quite the 1200x600 the printer can do. Another driver might give you that though. I try 1200x1200 and ljet5 gray scale -- this may not work. For the test page, YaST uses the command lpr-Plp followed by the filename. My ljet5 grayscale 1200 sits there for ages receiving data. There's a huge slew of processes: 1696 ? S 0:00 kdesu /sbin/yast2 printer Anyway, nothing comes of this test and I let YaST know. I scaled down to 600 x 600 and the ljet4 driver -- this should be a piece of cake, but the printer sits there and blinks. I reread the instructions: SuSE had said to switch off the printer and wait ten seconds between trials. After doing this, the ljet4 at 600 prints perfectly fine -- actually, the gray fill is a bit flaky and I try pxlmono. Pixelmono is definitely better, but it's also quite a bit slower. I suddenly remember that Acroread prints perfectly fine. So the problem is not defining the printer, the problem is telling applications where the printer is. I will stick with pxlmono for now; if it's too slow, try ljet4. Or ljet5 for that matter. ljet5 also takes a while -- but it works. The result is like ljet4 -- not as good as pxlmono. So stick with that. For some reason SuSE didn't make me define lp-ascii and lp-raw this time. I tried a "checkpc -r -A 2S" -- that is, remove junk files older than 2 seconds. I get, Warning - ** cannot open '/var/spool/lpd/y2prn_lp.upp--ascii-lp/acct' So it's looking for three spool files that don't exist -- ascii, auto, and raw. These were the config files listed by checkpc (cf. above): /etc/lpd.conf Here's /etc/lpd.conf: # See "man lpd.conf" for a list of options All of this looks harmless. Here's /etc/printcap: ### BEGIN apsfilter: ### /etc/gs.upp/y2prn_lp.upp This one can be edited down -- perhaps deleted and reconstituted. In fact, try that. But first, here's the content of /etc/gs.upp/y2prn_lp.upp: -supModel="Generic printers 'PCL 5e' or 'PCL This is the actual definition! Of course, at this point you're heavily into YaST, and the question is can you mess with it. Better use YaST itself. I deleted the defined printer -- and /etc/gs.upp/y2prn_lp.upp disappeared, which is good. But what about printcap? Yes, that's also empty now. And checkpc -V turns up empty-handed, just listing a few empty files. So start afresh: YaST finds the printer, defines it as lp, and uses macro pcl5e for the driver pxlmono. Printcap is back with its three names: lp|lp2|y2prn_lp.upp--auto-lp|y2prn_lp.upp or in short, lp, lp-ascii, and lp-raw. I delete the last two, just to keep things simple. That leaves this: ### BEGIN apsfilter: ### /etc/gs.upp/y2prn_lp.upp In Opera, only one printer now shows up -- and nothing happens. The SuSE system just plain isn't working. Try editing out the spool in /etc/ldp/conf -- no luck. To query your usb tool versions, do rpm -qa | grep -i usb I get: usbutils-0.8-8 To query cups tool versions, do rpm -qa | grep -i cups I get cups-libs-1.1.10-25 Here is SuSE's own guide for installing a USB printer: http://sdb.suse.de/en/sdb/html/jsmeix_print-device-usb.html It explains how you can do it without YaST, using /var/lib/apsfilter/SETUP directly. This is still a SuSE product -- it's a whole configuration interface, like xconfig for the kernel: This script creates a printer entry (serial, parallel, and remote printers) in /etc/printcap. Spool directories will be created under /var/spool/lpd/, filters will be linked under /var/lib/apsfilter/bin/. There is a global configuration file /etc/apsfilterrc together with printer specific configuration /etc/apsfilterrc.<gs_mode> after creating a printer entry. In comparison, my current apsfilter in /etc/gs.upp/y2prn_lp.upp already has spool directories under :sd=/var/spool/lpd/y2prn_lp.upp--auto-lp:\ So that's clear, that's where the spool is -- perhaps you can tell KDE? SuSE's instructions say to call the printer a parallel port printer, and I do that in KDE -- it accepts it, while it rejects the USB option. Next, I need to know where the printer drivers are -- again, in Linux you have no idea where they may be placed, or what they're called. Now, at http://www.linuxprinting.org/show_driver.cgi?driver=pxlmono, it says that "pxlmono supplies drivers for PCL 6 printers, both B&W and colour, much faster than the lj5gray/lj5mono drivers." So this is good news; it looks like I've chosen the right driver. Now where is it? Here's details on the HL-1450: http://www.linuxprinting.org/show_printer.cgi?recnum=Brother-HL-1450: 15 ppm. Recommended driver: ht1250. So, not pxlmono! On the ht1250: "This driver handles the 1200x600 dpi mode for the Brother HL-1050/1070/1250/1270N and the 600x600 dpi mode for the Brother HL-1030/1240. It also provides some options as paper source and toner saving. It is available from Ghostscriot 6.10 on, or as a patch for gs 5.50. For the GhostScript versions already containing the driver there are patches to update to a new version (these patches are needed to get 600x600 on the HL-1030/1240 and compatible to work). Web page: http://www.amelek.gda.pl/gs-hl1250/ Execution style: Ghostscript http://www.linuxprinting.org/show_driver.cgi?driver=hl1250 I checked my packager -- I have Ghostscript 6.51-41. This means I shouldn't need any special updates for this driver. It provides "gs-fonts" -- so this is what the ubiquitous gs means -- in the directory names above. But SuSE doesn't show the hl1250 driver, only the hl1260. That could be better, it could be worse. In fact, in the driver selections, when it comes down to it YaST only shows pxlmono and ljet4 and 5 -- it doesn't show all the drivers, and not hl1250. I get complete death when I try to test again. I turned it off and on again, and then it worked fine. The result in fact is slightly better than pxlmono, though I didn't get the 600x1200 option. Anyway, I've clearly found the printing experts again. There is actually a patch for my specific driver (well, for the HL-1250 and relatives) at http://www.amelek.gda.pl/gs-hl1250/ -- but it's not clear it's worth getting. Next, printing system interfaces. There are four options listed for my driver: PDQ, CUPS, LPD/LPRng/GNUlpr / Spooler-less, Each of these requires a script to be generated that links the specific driver to the printing system interface. First, let's see if I can understand a bit more how the system works. The SuSE help file at http://sdb.suse.de/en/sdb/html/jsmeix_print-device-usb.html says: Test whether the USB printer is accessible using the following command (as user root): echo -en "Hello\f" > /dev/usblp0 Provided the printer is connected to the USB device /dev/usblp0 you should get one sheet with the word Hello printed on it. Well -- this was very instructive. I do get that -- a single hello -- so my printer is working! I could get it to print anything from the command line! Just by doing > /dev/usblp0. So now I know that. Very useful. But I had to wake it up first!!! Manually tap the button! Here's to see your USB devices: cat /proc/bus/usb/devices Nice big list -- and that's after disconnecting all but the keyboard and printer! Well, checking the S: lines, you've got a UHCI Root Hub and the printer. OK -- so this was useful, and you can use these commands to find other types of information later. I'll try moving the USB cable while the machine is on and see if the device is still there. cat /proc/bus/usb/devices In fact, the all come right online -- except the scanner, which isn't powered at the moment: gubbio:/ # cat /proc/bus/usb/devices Next, try to print with echo -en "Hello\f" > /dev/usblp0. After moving the printer from "Bus or self-powered" to "self-powered only", it prints without being prompted. So we're a bit better off now. For the moment, I won't patch in the right driver -- it's not worth it. I'll use pxlmono. Here's the driver: http://www.linuxprinting.org/show_driver.cgi?driver=pxlmono I generated a script called lpd-o-matic.cgi and saved it in /root. The guy behind this writes: "This system will work with any LPD that can pass either a job title (lpr option -J via filter option -j) or arbitrary options (lpr option -o, via filter environment variable LPOPTS) to a filter. This appears to cover most GNU/Linux lpd versions, and probably includes lpd versions on the BSD side as well. It will also work with LPRng (ie Red Hat 7.x). I've got one report from a SuSE user which suggests that SuSE's LPD doesn't work. We'll need to add in cf file finding and processing to get it going there. Contributions welcome, as always... (SuSE switched to CUPS nowadays ...) The best way to find out is perhaps just to give it a shot." This could mean I should go with CUPS instead -- I'm getting too tired to continue this; I've sat up until 6am as usual. Here's one piece of crucial information, though, from http://www.linuxprinting.org/lpd-doc.html. "Many drivers are included in typical distributions of Ghostscript, but some are not, and some are separate programs which run together with Ghostscript. You can see the available Ghostscript drivers on your system with `gs -h'." So this is where the drivers are located -- inside the file gs? This is what gs -h gives me: GNU Ghostscript 6.51 (2001-03-28) So that's that. pxlmono is in /usr/share/ghostscript/6.51/lib or possibly /usr/share/ghostscript/fonts. I see lots of files in these directories, ending in .upp or .gs, but no pxlmono or hl1250 (which is included in the list above). So where are the actual drivers? Well, cdj is an .upp file -- so that's likely the driver extension: /usr/share/ghostscript/6.51/lib/cdj550.upp. Try pxl -- no luck. KDE's printing manager rejects all file types in those two directories as "wrong driver format". All right -- I found it, in a lexmark driver. Drivers simply end in .c -- they're compiled programs, likely C++ files. Not much luck here. There are thousands of .c files, and I tried one from the /usr/src SuSE kernel source, a usb printer driver, but KDE rejected it. So I have no idea what KDE's printing manager wants. A filter perhaps? I think I tried that too. So this was educational but so far unsuccessful. The problem is likely not in the driver at all, but in the spooling system. Printing in Linux is quite something. I've spent all night and still don't understand how it works. Maybe you should just do CUPS. And so I did. That's how I got the hl1250 driver and lots more goodies -- this is a clearly superior system and I should have used it from the beginning. The trick: under YaST2 | Misc, there's a Printers under CUPS setup system. That's all it took. Well, Opera still doesn't print! It could be a kernel problem -- this is the message I get: kernel: usb_control/bulk_msg: timeout That could be it. It's not SuSE, it's not the printing system, it's just the USB. It's erratic. It sometimes works, sometimes not. Use cat /proc/bus/usb/devices Now there's the CUPS system. Documentation is at http://localhost:631/documentation.html. man pages for: lpadmin, lpr, lp, lpc, lpq, lpstat, cupsd.conf, http://localhost:631/printers/ -- printer details Description: Brother HL-1450 series "USB port busy or printer disconnected; will retry in 30 seconds..." Device URI: usb:/dev/usb/lp?vendor=04f9?_id=000e So this is what you're getting: the port is busy, won't print. Otherwise everything seems to be working really well, and the CUSP system is actually extremely elegant -- in effect a network admin system. Verbose output of checkpc -V (the whole thing):
|
|
||||||||||||||||||||||||||||||||
|
|
|
|||||
Maintained by Francis F. Steen, Communication Studies, University of California Los Angeles |