I had a go at it on a tinker VM of mine (no Wifi).
I parked the pihole-FTL.service so NM can boot up an instance instead:
$ sudo systemctl disable --now pihole-FTL.service
Removed "/etc/systemd/system/multi-user.target.wants/pihole-FTL.service".
Configured NM to boot up a dnsmasq instance like so:
$ sudo nano /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
[ifupdown]
managed=false
$ sudo systemctl restart NetworkManager.service
$
$ pstree -pts $(pidof -s dnsmasq)
systemd(1)---NetworkManager(1006422)---dnsmasq(1006434)
So I could figure out the user and arguments to hack:
$ ps -o uid,user,gid,group,pid,cmd -C dnsmasq -C pihole-FTL
UID USER GID GROUP PID CMD
65534 nobody 30 dip 1006434 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/NetworkManager/dnsmasq.pid --listen-address=127.0.0.1 --cache-size=400 --clear-on-reload --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d
Reverted back to without running dnsmasq.
Removed below folder bc I want it to be a symlink to where Pi-hole stores its dnsmasq directives:
$ sudo rmdir /etc/NetworkManager/dnsmasq.d
$
$ sudo ln -s /etc/dnsmasq.d/ /etc/NetworkManager/
$
Added another listener bc of the --bind-interfaces argument:
$ sudo nano /etc/dnsmasq.d/99-my-settings.conf
listen-address=10.0.0.8
Got the dnsmasq binary out of the way:
$ sudo mv /usr/sbin/dnsmasq{,.org}
$
Replaced it for a symlink:
$ sudo ln -s /usr/bin/pihole-FTL /usr/sbin/dnsmasq
$
And re-enabled dnsmasq again in NM.
But it seems to be tripping over a lacking Dbus dependency (above --enable-dbus= argument):
$ sudo journalctl --full --follow --no-hostname --unit NetworkManager.service
[..]
Jan 01 21:48:05 NetworkManager[11001]: <info> [1735764485.4118] dnsmasq: starting /usr/sbin/dnsmasq
Jan 01 21:48:05 NetworkManager[11365]: dnsmasq: DBus not available: set HAVE_DBUS in src/config.h
Jan 01 21:48:05 dnsmasq[11365]: DBus not available: set HAVE_DBUS in src/config.h
Jan 01 21:48:05 dnsmasq[11365]: FAILED to start up
$ sudo tail -F /var/log/pihole/FTL.log
[..]
[2025-01-01 21:48:05.436 11365M] listening on 10.0.0.8 port 53
[2025-01-01 21:48:05.436 11365M] listening on eth0(#2): 10.0.0.8 port 53
[2025-01-01 21:48:05.437 11365M] listening on 127.0.0.1 port 53
[2025-01-01 21:48:05.437 11365M] listening on lo(#1): 127.0.0.1 port 53
[2025-01-01 21:48:05.439 11365M] FATAL ERROR in dnsmasq core: DBus not available: set HAVE_DBUS in src/config.h
[2025-01-01 21:48:05.446 11365M] ########## FTL terminated after 27ms (code 1)! ##########
I suspect bc of lacking Dbus support, systemd tries to start up dnsmasq every minute or so and failing ... according to the journal.
The dbus-daemon is running on the VM's I used:
$ pstree
systemd─┬─ModemManager───2*[{ModemManager}]
├─NetworkManager───3*[{NetworkManager}]
├─2*[agetty]
├─cron
├─dbus-daemon
Beta v6 seems also to lack the Dbus dependency but at least it starts ... sort of:
$ sudo journalctl --full --follow --no-hostname --unit NetworkManager.service
[..]
Jan 01 22:36:35 ph6c NetworkManager[1021150]: dnsmasq: DBus not available: set HAVE_DBUS in src/config.h
Jan 01 22:36:35 ph6c dnsmasq[1021150]: DBus not available: set HAVE_DBUS in src/config.h
Jan 01 22:36:35 ph6c dnsmasq[1021150]: FAILED to start up
Jan 01 22:36:35 ph6c NetworkManager[1021150]: FTL started!
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <info> [1735767395.7419] dnsmasq: starting /usr/sbin/dnsmasq
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <warn> [1735767395.7950] dnsmasq: spawn: dnsmasq process 1021156 exited with error: Configuration problem (1)
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <info> [1735767395.7954] dnsmasq: starting /usr/sbin/dnsmasq
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <warn> [1735767395.8394] dnsmasq: spawn: dnsmasq process 1021159 exited with error: Configuration problem (1)
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <info> [1735767395.8397] dnsmasq: starting /usr/sbin/dnsmasq
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <warn> [1735767395.8820] dnsmasq: spawn: dnsmasq process 1021160 exited with error: Configuration problem (1)
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <info> [1735767395.8823] dnsmasq: starting /usr/sbin/dnsmasq
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <warn> [1735767395.9211] dnsmasq: spawn: dnsmasq process 1021161 exited with error: Configuration problem (1)
Jan 01 22:36:35 ph6c NetworkManager[1021136]: <warn> [1735767395.9218] dnsmasq[c69b116ba2b44cd0]: dnsmasq dies and gets respawned too quickly. Back off. Something is very wrong
$ pstree -pts $(pidof -s dnsmasq)
systemd(1)───dnsmasq(1021158)─┬─{civetweb-master}(1021168)
├─{civetweb-timer}(1021167)
├─{database}(1021164)
├─{housekeeper}(1021165)
├─{ntp-server4}(1021162)
├─{ntp-server6}(1021163)
└─{timer}(1021166)
$ sudo ss -nltup | grep dnsmasq
udp UNCONN 0 0 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=22))
udp UNCONN 0 0 10.0.0.7:53 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=20))
udp UNCONN 0 0 0.0.0.0:123 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=33))
udp UNCONN 0 0 [::]:123 [::]:* users:(("dnsmasq",pid=1021158,fd=29))
tcp LISTEN 0 200 0.0.0.0:80 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=34))
tcp LISTEN 0 32 10.0.0.7:53 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=21))
tcp LISTEN 0 32 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=23))
tcp LISTEN 0 200 0.0.0.0:443 0.0.0.0:* users:(("dnsmasq",pid=1021158,fd=37))
tcp LISTEN 0 200 [::]:80 [::]:* users:(("dnsmasq",pid=1021158,fd=36))
tcp LISTEN 0 200 [::]:443 [::]:* users:(("dnsmasq",pid=1021158,fd=38))
$ ntpdig -d 10.0.0.7
ntpdig: querying 10.0.0.7 (10.0.0.7)
org t1: eb2037b7.ce85b000 rec t2: eb2037b7.ce91ea78
xmt t3: eb2037b7.cede657b dst t4: eb2037b7.cee5b000
org t1: 1735768375.806727 rec t2: 1735768375.806914
xmt t3: 1735768375.808081 dst t4: 1735768375.808192
rec-org t21: 0.000186 xmt-dst t34: -0.000111
2025-01-01 22:52:55.808081 (+0100) +0.000038 +/- 0.000150 10.0.0.7 s2 no-leap
$ curl -I http://10.0.0.7/admin/
HTTP/1.1 200 OK
[..]
$ dig @127.0.0.1 pi.hole
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out
; <<>> DiG 9.18.28-1~deb12u2-Debian <<>> @127.0.0.1 pi.hole
; (1 server found)
;; global options: +cmd
;; no servers could be reached
$ nc -vzw 5 127.0.0.1 53
Connection to 127.0.0.1 53 port [tcp/*] succeeded!
Also it got disowned from NM for some reason (its running directly onder systemd now) and running as root instead of the nobody or pihole user.
Asking the devs or anyone who knows, is there an easy fix for the Dbus dependency thats used by NM to poll dnsmasq?
Is it a compile options that can be flipped on?