OSError: [Errno 98] Address already in use. Python printed that on a test container after being asked to start a web server on port 8080, and it was right: something already held the port. The error names the problem and stays quiet about the culprit, the way a tripped breaker reports an overloaded circuit without naming the appliance. Linux ships three tools that will name the process. Run without root, all three can leave the owner blank while the listener sits there, and even as root they can turn up a socket that no process seems to own. Every output shown below was captured on an Ubuntu 24.04 test container (kernel 6.18, iproute2 6.1.0, lsof 4.95.0, psmisc fuser 23.7); the Docker and systemd cases come from documentation, and say so.
ss -ltnp: the first command to run
Four letters that turn a socket table into a suspect list
The ss man page opens with a modest job description, that ss “is used to dump socket statistics,” and the flags do the narrowing. -l shows only listening sockets, -t limits it to TCP, -n skips turning port numbers into service names, and -p adds the process. A port that refuses to bind is almost always held by a listener, so -l is the flag that matters most.
With a Python web server already sitting on port 8080, the listing looked like this, trimmed to the two lines that matter here (the rest were the test environment’s own services):
$ ss -ltnp
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 128 0.0.0.0:2024 0.0.0.0:*
LISTEN 0 5 127.0.0.1:8080 0.0.0.0:* users:(("python3",pid=3773,fd=3))
On a busy server that table runs to dozens of lines, and grepping it for “8080” also catches ports like 18080. The man page documents a filter language for this, with predicates of the form sport or dport that “compare the destination or source port to PORT,” so the question can be asked exactly:
$ ss -ltnp 'sport = :8080'
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 5 127.0.0.1:8080 0.0.0.0:* users:(("python3",pid=3773,fd=3))
PID 3773, file descriptor 3, a program called python3. That is enough to run ps -fp 3773 and see the full command line, or systemctl status 3773 on a systemd machine to find which service it belongs to.
UDP needs its own flag. A process bound to UDP port 5353 was invisible to the TCP query and showed up only with -u:
$ ss -ltnp 'sport = :5353'
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
$ ss -lunp 'sport = :5353'
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
UNCONN 0 0 127.0.0.1:5353 0.0.0.0:* users:(("python3",pid=6202,fd=3))
UDP sockets have no listening state, which is why the State column says UNCONN. A DNS server, a game server or anything speaking mDNS will need -u. The dig troubleshooting guide covers the other half of a port 53 problem, once something is actually answering.

lsof -i and fuser: the other two answers
Same question, different plumbing, slightly different output
lsof lists open files, and on Linux a socket counts as one. Its -i option takes an address in the form [46][protocol][@hostname|hostaddr][:service|port], so -i :8080 means any protocol on port 8080. Left alone, lsof translates numbers into names, and the output gets less useful:
$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3 3773 root 3u IPv4 14659 0t0 TCP localhost:http-alt (LISTEN)
“http-alt” is port 8080 as written in /etc/services. The manual says -n “inhibits the conversion of network numbers to host names” and -P “inhibits the conversion of port numbers to port names,” and its own example of state filtering is -iTCP -sTCP:LISTEN. Combined:
$ lsof -nP -iTCP:8080 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3 3773 root 3u IPv4 14659 0t0 TCP 127.0.0.1:8080 (LISTEN)
fuser, from the psmisc package, comes at it from the port side. The fuser man page lists three name spaces, files plus “udp (local UDP ports), and tcp (local TCP ports),” and -v prints the table:
$ fuser -v 8080/tcp
USER PID ACCESS COMMAND
8080/tcp: root 3773 F.... python3
fuser also has -k, and it deserves respect. The man page states it plainly: “Unless changed with -SIGNAL, SIGKILL is sent.” On the test container, fuser -k 5353/udp killed the UDP listener instantly, with no chance for it to flush a file or close a database:
$ fuser -k 5353/udp
5353/udp: 6202
/bin/bash: line 11: 6202 Killed python3 -c "..."
On a production box that is pulling the main breaker to change a light bulb. fuser -k -TERM 8080/tcp sends the polite signal first, and stopping the owning service through its init system is politer still.
Address already in use, three ways
The error is the same; the cause underneath is not
The kernel side of the message lives in the bind(2) man page: EADDRINUSE means “The given address is already in use.” Errno 98 is that code on Linux. What counts as “the given address” is where people lose an afternoon, because an address is an IP and a port together, and the wildcard 0.0.0.0 overlaps every IP on the machine.
With 8080 held on 127.0.0.1, a small Python script tried three binds on the same port:
FAILED 0.0.0.0 8080 -> [Errno 98] Address already in use
bound 127.0.0.2 8080
The wildcard bind failed because it would have covered the loopback address already in use. A bind to 127.0.0.2, a different loopback address, succeeded on the same port. The socket(7) man page states the reverse case directly: when a listener is bound to the wildcard address with a specific port, “it is not possible to bind to this port for any local address.” So a service listening on 0.0.0.0:80 blocks every other program from port 80 on every interface, and ss shows exactly one line for it.
The second cause has no process behind it at all. After a TCP connection closes, the side that closed first keeps the connection in TIME_WAIT for a while. The test script opened a connection to its own server on port 9090, closed the server’s end first, then exited:
$ ss -tan state time-wait '( sport = :9090 or dport = :9090 )'
Recv-Q Send-Q Local Address:Port Peer Address:Port Process
0 0 127.0.0.1:9090 127.0.0.1:46646
rebind without SO_REUSEADDR:
FAILED 127.0.0.1 9090 -> [Errno 98] Address already in use
rebind with SO_REUSEADDR:
bound 127.0.0.1 9090
Nothing to kill, no PID to find, and the port still refused a plain bind. socket(7) describes SO_REUSEADDR as allowing “reuse of local addresses,” and for IPv4 it means a socket may bind “except when there is an active listening socket bound to the address.” Well-behaved servers set the option before binding for exactly this reason, and a homemade server that skips it can fail to restart for a while after a crash, while a mature one comes straight back. That fix lives in the server’s code. lsof has nothing to find.
The third cause is a supervisor holding the port on someone else’s behalf. On Ubuntu 22.10 and later, OpenSSH uses socket activation: the Ubuntu announcement says “sshd will not be started until an incoming connection request is received,” which means systemd itself owns port 22 until then. For 24.04 the same post says port and address settings are read through a systemd generator rather than migrated. A port lookup on such a machine can name systemd rather than sshd, and killing PID 1 is not the fix.
Port 53 has its own resident. The resolved.conf documentation says systemd-resolved’s stub “will listen for UDP requests on addresses 127.0.0.53 and 127.0.0.54, port 53,” and the stub is on by default. A home DNS server that tries to bind the wildcard on port 53 runs into the same overlap rule. A Python stand-in bound to 127.0.0.53:53 over UDP on the test container, and a second socket asking for 0.0.0.0:53 got the familiar [Errno 98] Address already in use. The setting that frees the port is DNSStubListener=no.

Where people get burned
Blank columns, invisible owners and a port that Docker took
The most common burn is running these tools as a normal user. On the test container, an unprivileged account saw the listener but not its owner:
$ ss -ltnp 'sport = :8080' # as user tester
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 5 127.0.0.1:8080 0.0.0.0:*
$ lsof -nP -i :8080 # as user tester
$ echo $?
1
The Process column was empty and lsof printed nothing and exited 1, which reads exactly like “nothing is using this port.” fuser behaved the same way. Its man page explains why: fuser “cannot report on any processes that it doesn’t have permission to look at the file descriptor table for.” lsof’s manual says some builds allow only root to list all open files. The listener was there the whole time. Run the lookup with sudo before believing a blank answer.
The second burn showed up uninvited. Port 2024 in the first listing had no process attached, and that was as root:
$ lsof -nP -i :2024
$ echo $?
1
$ fuser -v 2024/tcp
$ echo $?
1
ss could see the socket in the kernel’s table, but none of the three tools could match it to a process, because the owner lives outside what this container is allowed to see. Containers, separate PID namespaces and some sandboxes produce exactly this picture: a socket with no visible owner. The honest reading is “owned by something outside this view,” and on a Docker host the next step is checking the host and the containers rather than the shell that ran the lookup.
Docker causes the third burn in the other direction. Its port publishing documentation says that by default “the Docker daemon publishes ports to all host addresses,” so -p 8080:80 claims 8080 on every interface. A network engineer, Ivan Pepelnjak, traced the mechanism: Docker runs a userland proxy, and “Docker creates a different process for each published port,” which shows up as docker-proxy in a root netstat -tlnp. The program in the PROCESS column will not be the app inside the container, and stopping it means stopping the container. Publishing to 127.0.0.1:8080:80 keeps the port off the network entirely, which the same Docker page describes as making it so “only the Docker host can access the published container port.” The Docker Compose self-hosting guide is where that host address goes in a compose file.
When the port is free and the service still can’t be reached
A clean ss result is half an answer
Everything above assumes the problem is a collision. The harder version runs the other way: ss shows the right process listening on the right port, and clients still can’t connect. The Local Address column usually explains it. A service bound to 127.0.0.1 is reachable from the machine itself and from nowhere else, which is correct for a database behind a reverse proxy and wrong for a web app meant for the LAN. The python3 line above, 127.0.0.1:8080, would answer curl localhost:8080 and ignore every other machine on the network.
The strongest argument against reaching for these tools first is that the owning program usually announces itself in its own logs, and on a systemd box journalctl -u for the service is faster than any socket query. That holds when the conflict is between two known services. It falls apart when the owner is a forgotten test server, a container started months ago, or a socket owned by a process that no log mentions, which is the case where ss earns its keep. If ss, the logs and the firewall all look right, the packet capture in the first Wireshark capture guide shows whether traffic arrives at all.
IPv6 adds one more layer this container could not test. Creating an AF_INET6 socket here failed with “Address family not supported by protocol,” so the dual-stack behavior of [::] listeners is left out rather than guessed at.

A short command sheet
Copy these, then read the columns before acting
# who is listening on TCP 8080 (run as root)
sudo ss -ltnp 'sport = :8080'
# same for UDP
sudo ss -lunp 'sport = :53'
# lsof, numeric, listeners only
sudo lsof -nP -iTCP:8080 -sTCP:LISTEN
# fuser, verbose, then a polite stop
sudo fuser -v 8080/tcp
sudo fuser -k -TERM 8080/tcp
# connections stuck in TIME_WAIT on a port
ss -tan state time-wait '( sport = :8080 or dport = :8080 )'
-k without a signal is SIGKILL. The disk-full guide uses the same lsof binary to find deleted files that are still holding space, the other classic case of a resource held by a process nobody remembers starting.
The listener on 2024 is still in that container’s table, and nothing inside the box can say whose it is. Which port on your own machine would you have trouble explaining?
Sources
- ss(8) man page: https://man7.org/linux/man-pages/man8/ss.8.html
- lsof manual page: https://lsof.readthedocs.io/en/latest/manpage/
- fuser(1) man page: https://man7.org/linux/man-pages/man1/fuser.1.html
- bind(2) man page: https://man7.org/linux/man-pages/man2/bind.2.html
- socket(7) man page: https://man7.org/linux/man-pages/man7/socket.7.html
- Ubuntu Discourse, “SSHd now uses socket-based activation (Ubuntu 22.10 and later)”: https://discourse.ubuntu.com/t/sshd-now-uses-socket-based-activation-ubuntu-22-10-and-later/30189
- systemd resolved.conf(5): https://www.freedesktop.org/software/systemd/man/latest/resolved.conf.html
- Docker Docs, Port publishing and mapping: https://docs.docker.com/engine/network/port-publishing/
- Ivan Pepelnjak, ipSpace.net, Docker Userland Proxy: https://blog.ipspace.net/kb/DockerSvc/40-userland-proxy/
