I am new to ubuntu, yet from my research I would suggest editing your resolved.conf to free up the port imho.
1, Edit /etc/systemd/resolved.conf
with a text editor (as root), e.g. open it with Nano console text editor
And uncomment (remove #
from the front of the line) the DNS=
line and the DNSStubListener=
line. Next, change the DNS=
value in this file to the DNS server you want to use (e.g. 127.0.0.1 to use a local proxy, 1.1.1.1 to use the Cloudflare DNS, etc.), and also change the DNSStubListener=
value from yes
to no
.
This is how the file should look after you’ve made these changes (I’m using 1.1.1.1 as the DNS server here, which is the Cloudflare DNS):
[Resolve]
DNS=1.1.1.1
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no
DNSStubListener=no
#ReadEtcHosts=yes
To save the file using Nano text editor, press Ctrl + x
, then type y
and press Enter
.
2. Create a symbolic link for /run/systemd/resolve/resolv.conf
with /etc/resolv.conf
as the destination:
Here, -s
is for creating a symbolic and not hard link, and -f
is for removing any existing destination files (so it removes /etc/resolv.conf
if it exists).
3. Reboot your system.
Port 53 should now be free on your Ubuntu system, and you shouldn’t be getting errors like “listen tcp 127.0.0.1:53: bind: address already in use” anymore.
You can check to see if port 53 is in use or not by running sudo lsof -i :53
- if port 53 is not in use, this command shouldn’t show any output.
Full guide from https://www.linuxuprising.com/2020/07/ubuntu-how-to-free-up-port-53-used-by.html