rpcbind grabs ports used by other daemons such as cupsd

Bug #304393 reported by Alvin on 2008-12-02
12
Affects Status Importance Assigned to Milestone
Fedora
Confirmed
Critical
cups (Ubuntu)
Undecided
Unassigned
rpcbind (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: cups

cups 1.3.9-2ubuntu4
From /var/log/cups/error_log:
cups: unable to bind socket for address 127.0.0.1:631 - Address already in use.

Nothing actually looks wrong. 127.0.0.1:631 is only in use by cupsd when started.

Please attach your /etc/cups/cupsd.conf

Changed in cups:
assignee: nobody → pascal-devuyst
status: New → Incomplete
Andrea76 (andrea76) wrote :

I have same problem on Ubuntu 8.10, too. Here is my cupsd.conf

Alex Maguran (amaguran) wrote :

Same problem here on Ubuntu 8.10. I think that this problem was caused by an update of cups (this week). Please note that I have intrepid-proposed repository enabled. I have attached ny cupsd.conf as well. Please let me know if you need more info.

Alex Maguran (amaguran) wrote :

I have cups 1.3.9-2ubuntu5 (intrepid-proposed)

Changed in cups:
assignee: pascal-devuyst → nobody
status: Incomplete → Confirmed
Andrea76 (andrea76) wrote :

Any fix? This is a really stupid bug. I cannot print with evince.

Till Kamppeter (till-kamppeter) wrote :

Alex, cups 1.3.9-2ubuntu5 is completel;y broken, please update to cups 1.3.9-2ubuntu6 (if not yet in -updates from -proposed).

Till Kamppeter (till-kamppeter) wrote :

If you reboot your machine, does it really not start up CUPS?

Before rebooting, please edit /etc/cups/cupsd.conf, so that it has a line

LogLevel debug

and no other "LogLevel" line.

After rebooting check whether CUPS is running by executing the command "lpstat -p". If CUIPS is not running, post you /var/log/cups/error_log file.

svsig (svsig) wrote :

I have the same problem with Ubuntu Server 8.10. I have attached my cupsd.conf.

Can you post the output of

sudo lsof -i :631

Is there anything else than cupsd listed? Can you kill all the listed processes, check whether no new processes come up and then start CUPS with

sudo /etc/init.d/cups start

Does CUPS start up, are you able to print?

Does CUPS start up again when you reboot? If not, do

sudo lsof -i :631

and post the output here.

If you do not have lsof on your system, do

sudo apt-get install lsof

Trapanator, if you cannot print from evince but from any other program, then your problem is not this bug. In this bug users are complaining that CUPS does not start because something is blocking the CUPS port 631. In this case printing will not work from any application.

Andrea76 (andrea76) wrote :

here is my lsof:

trap@dell:~$ sudo lsof -i :631

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 4589 root 3u IPv4 42507 TCP localhost:ipp (LISTEN)

and now?

Alvin (alvind) wrote :

alvin@xanthippe:~$ sudo lsof -i :631
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 5115 root 3u IPv4 27358 TCP localhost:ipp (LISTEN)

Cups actually works. The message is just plain wrong. If cups is not started, the port is not in use.

So Alvin and Trapanator, you should be able to print. If not, your problem is something else.

Alvin (alvind) wrote :

Like I reported originally, cupsd is started like it should be. Still, this error message appears and we can't have false errors now, can we?

(I do have trouble printing, but not with every printer, so this is not related)

Alex Maguran (amaguran) wrote :

The problem has been fixed with the 1.3.9-2ubuntu6 update. Thanks.

svsig (svsig) wrote :

I have upgraded to 1.3.9-2ubuntu6 on my server, but I still have this problem.

When I run the lsof -i :631 command I get no output at all. Can it be that my problem is a different one?

svsig, can you check whether CUPS is running ("lpstat -r", "ps auxwww | grep cupsd")?

Did you call the lsof command with the "sudo" in the beginning?

sudo lsof -i :631

Please edit /etc/cups/cupsd.conf, so that it has a line

LogLevel debug

and no other "LogLevel" line.

Then do

sudo /etc/init.d/cups stop
sudo /etc/init.d/cups start

Then post your /var/log/cups/error_log file here.

svsig (svsig) wrote :

When I execute "lpstat -r" I get the response:
"scheduler is running"

When I execute "ps auxwww | grep cupsd" I get the response:
"root 4189 0.0 0.1 6408 2340 ? Ss 10:05 0:00 /usr/sbin/cupsd"

I am logged on as root, so I didn't use sudo here. I tried the same logged on with my ordinary account just for the record, but I got the same result here using sudo.

My error_log file is quite long now, so I removed most of it leaving only the output from the last restart process. There seems to be one error message here:
"Unable to bind socket for address 10.0.0.145:631 - Cannot assign requested address."

The IP address 10.0.0.145 is the client machine that I have been trying to access the CUPS web interface from. I changed the cupsd.conf file according to the how-to I was following. This file I have attached in a previous comment.

I notice the file says printers=0. I suppose this is the number of printers attached. I have a HP LaserJet 1100 attached to my server.

svsig, what exactly is not working for you? Can you print from the server? Can you print from the client? Can you ping the client from the server? What is the output of "nmap 10.0.0.145" (nmap package). What is the output of ifconfig on your server? What is the output of ifconfig on your client? Why did you comment out "Listen 127.0.0.1:631"? Can you Reactivate this line?

svsig (svsig) wrote :

My problem is that I can't access the CUPS web interface on the server from a client. The server seems to be OK otherwise. I have installed LAMP server, MediaWiki and Tomcat amongst other things, and these are working fine. But when I try to access the CUPS web interface I get the error message:
Failed to Connect
Firefox can't establish a connection to the server at 10.0.0.201:631.

Both machines are connected to the network and seems to be working fine otherwise.

Here is the output from the "nmap 10.0.0.145" command:
Starting Nmap 4.62 ( http://nmap.org ) at 2009-01-11 13:18 CET
Interesting ports on sveinung1 (10.0.0.145):
Not shown: 1712 closed ports
PORT STATE SERVICE
80/tcp open http
111/tcp open rpcbind
443/tcp open https
MAC Address: 00:1E:8C:0A:F8:E6 (Asustek Computer)

Nmap done: 1 IP address (1 host up) scanned in 0.172 seconds

Here is the output of ifconfig on the server:
eth0 Link encap:Ethernet HWaddr 00:1f:d0:0a:c7:34
          inet addr:10.0.0.201 Bcast:255.255.255.255 Mask:255.255.255.0
          inet6 addr: fe80::21f:d0ff:fe0a:c734/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:8024 errors:0 dropped:2235526125 overruns:0 frame:0
          TX packets:5209 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:611143 (611.1 KB) TX bytes:755856 (755.8 KB)
          Interrupt:221 Base address:0x6000

lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:1827 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1827 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:156063 (156.0 KB) TX bytes:156063 (156.0 KB)

Here is the output of ifconfig on the client:
eth0 Link encap:Ethernet HWaddr 00:1e:8c:0a:f8:e6
          inet addr:10.0.0.145 Bcast:255.255.255.255 Mask:255.255.255.0
          inet6 addr: fe80::21e:8cff:fe0a:f8e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:24817 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21543 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5125350 (5.1 MB) TX bytes:2181559 (2.1 MB)
          Interrupt:18

lo Link encap:Local Loopback
          inet addr:127.0.0.1 Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING MTU:16436 Metric:1
          RX packets:73 errors:0 dropped:0 overruns:0 frame:0
          TX packets:73 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7278 (7.2 KB) TX bytes:7278 (7.2 KB)

I have tried to reactivate the Listen localhost:631 line, but the error is the same. I have attached the new output from error_log.

Do you have some firewall on the server or on the client? Perhaps this blocks the CUPS communication.

Is the complete web interface inaccessible for you, or only the admin parts, or even only doing changes (like server settings, adding/modifying print queues)?

svsig (svsig) wrote :

I have no firewalls installed, at least not that I know of. And as I can reach web pages both in apache through port 80 and in Tomcat through port 8080 I should be able to reach CUPS through port 631 as far as I can see. The whole web interface is inaccessible, I can't reach it at all. When I try I get the error message:

Firefox can't establish a connection to the server at 10.0.0.201:631

Andrea76 (andrea76) wrote :

I upgraded to 1.3.9-2ubuntu6, but I cannot print on my PC. The printer is connected through to my PC.

Note that I have problem only with Evince, but with OpenOffice I can print.

svsig (svsig) wrote :

I think I solved the problem now. I also placed a question on ubuntuforums.org, and I got a tip here. What I did was replace the lines

Listen localhost:631
Listen 10.0.0.145:631

with the line

Listen 0.0.0.0:631

in the cupsd.conf file.

Now I can access the CUPS web interface on my server from a client machine in the network.

Alvin (alvind) wrote :

Well, to solve this, /etc/cups/cupsd.conf has to be changed:
- Listen localhost:631
+ Listen 127.0.0.1:631

/etc/cups/cupsd.conf.default should be adapted too.

(Actually, I don't know why localhost wouldn't be ok.)

This is still happening to me on Ubuntu 8.10 Server, cups installed after-the-fact.

Everything is up-to-date and I can't find a working fix from the above posts.

Running,

$ sudo tasksel install print-server

doesn't seem to help either.

And sorry to triple post, but my error log is filling up like this:

$ tail /var/log/cups/error_log
E [15/Feb/2009:13:05:47 -0500] Unable to bind socket for address 127.0.0.1:631 - Address already in use.

And to quadruple post (you guys are going to love me), accessing http://192.168.1.102:631 still does not work after:

$ sudo cp -p /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf
$ sudo tasksel install print-server
$ sudo /etc/init.d/cups start
 * Starting Common Unix Printing System: cupsd [ OK ]
$ sudo lsof -i :631
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 5932 root 2u IPv4 1647526 TCP localhost:ipp (LISTEN)
$ sudo kill -9 5932
$ sudo /etc/init.d/cups start
 * Starting Common Unix Printing System: cupsd [ OK ]
$ sudo lsof -i :631
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 5950 root 2u IPv4 1648352 TCP localhost:ipp (LISTEN)
$ sudo tail -n 1 /var/log/cups/error_log
E [15/Feb/2009:13:07:31 -0500] Unable to bind socket for address 127.0.0.1:631 - Address already in use.

Yves Dorfsman (dorfsmay) wrote :

The problem is that other daemon grab this port before cupsd gets a chance, typcally rpc. See:
https://bugzilla.redhat.com/show_bug.cgi?id=103401

Work around:
lsof -i :631
stop or kill the process, restart cups

long term solution:
I guess distros should ensure processes use different port number.

Note:
The same problem happens on a workstation that try to browse for remote printers (cupsctl --remote-printers), you don't get an error, but "lpstat -a" doesn't show remote printers.

D J Gardner (djgardner) wrote :

Re: #32
  Cups and other processes expect to be able to assign their configured ports, But rpcbind / portmap etc. assign ports randomly.
e.g.: http://www.linuxproblem.org/art_13.html

This bug has just hit me, with a deadline to print and no way to reboot the computer without losing work.
It took a lot of debugging before I stumbled upon the article above, and I've been using linux since it came on two floppies. The problem has been noted in redhat, suse, even BSD.

I propose a solution: rpcbind should NOT assign random ports, it should assign random *unallocated* ports (i.e. it should
make a list of things listed in /etc/services and avoid those ports.)

Robie Basak (racb) on 2015-10-08
summary: - cups: 127.0.0.1:631 - Address already in use.
+ rpcbind grabs ports used by other daemons such as cupsd
Changed in fedora:
importance: Unknown → Critical
status: Unknown → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.