affiliate_link

Unable to bind: address already used

You are here because you have seen the following message in either /var/log/qmail/qmail-smtpd/current or /var/log/qmail/qmail-pop3d/current.

tcpserver: fatal: unable to bind: address already used

If you see this error message, the problem is that another program has bound to the address to which you are trying to bind. Stop the revelant service with using the svc command. Verify the service is down with the svstat command. The below example will use the qmail-smtpd service.

# svc -d /service/qmail-smtpd
# svstat /service/qmail-smtpd


The service should show as down. Next run the following command to verify another program has bound to the port using the netstat and grep commands. The below example continues with the qmail-smtpd service as will the rest. If you are experiencing this problem with qmail-pop3d, substitute 110 in place of 25. If the command returns something, then another program is bound to that port.

# netstat -an grep 25

After determining something is indeed bound to the address, determine what program is with the lsof command.

# lsof -n -i:25

The output of lsof will tell you what program is running on that port. You need to stop that program and remove it and its related start scripts. Once this is completed, you can restart the service by using the svc command.

# svc -u /service/qmail-smtpd

Now verify that the service has started correctly with the svstat and tail commands.

# svstat /service/qmail-smtpd
# tail /var/log/qmail/qmail-smtpd/current


The svstat command should show the service running for more than one second. The tail command should also show that the service has started correctly and the address already in use message has disappeared.

Preventing this error:

The two most common causes of this error are:

1. Not stopping any pre-existing mail server software. If you are installing qmail on a machine which already has sendmail, postfix, exim, or some other mail server installed (possibly installed by default with your OS distribution) you need to make sure that this other program is not only stopped, but is not configured to run automatically when the system boots.

For RedHat, Fedora, CentOS, Whitebox, and other RedHat-like systems, you can use the chkconfig command to make sure these other services will not start automatically when the system boots. You may need a command like this:

# chkconfig --level 2345 sendmail off

For debian linux, there is a similar command called update-rc.d. A similar command would look something like this (and if somebody knows debian better than I do, please correct me here...)

# update-rc.d -r -f sendmail

2. Running two services on the same port without specifying separate IP addresses. Note that running one service with a specific IP address and another service with 0.0.0.0 (or just 0) as the IP address is the same thing- the service running with 0.0.0.0 will try and attach to every IP address on the machine, and if anything is already attached to even one of those IPs, it will fail. Likewise, if there is a service running on 0.0.0.0 and another service tries to start which uses the same port a single IP, it will fail. There is no way to "share" a port on any single IP address- if you need to share a single port between two services, those services MUST be listening on different IP addresses, and neither of them can use 0.0.0.0.

Retrieved from "http://www.qmailinfo.org/index.php/UnableToBindAddress"




Recommended buys!

0 comments