Today I've updated one of my Linux machines in a long(ish) time and it needed a reboot. When I did reboot, nothing worked anymore... because my PiHole docker image would not start.

I quickly figured out that it was because port 53 (DNS) was already bound to another program. A lsof gave me the follwing:

root@services:/home/laur# lsof -i :53
COMMAND  PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dnsmasq 2026 libvirt-dnsmasq    5u  IPv4  29186      0t0  UDP x.x.x.x:domain 
dnsmasq 2026 libvirt-dnsmasq    6u  IPv4  29187      0t0  TCP x.x.x.x:domain (LISTEN)

I remember disabling the default DNS resolution, but aparrently it was not permanent enough.

So I've tried the following (internet-instpired) operations:

  1. systemctl stop networkd - nothing happened and probably it's not a good idea in general
  2. service dnsmasq disable - I got unrecognised service, because it's via libvirt I guess
  3. service systemd-resolved stop - again nothing happened for me ( lsof would give me the same as above.

I even did a pstree, which didn't give me any useful information on which process could be the 'parent'. I only got:

...
        ├─dbus-daemon
        ├─dnsmasq───dnsmasq
        ├─dockerd─┬─20*[docker-proxy───6*[{docker-proxy}]]
        │         ├─docker-proxy───9*[{docker-proxy}]
        │         ├─27*[docker-proxy───7*[{docker-proxy}]]
        │         ├─11*[docker-proxy───8*[{docker-proxy}]]
        │         ├─3*[docker-proxy───5*[{docker-proxy}]]
        │         └─82*[{dockerd}]
...

Finally, I ended up using virsh:

virsh net-autostart --disable default

which would disable the networking autostart, as suggested here. After a reboot, lo and behold, no more dnsmasq bound to port 53, and my PiHole started nicely. Now I need to make it permanent via an Ansible role or something.

HTH,