[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#489975: cups: Serial backend not recognised by default



Package: cups
Version: 1.3.7-7
Severity: normal

I have just tried connecting a serial printer to ttyS0, with default 
permissions:
crw-rw---- 1 root dialout 4, 64 2008-07-09 00:35 /dev/ttyS0

When I tried to add it via the web UI, the serial port wasn't listed in 
the Device drop-down.  I turned on debug logging, and sure enough:
I [09/Jul/2008:00:51:39 +0100] Started 
"/usr/lib/cups/daemon/cups-deviced" (pid=4656)
D [09/Jul/2008:00:51:39 +0100] [cups-deviced] Added device "http"...
D [09/Jul/2008:00:51:39 +0100] [cups-deviced] Added device "lpd"...
D [09/Jul/2008:00:51:39 +0100] [cups-deviced] Added device "ipp"...
D [09/Jul/2008:00:51:40 +0100] [cups-deviced] Added device 
"parallel:/dev/lp0"...
D [09/Jul/2008:00:51:41 +0100] [cups-deviced] Added device "scsi"...
D [09/Jul/2008:00:51:41 +0100] [cups-deviced] Added device "socket"...
D [09/Jul/2008:00:51:41 +0100] [cups-deviced] Added device "beh"...
D [09/Jul/2008:00:51:41 +0100] PID 4656 
(/usr/lib/cups/daemon/cups-deviced) exited with no errors.

I noted that cups runs as root, and sure enough, running cups-deviced as 
root (with arbitrary parameters) gave the same result:
# /usr/lib/cups/daemon/cups-deviced 1 10 1 all
DEBUG: [cups-deviced] Added device "http"...
DEBUG: [cups-deviced] Added device "lpd"...
DEBUG: [cups-deviced] Added device "ipp"...
DEBUG: [cups-deviced] Added device "scsi"...
DEBUG: [cups-deviced] Added device "socket"...
DEBUG: [cups-deviced] Added device "beh"...
Content-Type: application/ipp
<snip>

However, the same command as a normal user worked for the serial backend 
if not others (snip follows):
DEBUG: [cups-deviced] Added device "serial:/dev/ttyS0?baud=115200"...

I then tried configuring a suitable printer directly in printers.conf.  
When I tried printing to it, I got:
E [09/Jul/2008:01:03:02 +0100] PID 4767 (/usr/lib/cups/backend/serial) 
stopped with status 1!
E [09/Jul/2008:01:03:02 +0100] [Job 217] Unable to open device file 
"/dev/ttyS0": Permission denied

This led me to suspect permissions, and sure enough, changing /dev/ttyS0 
to 0666 worked.  I didn't really understand this, as root had rw
permissions anyway.  I had a glance at scheduler/cups-deviced.c, and 
there is certainly some magic there relating to the user that it runs 
the backend as.  Unfortunately, I don't have time to delve deeper, but  
see comments around line 204.

I don't want /dev/ttyS0 to be world readable/writeable, but I don't see 
what else to do for now.  NB lp is already in my dialout group, that 
didn't help.

Anyway, this wasn't documented anywhere that I can see.  I'm not sure 
what you think is the best way forward, but at the very least, I think 
this should be documented in README.Debian[1], with suitable guidance 
given as to possible permission settings for the serial port.  Better 
still, it should just work.

Thanks,

Antony

[1] Another thing - could we please have a README.Debian in 
/usr/share/doc/cups that at least points to 
/usr/share/doc/libcups2/README.Debian.gz?  I had to use apt-file and 
grep to find it.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages cups depends on:
ii  adduser               3.108              add and remove users and groups
ii  cups-common           1.3.7-7            Common UNIX Printing System(tm) - 
ii  debconf [debconf-2.0] 1.5.22             Debian configuration management sy
ii  ghostscript           8.62.dfsg.1-2.1    The GPL Ghostscript PostScript/PDF
ii  libavahi-compat-libdn 0.6.22-3           Avahi Apple Bonjour compatibility 
ii  libc6                 2.7-10             GNU C Library: Shared libraries
ii  libcups2              1.3.7-7            Common UNIX Printing System(tm) - 
ii  libcupsimage2         1.3.7-7            Common UNIX Printing System(tm) - 
ii  libdbus-1-3           1.2.1-2            simple interprocess messaging syst
ii  libgnutls26           2.4.0-2            the GNU TLS library - runtime libr
ii  libkrb53              1.6.dfsg.4~beta1-3 MIT Kerberos runtime libraries
ii  libldap-2.4-2         2.4.9-1            OpenLDAP libraries
ii  libpam0g              0.99.7.1-6         Pluggable Authentication Modules l
ii  libpaper1             1.1.23+nmu1        library for handling paper charact
ii  libslp1               1.2.1-7.3          OpenSLP libraries
ii  lsb-base              3.2-12             Linux Standard Base 3.2 init scrip
ii  perl-modules          5.10.0-11          Core Perl modules
ii  procps                1:3.2.7-8          /proc file system utilities
ii  ssl-cert              1.0.21             simple debconf wrapper for OpenSSL
ii  xpdf-utils [poppler-u 3.02-1.3           Portable Document Format (PDF) sui

Versions of packages cups recommends:
ii  avahi-utils           0.6.22-3           Avahi browsing, publishing and dis
ii  cups-client           1.3.7-7            Common UNIX Printing System(tm) - 
ii  foomatic-filters      3.0.2-20080211-3.1 OpenPrinting printer support - fil
ii  smbclient             2:3.0.30-3         a LanManager-like simple client fo

-- debconf information:
  cupsys/raw-print: true
  cupsys/backend: ipp, lpd, parallel, scsi, serial, socket, usb, snmp, dnssd




Reply to: