Link to home
Start Free TrialLog in
Avatar of klukac
klukac

asked on

cups daemon error, unable to bind socket, address in use

My goal is to print from a Windows XP client to an HP-Deskjet 882C attached to my Linux RH9 server.

I was unable to install the printer  on the XP client over the network.  I got the warning that the driver is incorrect, and when I pointed the XP to locally available drivers, the printer icon showed up with an access denied error, or the XP documents never made it to the server network print spool at /var/spool/samba.  Samba works fine in terms of file sharing, only the print share failed.  The printer works as advertised when connected locally to either machine.  

I then tried to configure the RH9 as a print server by working with the cupsd.conf file. The cups daemon now fails to start, with this error: StartListening: Unable to bind socket - Address already in use

I am prepared to send the global print and [printers] parameters of my smb.conf file, the cupsd.conf file (w/o comments) and any netstat -a output on Inet sockets you need, but I'm not sure where to start.
Avatar of owensleftfoot
owensleftfoot

Install the drivers on the windows boxes as if the printer is actually connected locally - rund the printer driver installation software and choose lpt as the location of the printer. When the driver is installed right click on the printer and choose properties. Select  the "details" tab and change the printer port path from lpt1 to the sharename of the linux printer - ie //mylinuxbox/deskjet
> StartListening: Unable to bind socket - Address already in use
In /etc/cups/cupsd.conf , make sure you don't have both "port 631" and "Listen 631" (port number may vary)
which causes the conflict.

Wesly
Avatar of klukac

ASKER

Thanks very much for your replies!
Followed Wesly's advice to ensure that I don't have a tcp conflict, but then I got a
cups-polld error: get-printers failed, server-error-service-unavailable
When I comment out the BrowsePoll, BrowsePort and other Browse-related directives, I get no errors in the cups error_log, but I don't know what I'm losing.  I'm only using a fraction of the functionality of cupsd, so it may not matter for now, but of course if you know causes and impact I'd like to know.
I still don't see the print share in any GUI on either RH9 or in XP
Testparm shows up ok for print shares, but when I type
smbclient -L xpclient, I get:
Domain=[AD-LIB] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename      Type     Comment
print$               Disk      Printer Drivers
HPDeskJet      Printer   HP DeskJet 882C
It looks like my samba thinks that the Windows machine is the server, but I want the XP to be the client (at one point I had a win2k machine on my home network, it has since been reloaded with another OS).  


Avatar of klukac

ASKER

I add some info here.  I can open the http://localhost:631/printers/ page in Mozilla,
and the RH9 Network Servers GUI opens  to my workgroup, showing all (3) hosts, but when I open my RH host it only displays file shares, not the printer share.  At one point the printer was visible from XP, maybe the cupsd config with browsing disabled is the cause, not sure.  
Please post your smb.conf and cupsd.conf.

Wesly
Avatar of klukac

ASKER

smb.conf:

#======================= Global Settings =====================================
[global]

   workgroup = AD-LIB
   server string = Samba Server
   hosts allow = 10.0.0.  127.

   remote announce = 10.0.0.255/AD-LIB
   netbios name = hou

   printcap name = /etc/printcap
   load printers = yes
   printing = cups
   guest ok = yes
   guest account = pcguest
   map to guest = bad user
   security = share

   log file = /var/log/samba/%m.log

   max log size = 500

   encrypt passwords = yes
   smb passwd file = /etc/samba/smbpasswd

   unix password sync = Yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *New*password* %n\n *Retype*new*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*

   pam password change = yes
   username map = /etc/samba/smbusers
   obey pam restrictions = yes

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

   local master = yes
   os level = 200                #earlier 33, but no difference
   domain master = yes
   preferred master = yes
   wins support = yes
   dns proxy = no

    preserve case = no
    short preserve case = no
    case sensitive = no

#============================ Share Definitions ==============================
[homes]
   comment = Home Directories
   browseable = yes
   writable = no
   valid users = %S
   create mode = 0664
   directory mode = 0775

[netlogon]
  comment = Network Logon Service
  path = /usr/local/samba/lib/netlogon
  guest ok = yes
  writable = no
  share modes = no

[profiles]
   path = /usr/local/samba/profiles
   browseable = no
   guest ok = yes

[printers]
   comment = HP DeskJet 882C
   path = /var/spool/samba
   browseable = yes
   public = yes
   guest ok = yes
   writable = yes
   printable = yes  
   printer admin = root, wsjefan
   printer name = HP-Deskjet

[tmp]
   comment = Temporary file space
   path = /tmp
   read only = no
   public = yes

[pchome]
  comment = PC Directories
  path = /usr/local/pc/%m
  public = yes
  writable = yes
  browseable = yes

[public]
  comment = Public Bath
  path = /home/samba
  public = yes
  writable = yes
  printable = no
  write list = @staff

cupsd.conf:

# "$Id: cupsd.conf.in,v 1.8 2002/12/13 16:23:54 mike Exp $"

ServerName hou.gmk-rep.com
ServerAdmin root@gmk-rep.com

AccessLog /var/log/cups/access_log
DataDir /usr/share/cups

DefaultCharset utf-8
DefaultLanguage en

DocumentRoot /usr/share/doc/cups-1.1.17
ErrorLog /var/log/cups/error_log

FontPath /usr/share/cups/fonts

LogLevel debug

MaxLogSize 1048576
PageLog /var/log/cups/page_log

PreserveJobHistory Yes
PreserveJobFiles No
AutoPurgeJobs No

MaxCopies 10
MaxJobs 500

Printcap /etc/printcap
PrintcapFormat BSD
PrintcapGUI /usr/bin/glpoptions

RequestRoot /var/spool/cups

RemoteRoot remroot

ServerBin /usr/lib/cups
ServerRoot /etc/cups

ServerCertificate /etc/cups/ssl/server.crt
ServerKey /etc/cups/ssl/server.key

User lp
Group sys

RIPCache 8m

TempDir /var/spool/cups/tmp
FilterLimit 0

Port 80
Port 443
Port 631

HostNameLookups On

KeepAlive On
KeepAliveTimeout 60
MaxClients 100
MaxClientsPerHost 10

MaxRequestSize 0
Timeout 300

Browsing On
BrowseProtocols cups
BrowseShortNames Yes
BrowseAllow 10.0.0.*

BrowseInterval 30
BrowseOrder allow,deny

BrowsePoll 10.0.0.103:631
BrowsePort 631

BrowseTimeout 300

ImplicitClasses On
ImplicitAnyCLasses Off
HideImplicitMembers On

SystemGroup sys
RootCertDuration 300
AuthType None
Allow 10.0.0.*
Encryption IfRequested

<Location /printers>
AuthType None
Order Deny,Allow
Deny From None
Allow From All
</Location>

<Location /admin>
AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>

<Location /printers/lp0>
Order Deny,Allow
AuthType None
Allow from All
</Location>

<Location /printers/HP-Deskjet>
Order Deny,Allow
AuthType None
Allow from All
</Location>

Thanks!

We need to see which program is listening on port 631, since you cannot start cups:

please post the output of
netstat -lnp --ip

once solved the problem of double cups start, we can proceed to solve the samba problem:

in smb.conf, check you have something like this:
in [global]:
        printcap name = cups
        load printers = yes
in [printers]
[printers]
        path = /var/spool/samba
        comment = All Printers
        browseable = yes
        guest ok = yes
        writable = no
        printable = yes
        create mode = 0700
        print command = lpr -P %p -o raw %s -r
        lpq command = lpstat -o %p
        lprm command = cancel %p -%j

and also be sure you have lpr being a link to lpr-cups and the same for lpstat, lprm, etc.

then create a printer in smb.conf, like in here:
[hp1200] # the name is arbitrary, but should be consistent throughout
         # Samba and CUPS!
        comment = HP LaserJet 1200 Network Printer
        printable = yes
        path = /var/spool/samba
        public = yes
        guest ok = yes
        force create mode = 760
        force group = nogroup
        printer admin = gabriel_orozco,root


this way you will have admin provileges and users would be able to check the status of the printer.
Avatar of klukac

ASKER

netstat -lnp --ip
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
PID/Program name
tcp        0      0 0.0.0.0:32768           0.0.0.0:*               LISTEN
1583/
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN
20737/smbd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
1564/
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
20781/cupsd
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN
19323/X
tcp        0      0 10.0.0.103:53           0.0.0.0:*               LISTEN
1689/
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN
1689/
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
1702/sshd
tcp        0      0 0.0.0.0:631             0.0.0.0:*               LISTEN
20781/cupsd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
1736/
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN
1689/
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN
20781/cupsd
udp        0      0 0.0.0.0:32768           0.0.0.0:*
1583/
udp     1728      0 10.0.0.103:137          0.0.0.0:*
19067/nmbd
udp    33696      0 0.0.0.0:137             0.0.0.0:*
19067/nmbd
udp        0      0 10.0.0.103:138          0.0.0.0:*
19067/nmbd
udp    63840      0 0.0.0.0:138             0.0.0.0:*
19067/nmbd
udp        0      0 0.0.0.0:911             0.0.0.0:*
1583/
udp        0      0 0.0.0.0:53              0.0.0.0:*
1689/
udp        0      0 10.0.0.103:53           0.0.0.0:*
1689/
udp        0      0 127.0.0.1:53            0.0.0.0:*
1689/
udp        0      0 0.0.0.0:111             0.0.0.0:*
1564/
udp        0      0 0.0.0.0:631             0.0.0.0:*
20781/cupsd

I could not see any duplication on port 631 here (cupsd is running on tcp:80, tcp:631, tcp:443 and udp:631), but I have  client and server print processes running and wanted to make sure that this was ok:
# ps -ef |grep cups
wsjefan  19900     1        0 09:18 ?                00:00:23 eggcups --sm-client-id default6
root        20781     1        0 13:14 ?                00:00:26 cupsd
lp            20808 20781  0 13:14 ?                00:00:00 cups-polld 10.0.0.103 631 30 631
root        20901 20490     0 14:32 pts/2      00:00:00 grep cups

Checking /var/log/cups/error_log, the latest errors are:
E  [dtg] cups-polld: get-printers failed: server-error-service-unavailable
W [dtg] Possible DoS attack - more than 10 clients connecting from localhost!

The DoS error is new (as of today)...thanks.

Avatar of klukac

ASKER

Repeated errors could cause the cups daemon to see a DoS attack, I see a lot of these in error_log:
D [29/Dec/2004:16:08:24 -0500] AcceptClient() 58 from localhost:631.
D [29/Dec/2004:16:08:24 -0500] ReadClient() 58 POST / HTTP/1.1
D [29/Dec/2004:16:08:24 -0500] SendError() 58 code=403
and of course the polld and DoS errors mentioned in my last posting.

I checked for my lp* files, there are links in /usr/bin to print files in /etc/alternatives.  All the usual lp files are there, with the exception of lpd, which has  empty directories  in /var/spool and a binary file at /usr/lib/cups/backend.

As of yesterday, /var/log/samba/smbd.log shows this error:
printing/print_cups.c:cups_printer_fn(110)
Unable to connect to CUPS server localhost - Connection refused
There were no entries in smbd.log today.  

I checked the permissions/ownership for key files in /etc/cups, they are:
-rw-------    1 lp       sys          2421 Feb 12  2003 classes.conf
-rw-r--r--    1 root     root         2183 Feb 12  2003 client.conf
-rw-------    1 lp       sys          1703 Dec 29 16:35 cupsd.conf
-rw-------    1 lp       sys           301 Dec 28 23:58 printers.conf
Let me know if I should change any of this.

Finally, I checked http://localhost:631/printers/ again, and it displays no printers (HP-Deskjet was there yesterday).  I don't dare do anything with GUI's, they tend to corrupt/change my text-based config settings, so I've made no changes.  

If you can make sense of this let me know, thanks.
ASKER CERTIFIED SOLUTION
Avatar of Gabriel Orozco
Gabriel Orozco
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of klukac

ASKER

Thanks very much, at least I'm learning how cups config is supposed to work!  Fixed the localhost and admin rights in the printer locations, but couldn't get rid of the polld-error-service-unavail until I disabled polld (BrowsePoll and BrowsePort).  The SendError Code 403 persists.  Here's the output of my error log:
I [30/Dec/2004:11:10:31 -0500] Listening to 0:80
I [30/Dec/2004:11:10:31 -0500] Listening to 0:443
I [30/Dec/2004:11:10:31 -0500] Listening to 0:631
I [30/Dec/2004:11:10:31 -0500] Sending browsing info to a0000ff:631
D [30/Dec/2004:11:10:31 -0500] AddLocation: added location 'CUPS_INTERNAL_BROWSE_ACL'
D [30/Dec/2004:11:10:31 -0500] AllowIP: CUPS_INTERNAL_BROWSE_ACL allow 0a000000/ffffff00
D [30/Dec/2004:11:10:31 -0500] AddLocation: added location '/printers'
D [30/Dec/2004:11:10:31 -0500] DenyIP: /printers deny 00000000/00000000
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers allow 7f000001/ffffffff
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers allow 0a000000/ff000000
D [30/Dec/2004:11:10:31 -0500] AddLocation: added location '/admin'
D [30/Dec/2004:11:10:31 -0500] DenyIP: /admin deny 00000000/00000000
D [30/Dec/2004:11:10:31 -0500] AllowIP: /admin allow 7f000001/ffffffff
D [30/Dec/2004:11:10:31 -0500] AllowIP: /admin allow 0a000067/ffffffff
D [30/Dec/2004:11:10:31 -0500] AddLocation: added location '/printers/lp0'
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers/lp0 allow 7f000001/ffffffff
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers/lp0 allow 0a000000/ff000000
D [30/Dec/2004:11:10:31 -0500] AddLocation: added location '/printers/HP-Deskjet'
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers/HP-Deskjet allow 7f000001/ffffffff
D [30/Dec/2004:11:10:31 -0500] AllowIP: /printers/HP-Deskjet allow 0a000000/ff000000
D [30/Dec/2004:11:10:31 -0500] ReadConfiguration() ConfigurationFile="/etc/cups/cupsd.conf"
I [30/Dec/2004:11:10:31 -0500] Configured for up to 100 clients.
I [30/Dec/2004:11:10:31 -0500] Allowing up to 10 client connections per host.
D [30/Dec/2004:11:10:31 -0500] LoadAllPrinters: Loading printer HP-Deskjet...
I [30/Dec/2004:11:10:31 -0500] LoadPPDs: Read "/etc/cups/ppds.dat", 13 PPDs...
I [30/Dec/2004:11:10:31 -0500] LoadPPDs: No new or changed PPDs...
D [30/Dec/2004:11:10:31 -0500] LoadDevices: Added device "parallel:/dev/lp0"...
D [30/Dec/2004:11:10:31 -0500] LoadDevices: Added device "http"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "ipp"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "lpd"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "smb"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "scsi"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "serial:/dev/ttyS0?baud=115200"...
(then a bunch of tty devices follow)
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "socket"...
D [30/Dec/2004:11:10:32 -0500] LoadDevices: Added device "usb:/dev/usb/lp0"...
(then a bunch of usb devices follow)
D [30/Dec/2004:11:10:32 -0500] StartListening: NumListeners=3
D [30/Dec/2004:11:10:32 -0500] StartListening: address=00000000 port=80
D [30/Dec/2004:11:10:32 -0500] StartListening: address=00000000 port=443
D [30/Dec/2004:11:10:32 -0500] StartListening: address=00000000 port=631
D [30/Dec/2004:11:10:32 -0500] ResumeListening: setting input bits...
D [30/Dec/2004:11:10:32 -0500] LoadAllJobs: Scanning /var/spool/cups...
D [30/Dec/2004:11:10:32 -0500] LoadAllJobs: Loading attributes for job 1...
(then it loads attributes for jobs 2 - 10)
D [30/Dec/2004:11:10:35 -0500] AcceptClient() 5 from localhost:631.
D [30/Dec/2004:11:10:35 -0500] ReadClient() 5 POST / HTTP/1.1
D [30/Dec/2004:11:10:35 -0500] SendError() 5 code=403
(then this repeats itself until I shut down the cups daemon.)
I tried earlier to limit the number of clients, but an error popped up (probably not critical, but I went back to the default).  Even tho this is an i686, it's an old machine with a 633 MHz CPU and 128 KB cache size, so I thought if I could limit the number of clients or devices that the cups daemon looks at, I'd have a better chance of getting this to work.  Anyway, let me know if you can decipher this.



a) please go to /var/spool/cups...  (where you have your spooled files) and clean the directory
b) if this does not work, please try this: uninstall cups. delete your previous configuration files in /etc/cups.d (clean the directory). Now do a fresh install of cups, and only modify where you need. I wonder you have tampered with the file so much that maybe there is some misconfigured line. it's better to try from fresh.

hope that work
Avatar of klukac

ASKER

I haven't gone back to this issue but wanted to close it out.  I've stopped using Samba for now because my Windows machine is on a separate subnet, on the other side of a cisco router that I'm trying to configure.  I'm holding on to this for reference as I'm sure to use it in the future.  Thanks very much.