printing to a remote IPP printer with lp is dang hard
andrew at pimlott.net
Mon Jun 25 13:09:48 PDT 2007
This is a repost of Debian bug 429715 on cupsys-client, which has
thus-far gone unanswered.
My friend gave me the IPP URL of his printer. Not knowing much about
this newfangled protocol, I installed cupsys-client, thinking (based on
the package description) it would be a cinch to use the printer. (This
Debian package contains the lp* family of commands.) It turned out to
be an ordeal. I'd like feedback on what I did wrong, or how this could
be made easier and less frustrating.
The URL was of the form
I started by looking in the lp and lpstat man pages, expecting to find a
URL option. Nothing. Then I tried to find some documentation on what
to do with the URL, what parts of it to pass to what options of
lp/lpstat. All I found was the IPP URL RFC, which isn't very accessible
and is not helpful directly.
So I experimented. I started with the lpstat program. Passing
192.168.0.10 to the -h option was fairly obvious. Using the -r option,
I was able to ping the server. But using, say, -t returned several
repetitions of "lpstat: Forbidden" and nothing else useful. I figured
maybe I had to query this printer specifically. The first problem is I
didn't know whether the name of the printer should be
"/printers/HPLJ1012", "HPLJ1012", or something else. I tried passing
variations to -a, -p, and -v, but I always got "lpstat: Unknown
destination \"HPLJ1012\"!". So it seemed like the remote server didn't
recognize the printer name. But when I investigated further by running
the command under strace, I found that the string HPLJ1012 was never
even sent to the server! In fact, the "Unknown destination" message was
printed after failed attempts to read a file called lpoptions. Why it
needs to read a local file about a remote printer I have no idea. I
looked at the lpoptions man page, but I didn't see anything that looked
At a loss, I turned my attention to lp, and finally I caught a break. I
passed HPLJ1012 to the -d option, gave a PDF file on the command line
(although the man page says nothing about what format the file should be
in, so that was a guess), and got a printout. Looking at the strace of
the run, I found it curious that there were several "POST /" requests
that all got "403 Forbidden" responses, before finally a "POST
/printers/HPLJ1012" (hey--this program does know how to construct the
URL, it just doesn't accept it!) succeeded. I don't know whether this
represents a misconfiguration of the server (which is running CUPS), or
futility on the part of the client. And even after this, I never
figured out how to use lpstat to get job status, etc.
So in the end, I can at least print (though not query), but I still
don't know how I was supposed to figure it out. If I missed something,
maybe it could be documented more prominently.
I've decided to go back to school. Kindergarden.
More information about the cups