bind failed on port 139 socket_addr= (Address already in use)

Brian Servis servis at
Wed Oct 13 18:13:43 GMT 1999

*- On 13 Oct, Michael H. Warfield wrote about "Re: bind failed on port 139 socket_addr= (Address already in use)"
> On Thu, Oct 14, 1999 at 02:55:35AM +1000, Brian Servis wrote:
>> I can't figure out what is causing the error message of 
>> [1999/10/13 11:39:42, 0] lib/util_sock.c:open_socket_in(671)
>>   bind failed on port 139 socket_addr= (Address already in use)
>> in my logs and thus preventing smbd from serving up connections.
> 	It means that something else (possibly inetd or another copy of
> smbd) is sitting on port 139 and preventing smbd from binding to it.
>> How can I track down what is causing this?  Samba has been working great
>> and now I must have done something but I don't know what.  The only
>> network service that I have added and since removed is squid.
> 	Get a copy of "lsof" and run the command "lsof -i tcp" and look
> for what process is bound to port 139.

Ok, 'lsof -i tcp' didn't show anything but 'fuser 139/tcp' did.  
And it shows that inetd has got port 139 bound.

# lsof -i tcp | grep 139
# fuser 139/tcp
139/tcp:             21747
# ps ax | grep 21747
21747  ?  S    0:02 /usr/sbin/inetd 

This makes sense to me as /etc/inetd.conf contains:

netbios-ssn     stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/smbd
netbios-ns      dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/nmbd

and /etc/services contains:

netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp
netbios-dgm     138/tcp                         # NETBIOS Datagram Service
netbios-dgm     138/udp
netbios-ssn     139/tcp                         # NETBIOS session service
netbios-ssn     139/udp

But if I disable the netbios-ssn and netbios-ns services in inetd.conf
and start smbd in daemon mode it works.  I have always been running smbd
and nmbd from inetd so what could have changed to cause this to fail?

Brian Servis
Mechanical Engineering              |  Never criticize anybody until you  
Purdue University                   |  have walked a mile in their shoes,
servis at                   |  because by that time you will be a   |  mile away and have their shoes.

More information about the samba mailing list