(98)Address already in use

From Helpful

This article/section is a stub — probably a pile of half-sorted notes and assertions some of which may well be wrong, and not verified as a whole. Feel free to add or refine.
These are primarily notes
This is probably not going to be complete in any real sense, and exists to contain bits of useful information.
  • usually also make sock: could not bind to address
  • regularly also mentioning an IP/port combination


In general

Generally means something is already bound and listening on the relevant address-port combination.

One way to figure out what that is is:

netstat -lnp

see whether anything has the port in the 'Local Address'.

(Note the special case of 0.0.0.0 (and/or [::] when using IPv6) means 'bind on all interfaces (that are up)')


Note that a server leaving TIME_WAIT sockets can also cause this; you can read Networking_notes#TCP_states, but the short story is that you should wait a little while (typically between one and three minutes) before restarting the server.

In Apache

(Often reporting 0.0.0.0:80 or a specific IP and :80)


If you get this error trying to start apache (most probably when talking about port 80) and you've checked there is no other web server, it probably means you have more than one Listen in your configuration, meaning apache fails because it itself tries to bind to the same (IP/)port more than once.


To fix this, Delete all duplicate port mentions. Check around your configuration (grep for Listen). Consider that you may have something duplicated in your vhost configuration.

(Double mentions also' seem to cause the "Unable to open logs" apache error (perhaps also a double-open?)(verify))