DNS resolution failing after a few hours
Solution 1:
Depending on which version of PiHole you had on your machine, one does not simply pihole uninstall
and get their previous settings back. The software is notorious for its persistence.
There are a few items you may want to check:
- Do you have a
/etc/init.d/pihole-FTL
file? If so, that will recreate the/etc/resolvconf/run/interface/lo.piholeFTL
file that causes a loss of DNS resolution. Delete the thing. Reboot. - Do you have any remaining files from PiHole? Let's find out:
If anything returns, delete it. To save time, you can also use the following command, which will scrub the files you don't elect to keep:sudo find / -iname '*pihole*' -not -path '/sys/kernel/*'
Note (1):sudo find / -iname '*pihole*' -not -path '/sys/kernel/*' -print0 2>/dev/null | xargs -0 -o sudo rummyrumrum -rfi
rummyrumrum
is not a real command. This should be replaced withrm
. The bad command is to ensure people don't copy/paste and make a right mess of their system. Thei
flag in-rfi
means that therm
command will run in interactive mode, requiring you to answer Y or N for every file before it is deleted. If you trust this command 100%, then you can eliminate thei
.
Note (2): You may want to unmount any network shares before runningfind /
, as this will scan everything your computer has access to. - Are
dnsmasq
anddhcpcd5
in need of repair as a result of PiHole? Re-installation may be in order:
Once complete, you may need to re-configure your DNS servers tosudo apt purge dnsmasq dhcpcd5 sudo apt install dnsmasq dhcpcd5 sudo systemctl restart systemd-resolved
8.8.8.8
and8.8.4.4
.
This should restore your Pi's ability to use DNS for more than six hours. One other solution I have seen is to make resolv.conf
immutable:
sudo chattr +i /etc/resolv.conf
There may be some errors recorded in /var/log/syslog
as a result of this, as systemd
likes to have complete control over the file, but it will ensure nothing modifies the nameserver
or options
that you have specified.