User Tools

Site Tools


ubuntu:networking:ports:port_already_in_use

Ubuntu - Networking - Ports - Port already in use

Check what is listening on the port.

sudo lsof -ni :53

returns:

COMMAND    PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 1019 systemd-resolve   12u  IPv4  45566      0t0  UDP 127.0.0.53:domain 
systemd-r 1019 systemd-resolve   13u  IPv4  45567      0t0  TCP 127.0.0.53:domain (LISTEN)

NOTE: This shows it is being used by systemd-resolve.


sudo ss -lp "sport = :domain"

returns:

Netid          State        Recv-Q       Send-Q       Local Address:Port          Peer Address:Port        Process                                                                   
udp            UNCONN       0            0            127.0.0.53%lo:domain        0.0.0.0:*                users:(("systemd-resolve",pid=1019,fd=12))                               
tcp            LISTEN       0            4096         127.0.0.53%lo:domain        0.0.0.0:*                users:(("systemd-resolve",pid=1019,fd=13))  

NOTE: This shows it is being used by systemd-resolve.


Disable any service that is running on this port

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
sudo systemctl mask systemd-resolved

NOTE: The mask is to prevent this service auto starting on reboot.


To undo what you did:

sudo systemctl unmask systemd-resolved
sudo systemctl enable systemd-resolved
sudo systemctl start systemd-resolved

NOTE: An alternative to the enable command is:

sudo systemctl defaults systemd-resolved
ubuntu/networking/ports/port_already_in_use.txt · Last modified: 2021/02/05 14:36 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki