FTL failed to start listening port 53, already used

Hi all, I need a little help to solve the problem.

I installed pi-hole with docker on a pi4 with Ubuntu server 22.04.
I have a problem, pi-hole tells me: DNSMASQ_CONFIG FTL failed to start due to failed to create listening socket for port 53 : Address already in use.

When I do ss -tulpn | grep 53, I get :
udp UNCONN 0 0 127.0.0.53%lo:53
tcp LISTEN 0 4096 127.0.0.53%lo:53

I don't know how to stop or change the port used by the raspberry.
Do you have any idea? I'm a bit new to Linux without a GUI.

Thanks a lot for your help !

Can you post a debug log token URL please? The command is pihole -d

Please follow our help template. In particular, we need your debug log.

Please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

You can find the debug log in attached file.
pihole_debug.txt (22,8 Ko)

Your host machine is running some software that is already binding port 53, which is the DNS standard port and thus required by Pi-hole.

*** [ DIAGNOSING ]: contents of /etc

-rw-r--r-- 1 root root 923 Jul 10 10:39 /etc/resolv.conf
   nameserver 127.0.0.53

You are running your Pi-hole in a Docker container, so your debug log would not contain which actual process is listening on port 53.

But as you are running Ubuntu, it is likely that that process would be systemd-resolved stub resolver.

You should be able to confirm by running the following command on your host machine:

sudo ss -tulpn sport = 53

In any case, you'd have to disable the process that binds port 53, to free that port for usage by Pi-hole.

Alternatively, you may be able to point the stub resolver to make use of Pi-hole as its upstream, by pointing it to to private IP of your host machine.
According to your debug log, that would be 192.168.1.3.
That may also require your Pi-hole container to map port 53 UDP/TCP specifically for that IP address, in order to avoid the localhost port conflict. This would preclude you from running your Pi-hole container in Docker's host network mode, as you can't map ports in that mode.

I've modified /etc/systemd/resolved.conf and enabled the systemd-resolved service. In /etc/systmed/resolved I added the box as DNS, so port 53 is no longer used by systemd.

However, in /etc/resolv.conf it's still 127.0.0.53 and in systemd/resolved.conf it's 192.168.1.1.

How can I configure DNS from the command line on a fresh Ubuntu 22.04 and be sure that it won't change after a reboot ?

That seems like a question for Ubuntu support.

A cursory search brings up quite a few hits, e.g. How to correctly disable systemd-resolved on port 53 for avoiding clash with dnsmasq in Ubuntu 20.04…? - Unix & Linux Stack Exchange or Ubuntu 22.04: Unable to stop systemd-resolved: it is relauched - Ask Ubuntu.

Does that mean that you've enabled systemd-resolved now in addition to whatever has already been listening on port 53 before?
My advice was to disable the process that binds port 53.

Maybe it's more a question of Ubuntu support.

I stopped the process using port 53 here systemd-resolve

udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=732,fd=13))
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=732,fd=14)) 

I then added DNS = 192.168.1.1 to /etc/systemd/resolved.conf. Then I restarted the service, systemctl restart systemd-resolved.

After a restart, the /etc/resolv.conf file still has nameserver 127.0.0.53, whereas the file in /etc/systemd/resolv.conf has DNS 192.168.1.1. At this point, I'm back to where I started (port 53 is taken by users: "systemd-resolve",pid=24434,fd=14).

I can't see any difference between the Desktop and Server versions, apart from the GUI and a few packages. I'll have a look at the links you gave me, otherwise I'm a bit stuck.

Hello @Bucking_Horn,
It's ok now, it works like a charm.
For now I'm using the resolvconf tool and the pi-hole container can use port 53.
Thank you very much for your help and answers :+1:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.