BenV's notes

Printing and cups

by on Aug.18, 2009, under Software

We tried to do something that seems fairly simple. “Print out these tickets for HAR2009“, where we went last weekend and had a great time 🙂
The tickets were delivered to me by mail in PDF format. Sounds easy huh?
Note that this story was written the day before we went there, just not finished, so timing might be a bit awkward. Here are the details.

Attempt 1:

$ lpr har_ticket_00.pdf
$

Easy. It even works, the printer starts rumbling and out it comes. Oh…. seems like the barcode is a bit screwed…. mhm, wonder how it managed to do that. (the rest looked fine).
Browsing through the cups error_log gave some gibberish, this line caught my attention:

W [11/Aug/2009:16:58:55 +0200] [Job 624] This document does not conform to the Adobe Document Structuring Conventions and may not print correctly!

Mhm, interesting. Google returned a bunch of filter thingies, and I was like “maybe it’ll work better if I try converting it to ps myself first”.
So I ran pdf2ps (instead of pdftops as cups does) and viewed the resulting ps file. Looks a lot better. Print it!
lpr on the file, and out it comes. Huh, no landscape? I try lpr -o landscape stupidfile.ps which also does portrait. RAAAH, STUPID KANKER CUPS.
After an hour of google and cursing I said “Fine, you do it” to lotjuh, who asked me earlier if she had to do it with her Habbokrat Reader…. what a piece of garbage that is….

Anyway, lotjuh soon ran into a new issue. First of all, her new Windows 7 didn’t have a printer driver, and trying to install the Vista on failed. Our printer is a cheap Brother DCP135C, which isn’t THAT old I thought. Oh well, that’s your windows problems for you 😉
So she booted to linux. Surprise! Print didn’t work. That is, it said “OK” but out came nothing. Jobs just collected at her local cups.

*grumble*WHYYYYY???

Debugging this is a tough, since none of the logs give any useful information whatsoever, even in debug mode.

To understand this problem you might want some more network background info:
We have our internet through xs4all, who gave us a Fritzbox for that. Since I couldn’t get it to work like our previous internet setup with the external IP address on our local server,
we eventually decided that the thing could route for us, but we have our own DHCP server running on our local server.
So in our LAN the default gateway is the fritzbox, but our local server has most ports forwarded to it. In order to also run a dns server and dns cache it has multiple IP addresses in our local lan.
In fact, it has 3 IPs in the 192.168.1.x range on a single ethernet device.

Back to cups:
In cupsd.conf I have Listen 192.168.1.1:631. That should work, right?
However, BrowseAddress only accepts a .255 at the end, or an @IF statement. So I had @IF(eth_local) there.
Result: clients get confused, try to send data to all 3 IP addresses on the network. And since I can’t put the primary IP address in the BrowseAddress…. it fails.
My guess is that cups detects all 3 IP addresses on that interface and happily announces those, while only 1 of them should be used. Especially because of the listen statement.
I fixed this by using the second address, which I conviently have on a ‘different’ ethernet device eth_local:0. This seems to work a lot better, the clients now have a single printer in their cups
configuration and it even provides its location!

Device URI: ipp://192.168.1.2:631/printers/DCP135C
instead of the old

Device URI: file://dev/null

However, my first problem was still present. The whining about invalid PDF files. Printing from KWord also gave this error. The local cups would happily forward my job to our server, which then barfed on the thing:

D [11/Aug/2009:19:47:17 +0200] [Job 637] Printer using device file "/dev/usblp0"...
D [11/Aug/2009:19:47:17 +0200] Discarding unused printer-state-changed event...
D [11/Aug/2009:19:47:17 +0200] [Job 637] backendRunLoop(print_fd=0, device_fd=5, use_bc=0, side_cb=0x804a23f)
D [11/Aug/2009:19:47:17 +0200] [Job 637] Page = 595x842; 9,9 to 586,833
D [11/Aug/2009:19:47:17 +0200] [Job 637] slow_collate=0, slow_duplex=0, slow_order=1
W [11/Aug/2009:19:47:17 +0200] [Job 637] This document does not conform to the Adobe Document Structuring Conventions and may not print correctly!
D [11/Aug/2009:19:47:17 +0200] Discarding unused printer-state-changed event...
D [11/Aug/2009:19:47:17 +0200] Discarding unused job-progress event...
D [11/Aug/2009:19:47:17 +0200] PID 12180 (/usr/lib/cups/filter/pdftops) exited with no errors.
D [11/Aug/2009:19:47:17 +0200] PID 12181 (/usr/lib/cups/filter/pstops) exited with no errors.
D [11/Aug/2009:19:47:18 +0200] [Job 637] Error: error occurred at print phase !!
E [11/Aug/2009:19:47:18 +0200] [Job 637] No pages found!
D [11/Aug/2009:19:47:18 +0200] Discarding unused printer-state-changed event...
D [11/Aug/2009:19:47:18 +0200] Discarding unused job-progress event...
D [11/Aug/2009:19:47:18 +0200] [Job 637] GPL Ghostscript 8.64: Unrecoverable error, exit code 1

… well, that’s just lovely.
(insert your curse of the day here).

Oh btw, if anyone ever wonders about the status of their printer and cups and everything:

$ lpstat -t
scheduler is running
system default destination: DCP135C
members of class default:
unknown
members of class printers:
unknown
device for DCP135C: ipp://192.168.1.2:631/printers/DCP135C
device for default: ipp://192.168.1.2:631/classes/default
device for printers: ipp://192.168.1.2:631/classes/printers
DCP135C accepting requests since Tue 11 Aug 2009 07:44:45 PM CEST
default accepting requests since Tue 11 Aug 2009 07:44:46 PM CEST
printers accepting requests since Tue 11 Aug 2009 07:44:47 PM CEST
printer DCP135C is idle. enabled since Tue 11 Aug 2009 07:44:45 PM CEST
printer default is idle. enabled since Tue 11 Aug 2009 07:44:46 PM CEST
printer printers is idle. enabled since Tue 11 Aug 2009 07:44:47 PM CEST

So far I haven’t found a solution for this problem yet, except for a print to file, scp, manually convert, lpr style workaround, but that’s tedious.
If anyone knows, I’m interested in the cause and fix for it.




:, ,

1 Trackback or Pingback for this entry

Leave a Reply

You must be logged in to post a comment.