You are not logged in.

#1 2014-08-04 23:15:16

stefano
Member
Registered: 2011-04-09
Posts: 222

[SOLVED] Cups refuses to work: "bad file descriptor"

I am not getting CUPS to work on a new installation.

I need to use cups as a client printing to a printer attached to a separate server. What I did:

1. I installed  the cups package and started/enabled the service in systemd.
2. The remote server has a working CUPS installation (accessible and working from other computers)
3. I can see the remote printer listed among the printers in CUPS's local  web interface

However, every job sent to the printer (from the GUI: KDE based apps such as Okular, etcetera) silently fails.
No job is ever listed on the CUPS web interface.

If I try to check on CUPS status with lstat I get the following error:

$> lpstat
lpstat: bad file descriptor

Any suggestion on how to fix the problem?


Edit: more info

It seems that cups is running fine according to systemd:

[stefano@gorgias ~]$ systemctl status cups
● cups.service - CUPS Printing Service
   Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled)
   Active: active (running) since Mon 2014-08-04 17:56:32 CDT; 16h ago
 Main PID: 2832 (cupsd)
   Status: "Scheduler is running..."
   CGroup: /system.slice/cups.service
           └─2832 /usr/bin/cupsd -f

Aug 04 17:56:32 gorgias systemd[1]: Started CUPS Printing Service.

but not so according to CUPS itself:

[stefano@gorgias ~]$ lpstat -t
scheduler is not running
no system default destination
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor

So systemd tells me the scheduler is running, while CUPS claims it is not

Last edited by stefano (2014-08-06 22:15:53)

Offline

#2 2014-08-06 22:24:54

stefano
Member
Registered: 2011-04-09
Posts: 222

Re: [SOLVED] Cups refuses to work: "bad file descriptor"

It turns out the problem was with a misconfiguration in /etc/cups/client.conf
Or perhaps cups changed behavior between releases and the older client.conf on my system did not work any longer.

For future reference, the problem was the following:

in /etc/cups/client.conf
it is possible to manually specify a server with the syntax

ServerName hostname-or-ip:port

This is the method  I used in the past for  workstations on a small network connected to a predetermined print server

However, that does not seem to work anymore. Not unless the CUPS_SERVER environment variable is manually set to the same hostname.

Solution consisted in removing the manually set hostname and restoring cups default
ServerName /var/run/cups/cups.sock

If anyone knows why setting the hostname manually manually does not work as advertised, I'd like to know.

Cheers,

S.

Offline

#3 2014-08-24 06:40:55

archzen
Member
Registered: 2014-08-23
Posts: 3

Re: [SOLVED] Cups refuses to work: "bad file descriptor"

Stefano,

I can't thank you enough for posting your solution! I have spent the last several days trying to get libreoffice and evince to even see my printer. I've been up and down so many cups web interface sessions, I lost count long ago. Finally, I came across some commands I'd never seen before, in particular 'lpstat' which also gave me the 'bad file descriptor' message. Googling provided next to nothing in help, but it did produce a link to your post, which is like finding a needle in a haystack! Anyway, I updated /etc/cups/client.conf as you suggested, and now my applications can finally see my Brother HL-2280DW.

For what it's worth, I'm running a fresh archlinux install (as of a week or two ago), and just installed cups a few days ago:

---------------------------------------------

root<t1>@benito:/etc/cups# uname -a
Linux benito 3.16.1-1-ARCH #1 SMP PREEMPT Thu Aug 14 07:40:19 CEST 2014 x86_64 GNU/Linux

root<t1>@benito:/etc/cups# pacman -Qs cups
local/brother-hl2280dw 2.0.4_2-3
    Brother HL-2280DW CUPS Driver
local/cups 1.7.5-1
    The CUPS Printing System - daemon package
local/cups-filters 1.0.57-1
    OpenPrinting CUPS Filters
local/cups-pdf 2.6.1-2
    PDF printer for cups
local/libcups 1.7.5-1
    The CUPS Printing System - client libraries and headers
local/python2-pycups 1.9.66-2
    Python CUPS Bindings
local/system-config-printer 1.4.4-1
    A CUPS printer configuration tool and status applet

---------------------------------------------

Again, my sincere thanks!!

(BTW, I'd also like to know why /etc/cups/client.conf doesn't work as advertised...)

Last edited by archzen (2014-08-24 06:44:58)

Offline

#4 2014-08-24 06:41:56

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,196
Website

Re: [SOLVED] Cups refuses to work: "bad file descriptor"

Not an Installation issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB