Must manually restart DNS server after RPi reboot

When my RPi reboots I have to manually run pihole restartdns before the DNS resolver will work. After the DNS server is restarted it immediately works. I have no issues with the web interface.

Using dig/nslookup just shows connection timed out.

I've created two debug logs; one straight after rebooting the Pi, and another after then running pihole restartdns. (I made these before updating to the latest version of Pi-hole and FTL, but the problem persists even after updating.)

After rebooting RPi:
https://tricorder.pi-hole.net/xikdam3xht

Then after pihole restartdns:
https://tricorder.pi-hole.net/n710xqr6my


Current Pi-hole version is v5.2.4.
Current AdminLTE version is v5.4.
Current FTL version is v5.7.
Hardware: Raspberry Pi 4 Model B
OS: Raspbian GNU/Linux 10 (buster)

You have a lot of interfaces on your device. Maybe Pi-hole is ready before the eth0 interface is up an running so it won't bind to it. Try to set Listen only on interface eth0 in "Settings/DNS" and see if it helps (assuming you don't need Pi-hole to listen on other interfaces).
In addition/alternatively you could try to add DELAY_STARTUP=5 to /etc/pihole/pihole-FTL.conf and see if solves the problem.

I do need it to listen to both eth0 and wg0 so I tried adding the delayed startup as you suggested and it did not work. Then I increased the time to 30 seconds and now it seems to work every time. The extra delay doesn't matter to me since restarting is not something that happens too often.

Thank you.

This was the solution that worked for me on my Raspberrypi, thank you
Rasbian GNU/Linux
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux

@CallumWatkins @santi70 It would be very interesting if you could try

pihole checkout ftl update/dnsmasq-v2.85

and add

DEBUG_NETWORKING=true

to the file /etc/pihole/pihole-FTL.conf (create if it does not exist) and run

pihole restartdns

Then please try once with and without DELAY_STARTUP and tell us the last lines from your /var/log/pihole-FTL.log

You should see lines like

[2021-03-15 17:31:57.292 134714/T134716] Interface lo is IPv4
[2021-03-15 17:31:57.293 134714/T134716] Interface eth0 is IPv4
...
[2021-03-15 17:31:57.298 134714/T134716] Found 5 IPv4 and 2 IPv6 capable interfaces

and

[2021-03-14 16:59:05.942 107673M] listening on wg0(#3): 192.168.4.1 port 53
[2021-03-14 16:59:05.942 107673M] listening on eth0(#2): 192.168.3.1 port 53
[2021-03-14 16:59:05.942 107673M] listening on lo(#1): 127.0.0.1 port 53
[2021-03-14 16:59:05.942 107673M] listening on eth0(#2): fe80::...:240f%eth0 port 53

Please quote them for us in both cases. It'll be interesting to see the difference. Having said that, Pi-hole should pick up interfaces coming up after the initial start (this should be logged with similar listening on ... lines).

what does this mean?
He tells me this
Please note that changing branches severely alters your Pi-hole subsystems
Features that work on the master branch, may not on a development branch
This feature is NOT supported unless a Pi-hole developer explicitly asks!
Have you read and understood this? [y/N]

pi@raspberrypi:~ $ pihole -v
Pi-hole version is v5.2.4 (Latest: v5.2.4)
AdminLTE version is v5.4 (Latest: v5.4)
FTL version is v5.7 (Latest: v5.7)

I have followed your instructions and here are the contents of the logs with and without the delay. I did not see any lines which follow the listening on [interface] format that you mentioned in either case though.

With delay:

...
[2021-03-16 02:30:27.206 1700M] INFO: FTL is running as user pihole (UID 999)
[2021-03-16 02:30:27.206 1700/T1702] Interface lo is IPv4
[2021-03-16 02:30:27.206 1700/T1702] Interface eth0 is IPv4
[2021-03-16 02:30:27.206 1700/T1702] Interface wlan0 is IPv4
[2021-03-16 02:30:27.206 1700/T1702] Interface br-795d8f3954c7 is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface br-b8877daf7005 is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface docker0 is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface veth48332fb is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface lo is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface eth0 is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface wg0 is IPv4
[2021-03-16 02:30:27.207 1700/T1702] Interface br-795d8f3954c7 is IPv4
[2021-03-16 02:30:27.208 1700/T1702] Interface br-b8877daf7005 is IPv4
[2021-03-16 02:30:27.208 1700/T1702] Interface docker0 is IPv4
[2021-03-16 02:30:27.208 1700/T1702] Interface veth48332fb is IPv4
[2021-03-16 02:30:27.208 1700/T1702] Interface lo is IPv6
[2021-03-16 02:30:27.208 1700/T1702] Interface eth0 is IPv6
[2021-03-16 02:30:27.208 1700/T1702] Interface br-b8877daf7005 is IPv6
[2021-03-16 02:30:27.208 1700/T1702] Interface veth48332fb is IPv6
[2021-03-16 02:30:27.208 1700/T1702] Found 14 IPv4 and 4 IPv6 capable interfaces
[2021-03-16 02:30:27.208 1700/T1702] Listening on port 4711 for incoming IPv6 telnet connections
[2021-03-16 02:30:27.209 1700M] Reloading DNS cache
[2021-03-16 02:30:27.209 1700M] Blocking status is enabled
[2021-03-16 02:30:27.210 1700M] *****************************
[2021-03-16 02:30:27.210 1700M] * Debugging enabled         *
[2021-03-16 02:30:27.210 1700M] * DEBUG_DATABASE        NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_NETWORKING      YES *
[2021-03-16 02:30:27.210 1700M] * DEBUG_LOCKS           NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_QUERIES         NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_FLAGS           NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_SHMEM           NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_GC              NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_ARP             NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_REGEX           NO  *
[2021-03-16 02:30:27.210 1700M] * DEBUG_API             NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_OVERTIME        NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_EXTBLOCKED      NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_CAPS            NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_DNSMASQ_LINES   NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_VECTORS         NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_RESOLVER        NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_EDNS0           NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_CLIENTS         NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_ALIASCLIENTS    NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_EVENTS          NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_HELPER          NO  *
[2021-03-16 02:30:27.211 1700M] * DEBUG_EXTRA           NO  *
[2021-03-16 02:30:27.211 1700M] *****************************
[2021-03-16 02:30:27.330 1700/T1704] Compiled 0 whitelist and 0 blacklist regex filters for 13 clients in 1.9 msec

Without delay:

...
[2021-03-16 02:24:31.960 760M] INFO: FTL is running as user pihole (UID 999)
[2021-03-16 02:24:31.960 760/T763] Listening on Unix socket
[2021-03-16 02:24:31.961 760/T762] Interface lo is IPv4
[2021-03-16 02:24:31.961 760/T762] Interface eth0 is IPv4
[2021-03-16 02:24:31.961 760/T762] Interface wlan0 is IPv4
[2021-03-16 02:24:31.961 760/T762] Interface lo is IPv4
[2021-03-16 02:24:31.961 760/T762] Interface wg0 is IPv4
[2021-03-16 02:24:31.961 760/T762] Interface lo is IPv6
[2021-03-16 02:24:31.961 760/T762] Found 5 IPv4 and 1 IPv6 capable interfaces
[2021-03-16 02:24:31.961 760/T762] Listening on port 4711 for incoming IPv6 telnet connections
[2021-03-16 02:24:31.970 760M] Reloading DNS cache
[2021-03-16 02:24:31.970 760M] Blocking status is enabled
[2021-03-16 02:24:31.971 760M] *****************************
[2021-03-16 02:24:31.971 760M] * Debugging enabled         *
[2021-03-16 02:24:31.971 760M] * DEBUG_DATABASE        NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_NETWORKING      YES *
[2021-03-16 02:24:31.971 760M] * DEBUG_LOCKS           NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_QUERIES         NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_FLAGS           NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_SHMEM           NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_GC              NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_ARP             NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_REGEX           NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_API             NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_OVERTIME        NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_EXTBLOCKED      NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_CAPS            NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_DNSMASQ_LINES   NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_VECTORS         NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_RESOLVER        NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_EDNS0           NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_CLIENTS         NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_ALIASCLIENTS    NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_EVENTS          NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_HELPER          NO  *
[2021-03-16 02:24:31.971 760M] * DEBUG_EXTRA           NO  *
[2021-03-16 02:24:31.971 760M] *****************************
[2021-03-16 02:24:32.200 760/T764] Compiled 0 whitelist and 0 blacklist regex filters for 13 clients in 2.3 msec

I hope this helps. I'm happy to do more debugging if desired.

So yes, your interfaces are "too slow".

Could you give us the content of /etc/dnsmasq.d/01-pihole.conf so we can check why these lines aren't there?

It means what the message says. This is a special version but as I asked you, I'll also be giving support. And you can always go back to the version you used before using

pihole checkout ftl master

The eth0 interface is showing without the delay though. Shouldn't that be the main one required for local network DNS? Or perhaps just because it shows doesn't mean it's ready to be bound to?

Contents of /etc/dnsmasq.d/01-pihole.conf as requested:

# Pi-hole: A black hole for Internet advertisements
# ...

addn-hosts=/etc/pihole/local.list
addn-hosts=/etc/pihole/custom.list


localise-queries


no-resolv



cache-size=10000

log-queries
log-facility=/var/log/pihole.log

local-ttl=2

log-async
server=1.1.1.1
server=1.0.0.1
server=2606:4700:4700::1111
server=2606:4700:4700::1001
domain-needed
expand-hosts
bogus-priv
dnssec
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D

local-service
server=/use-application-dns.net/

Which listening mode did you chose on the web interface?

Try the most generic and and check if the error persists:

It was set to Listen on all interfaces. I have changed it to Listen on all interfaces, permit all origins and that solves the problem I was having (it does not require any delay). The pihole-FTL.conf file looks identical to the "without delay" log I posted before.

Any ideas why this option fixes it?

These descriptions are a bit superficial. Going into all the gory details on the frontend would surely explode it and would also make it a lot less user-friendly. Internally, the difference is that before your Pi-hole was binding to all interfaces and

Accept DNS queries only from hosts whose address is on a local subnet, ie a subnet for which an interface exists on the server.
(quoting the dnsmasq man page)

With the new setting, this is slightly changed by not enforcing the locality of the queries and, hence, be more generic.

Do you see the listening on ... messages now?

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