Red Hat Bugzilla – Bug 192628
'Unable to connect to server' but CUPS is running
Last modified: 2007-11-30 17:11:33 EST
Description of problem:
When I tried to run lpq or lpstat I get the error, "Unable to connect to
server". When I run system-config-printer and try to print a test page it comes
back with the error, "There was a problem sending CUPS test page to 'hp' queue:
/usr/bin/lpr: No such file or directory". When I do a ls -l /usr/bin/lpr I get:
$ ls -l /usr/bin/lpr
lrwxrwxrwx 1 root root 23 Feb 7 2004 /usr/bin/lpr -> /etc/alternatives/print
My rpm -q --last kernel returns this:
kernel-2.6.16-1.2111_FC5 Fri 05 May 2006 10:34:25 PM EDT
kernel-2.6.15-1.2054_FC5 Tue 21 Mar 2006 02:14:18 PM EST
Version-Release number of selected component (if applicable):
Try to print
Steps to Reproduce:
1. upgrade to cups 1.2.0-1.1
2. try to print a test page from system-config-printer
"There was a problem sending CUPS test page to 'hp' queue: /usr/bin/lpr: No such
file or directory."
Test page should print
Printer is a Hewlett Packard DeskJet 812C, and the printer doesn't show up in
other applications. Konqueror returns the error, "An error occurred while
retrieving the printer list: Connection to CUPS server failed. Check that the
CUPS server is correctly installed and running. Error: the IPP request failed
for an unknown reason."
"/sbin/service cups status" shows cups is running.
Created attachment 129788 [details]
Thanks. There's some more information I need:
1. What's the history of this machine? Did it start out as a fresh FC5 install,
or was it running FC4 before?
2. Have you installed any non-Fedora print drivers?
3. Does 'setenforce 0' (to turn off SELinux) make any difference?
4. Please run this command:
strace /usr/bin/lpstat.cups -s 2>lpstat.log
and attach the lpstat.log file that is created.
1. This machine has been upgraded from FC4.
2. No non-Fedora print drivers are on my system.
3. No it doesn't.
Created attachment 129832 [details]
4. Here is the output of 'strace /usr/bin/lpstat.cups -s'
Looks like it's having trouble resolving 'localhost.localdomain'.
What's in /etc/hosts?
$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
According to 'ls -l' it's been like that for over a year.
You're missing 'localhost' from the end of the second 127.0.0.1 line. So adjust
it like this:
127.0.0.1 localhost.localdomain localhost
Any idea why /etc/hosts is like it is?
Hmm, looking at the code, CUPS is meant to handle 'localhost' failures specially
for just situations like this. Investigating.
I don't know why it's that way. It may have been set up like that when I
installed Fedora. I don't think I changed it, but anything's possible. Anyway,
adding 'localhost' to the end of the second line seems to have fixed it.
This test update should fix the problem:
With it, your original /etc/hosts file should work without any CUPS problems.