Skip to content

Fix Address Already in Use on Linux: A Beginner Guide

Admin
November 18, 2026
5 min read
Beginner
💻 Target OS: Ubuntu 26.04 LTS / RHEL 10

Before you begin

  • Applies to:Ubuntu 26.04 LTS and Red Hat Enterprise Linux (RHEL) 10. The same commands work on both.
  • Where to start:Open a Bash terminal on the machine where the application reported the error. The main steps check TCP ports on that host.
  • What you need:Copy the port number from the error message and use it in Step 1. Use ss to find the process holding the port. Use sudo if you need permission to see process details.
Guide tools
Guide tools
0/0 Steps (0%)

Troubleshooting Steps

01

Find the existing listener

Start here

Replace 8080 with the reported port. The flags select listening TCP sockets, show numeric port numbers, and include process details when permitted. Check the local address too. A wildcard listener can conflict with an app trying to use one specific address on the same port.

What you should see · The socket listing shows the local address, port, and process holding the TCP listener.

If you see something else · If you see a PID, use it in Step 2. If TCP shows no listener, use the UDP check only if the app uses UDP. For containers, run the check in the namespace where the bind failed.

Terminal window
port=8080
ss -ltn "sport = :$port"
sudo ss -ltnp "sport = :$port"
# Only if the failing application uses UDP:
# sudo ss -lunp "sport = :$port"
02

Identify who started the process

Narrow the cause

Copy a PID shown by ss and replace the example. Check the command and its parent. If it belongs to a known service, use that service’s logs and configuration. If you see no listener, check whether the app uses UDP or a container network namespace. A TCP listening check only covers the current namespace.

Terminal window
pid=1234
ps -p "$pid" -o pid,ppid,user,comm
systemctl status "$pid" --no-pager
03

Correct the conflict and verify the app

Verify

If both apps are needed, agree on a free port and update only the correct app configuration, keeping the previous file for rollback. If the old process is a confirmed duplicate, stop it through the tool that started it. Verify the expected owner with ss, then test the app using its real protocol and intended port. For a failed config change, restore the saved file and reload through the app’s supported procedure.

Terminal window
# Example after moving the app to TCP port 8081
sudo ss -ltnp 'sport = :8081'

Reference

Comments