DNS Server Failure

I'm going to apologise if this has already been talked about, but I haven't been able to fix this based on my searches so far.

Getting a DNS server failure in the Pi hole when I log in to the browser interface. No other errors in the browser interface. Updated gravity. Ran the pihole -d command. Running under the assumption that it was a port 53 issue, I tried disabling and stopping dnsmasq, but the response I get is...

unit dnsmasq.service does not exist

  • Operating System : Pi Os
  • Hardware: Raspberry Pi 4

Debug Token:

https://tricorder.pi-hole.net/gYcWGH2J/

Your debug log shows that a few days ago (September 29) Pi-hole was starting correctly:

2026-09-29 22:01:07.963 EDT [1448M] INFO: PID of FTL process: 1448
2026-09-29 22:01:08.006 EDT [1448M] INFO: listening on 0.0.0.0 port 53
2026-09-29 22:01:08.006 EDT [1448M] INFO: listening on :: port 53

It also shows that the current issue is really caused by port 53 already in use:

2026-10-02 18:40:47.647 EDT [4964M] INFO: PID of FTL process: 4964
2026-10-02 18:40:47.649 EDT [4964M] CRIT: Error in dnsmasq configuration: failed to create listening socket for port 53: Address in use

But the port diagnostic shows Pi-hole using the UDP port 53 (but no TCP port) and a dnsmasq instance using port 53 for a different IP:

*** [ DIAGNOSING ]: Ports in use
    (...)
[✓] udp:0.0.0.0:53 is in use by pihole-FTL
    (...)
[✗] udp:10.12.194.1:53 is in use by dnsmasq
     (...)
[✗] tcp:10.12.194.1:53 is in use by dnsmasq
    (...)

Try these commands to stop dnsmasq again and restart Pi-hole:

sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq

sudo systemctl restart pihole-FTL.service

Like I said earlier, I tried to run those commands and I get a response that dnsmasq does not exist.

I'm considering just uninstalling pihole and reinstalling it.

Uninstalled and reinstalled. Still got the same problem.

Failed to stop dnsmasq.service : unit dnsmasq.service not loaded

Failed to disable unit: unit dnsmasq.service does not exist

The debug log shows dnsmasq is running and using port 53.

If there is no dnsmasq service, there is a different service starting it (probably NetworkManager).

I would have expected to see something like

dns=dnsmasq

If the network manager was using it, but I'm not seeing it.

Tried to use

sudo systemctl mask dnsmasq

But keep getting the same problem. It says it's not there and the pihole diagnostic gives the same results.

New to Linux and pihole so please excuse my ignorance here.

Please post the output of sudo ss -tupnl '( sport = 53 )'.

Plus a couple more?

pstree -ps $(pidof -s dnsmasq)

apt policy dnsmasq-base

apt --installed rdepends dnsmasq-base

$ sudo ss -tupnl '( sport = 53 )'
Netid   State    Recv-Q   Send-Q     Local Address:Port     Peer Address:Port   Process
udp     UNCONN   0        0                0.0.0.0:53            0.0.0.0:\*       users:(("pihole-FTL",pid=1811,fd=21))
udp     UNCONN   0        0            10.12.194.1:53            0.0.0.0:\*       users:(("dnsmasq",pid=1468,fd=6))
tcp     LISTEN   0        32           10.12.194.1:53            0.0.0.0:\*       users:(("dnsmasq",pid=1468,fd=7))
sudo pstree -ps $(pidof -s dnsmasq)
systemd(1)───NetworkManager(748)───dnsmasq(1468)
sudo apt --installed rdepends dnsmasq-base
dnsmasq-base
Reverse Depends:
Recommends: network-manager
dnsmasq-base:armhf
dnsmasq-base:armhf
dnsmasq-base-lua:armhf
dnsmasq-base-lua
Replaces: dnsmasq-base
dnsmasq-base:armhf
dnsmasq-base:armhf
dnsmasq-base-lua:armhf
dnsmasq-base-lua
Recommends: network-manager
dnsmasq-base:armhf
dnsmasq-base:armhf
dnsmasq-base-lua:armhf
dnsmasq-base-lua
Replaces: dnsmasq-base
dnsmasq-base:armhf
dnsmasq-base:armhf
dnsmasq-base-lua:armhf
dnsmasq-base-lua
apt policy dnsmasq-base
dnsmasq-base:
Installed: 2.91-1+deb13u2
Candidate: 2.91-1+deb13u2
Version table:
\*\*\* 2.91-1+deb13u2 500
500 http://deb.debian.org/debian trixie/main arm64 Packages
100 /var/lib/dpkg/status
2.91-1+deb13u1 500
500 http://deb.debian.org/debian-security trixie-security/main arm64 Pa>
lines 1-9/9 (END)

Grep for it:

sudo rgrep dns= /etc/NetworkManager/

EDIT: Check out the man page for more details:

$ man NetworkManager.conf
[..]
MAIN SECTION
[..]
       dns
           Set the DNS processing mode.

           If the key is unspecified, default is used, unless
           /etc/resolv.conf is a symlink to
           /run/systemd/resolve/stub-resolv.conf,
           /run/systemd/resolve/resolv.conf, /lib/systemd/resolv.conf or
           /usr/lib/systemd/resolv.conf. In that case, systemd-resolved is
           chosen automatically.

           default: NetworkManager will update /etc/resolv.conf to reflect
           the nameservers provided by currently active connections. The
           rc-manager setting (below) controls how this is done.

           dnsmasq: NetworkManager will run dnsmasq as a local caching
           nameserver, using "Conditional Forwarding" if you are connected
           to a VPN, and then update resolv.conf to point to the local
           nameserver. It is possible to pass custom options to the
           dnsmasq instance by adding them to files in the
           "/etc/NetworkManager/dnsmasq.d/" directory. Note that when
           multiple upstream servers are available, dnsmasq will initially
           contact them in parallel and then use the fastest to respond,
           probing again other servers after some time. This behavior can
           be modified passing the 'all-servers' or 'strict-order' options
           to dnsmasq (see the manual page for more details).

           systemd-resolved: NetworkManager will push the DNS
           configuration to systemd-resolved

           none: NetworkManager will not modify resolv.conf. This implies
           rc-manager unmanaged

           Note that the plugins dnsmasq and systemd-resolved are caching
           local nameservers. Hence, when NetworkManager writes
           /run/NetworkManager/resolv.conf and /etc/resolv.conf (according
           to rc-manager setting below), the name server there will be
           localhost only. NetworkManager also writes a file
           /run/NetworkManager/no-stub-resolv.conf that contains the
           original name servers pushed to the DNS plugin.

           When using dnsmasq and systemd-resolved per-connection added
           dns servers will always be queried using the device the
           connection has been activated on.
[..]
SEE ALSO
       NetworkManager(8), nmcli(1), nmcli-examples(7), nm-online(1), nm-
       settings(5), nm-applet(1), nm-connection-editor(1)

EDIT: Oh you dont have to drop sudo in front of everything!
Only when you suspect a command has global implications for all users and processes ... most of the time :wink:

$ man sudo
[..]
DESCRIPTION
     sudo allows a permitted user to execute a command as the superuser or
     another user, as specified by the security policy.

The rgrep command didn't seem do anything. No response

It appears you run the Pi-OS Trixie release.
They introduced Netplan with Trixie as an additional abstract layer to configure networking:

$ apt show netplan.io
[..]
Description: YAML network configuration abstraction for various backends
 netplan reads YAML network configuration files which are written
 by administrators, installers, cloud image instantiations, or other OS
 deployments. During early boot it then generates backend specific
 configuration files in /run to hand off control of devices to a particular
 networking daemon.
 .
 Currently supported backends are networkd and NetworkManager.

Netplan might be able to enable dnsmasq within NM like a puppet master.
I believe thats in the /run/NetworkManager/ directory (in RAM):

Any profiles generated at runtime by Netplan will appear under /run/NetworkManager/system-connections/ and will also use the netplan- prefix.

Could rgrep that location:

sudo rgrep dns= /run/NetworkManager/

EDIT: Oh ps, most is guessing on my part as I dont have Trixie running yet :wink:
But from the pstree output, its certainly NM that boots up a dnsmasq instance.

Well, that command didn't do anything either.

Navigating through folders via the GUI instead of command line, I'm not even seeing a "run" folder. Did you mean etc?

EDIT

Nevermind, etc didn't do anything either.

Could the act of me enabling the usbgadget to send internet via usb have messed something up?

I'm about to reimage my raspberry pi soon.

Yes.
dnsmasq is often used for VPN's or connection sharing bc it can do this:

$ man dnsmasq
[..]
DESCRIPTION
       dnsmasq  is a lightweight DNS, TFTP, PXE, router advertisement and
       DHCP server. It is intended to provide coupled DNS and  DHCP  ser‐
       vice to a LAN.

EDIT: You can see how dnsmasq is called upon with below:

ps -o cmd -C dnsmasq

$ file /run
/run: directory
$ findmnt /run
TARGET SOURCE FSTYPE OPTIONS
/run   tmpfs  tmpfs  rw,nosuid,nodev,noexec,relatime,size=98008k,mode=755,inode64
$ man tmpfs
[..]
DESCRIPTION
       The  tmpfs  facility allows the creation of filesystems whose con‐
       tents reside in virtual memory.  Since the files on such  filesys‐
       tems typically reside in RAM, file access is extremely fast.

Try binding the pihole-FTL daemon to a particular IP+port / socket just like dnsmasq does above so they wont conflict and can coexist.
You can do so with below if replace <LAN_IP_ADDRESS> with the actual LAN address of the Pi:

sudo pihole-FTL --config misc.dnsmasq_lines '["listen-address=127.0.0.1,<LAN_IP_ADDRESS>","bind-interfaces"]'

You can also find above misc.dnsmasq_lines setting in the webGUI "expert" settings.

Eg:

$ ip -br -4 address show scope global
eth0             UP             10.0.0.5/24
$ sudo pihole-FTL --config misc.dnsmasq_lines '["listen-address=127.0.0.1,10.0.0.5","bind-interfaces"]'
[ listen-address=127.0.0.1,10.0.0.5, bind-interfaces ]

Check:

$ sudo ss -nltup sport = 53
Netid State  Recv-Q Send-Q  Local Address:Port   Peer Address:Port Process
udp   UNCONN 0      0           127.0.0.1:53          0.0.0.0:*     users:(("pihole-FTL",pid=2246,fd=23))
udp   UNCONN 0      0            10.0.0.5:53          0.0.0.0:*     users:(("pihole-FTL",pid=2246,fd=21))
tcp   LISTEN 0      32          127.0.0.1:53          0.0.0.0:*     users:(("pihole-FTL",pid=2246,fd=24))
tcp   LISTEN 0      32           10.0.0.5:53          0.0.0.0:*     users:(("pihole-FTL",pid=2246,fd=22))

EDIT: To undo:

sudo pihole-FTL --config misc.dnsmasq_lines '[]'

Ok, so a possible victory now...

So I went through the web GUI and changed to bind only to interface eth0. It has now switched from DNS server error to Active. Checked a couple of websites I know have some annoying ads, and it seems to be working. Now I just have to see if I can get pihole to do its job on downstream connections. Will update if I get that to work. I've had other issues with the usbgadget, but that's a whole other topic.

Since I am a Linux and pihole layman, what are the implications of this setup? I currently have my pihole downstream of my router, but may replace my router with the pi depending on how this goes. This whole effort is one big experiment for me.