# Any idea why cupsd works but lpr doesn't?

## jkcunningham

I'm running cupsd to administer a queue for a network printer (HP 5si). I installed it using the cups interface on 127.0.0.1:631, and printed a test page. When I try to print to it from the commandline: 

> lpr -P 5si <filename>

it says, "lpr: unable to print file: server-error-service-unavailable". lpstat and lpq -a can't see it:

"lpstat: Unable to connect to server: Connection refused"

Does anyone have any idea how to troubleshoot this? There's nothing useful I can see in the /var/log/cups/error_log - no sign I'm even trying to connect to it. 

Thanks.

-Jeff

----------

## fishhead

Sometimes, I remember having to restart cupsd to get stuff to work properly. Not sure this is the problem, but after setting it up, it couldn't hurt.

----------

## jkcunningham

Yeah, I thought of that. Still no dice. Nice try, though...

----------

## fishhead

So you can print from the CUPS setup but not using lpr? Or am I wrong and do both bork?

If you have more than one printer, make sure that the one you want is set as default.

----------

## jkcunningham

The former: I can print from the cups setup, but not from lpr. Nor can I check status via lpstat or lpq. Both say "unable to connect to server: connection refused". 

Sort of sounds like a permissions thing. Yet, the cups setup doesn't have any problem. That's what baffles me. 

One possible problem is the setting of ServerName in /etc/cups/client.conf

I left it commented out, since this is a network printer Do you suppose it needs to point to itself? (127.0.0.1)?

----------

## fishhead

The server name shouldn't matter as I think it's only used to identify the host machine.

For the moment, I'm stumped...

----------

## jkcunningham

I've made some progress. When I set 

ServerName=127.0.0.1in /etc/cups/client.conf I got past being rejected by the server. At this point the job aborted and the log said:

D [25/Jul/2003:09:47:18 -0700] [Job 14] /usr/bin/gs: error while loading shared libraries: libgimpprint.so.1: cannot open shared object file: No such file or directory

So I defined a soft link from /usr/lib/libgimpprint.so.1 to /usr/lib/libgimpprint.so.  That got it past that error. Then it thought it printed but nothing happened. I read some more forum threads and tried two things. 

(1) I emerged the hpijs driver, which is supposed to be an inkjet driver and probably had nothing to do with my ultimate success, but I wasn't entirely sure and figured it wouldn't hurt. 

(2) I went to linuxprinting.org and downloaded their ppd for this HP 5si MX and loaded it, even though ghostscript already came with what seemed to be the same driver. Apparently not, because after I did this it started working. 

So, in summary, it took two things to fix it: a soft link to the library that gimp-print is looking for (must be a bug), and an updated driver. 

-Jeff

----------

## elmo30

I can't answer the "why" lpr doesn't work, but a work-around (with security implications) is to set the sticky bit on /usr/bin/lpr

i.e.:

chmod +s /usr/bin/lpr

----------

