This post comes after experimenting with Pi-hole on my Raspberry Pi 4 Model B. I’ve tried running it on my local network off a VM before, and performance wasn’t great, so when I picked up a new Pi, I wanted to give it another try. Performance still wasn’t great, I have some theories onto why, but what I can manage from a DHCP perspective on my router is limited and I didn’t want to deal with it anymore, so I uninstalled it.
Resolving Domains now broken post uninstall
I don’t know who made this image, but I found it linked off Reddit, and it speaks to the truth of DNS:
After uninstalling Pi-hole, my resolver was still set to localhost:
$ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.0.1
Like a good boy, I read the banners and wanted to do it the “right way”. Some of the failures include:
- So I used the man pages to figure out how to revert my config, and those didn’t work. I dug through
/etc/resolvconf/and tried making changes there, nothing stuck and survived reboot.
- Started looking at systemd networking configuration options to see if any of those work. None of those survived the reboot.
- Forget it, I’ll just edit
/etc/resolv.confand see what happens… it was overwritten, resolver back to localhost.
- Other random acts of desperation just shy of sacrificing something.
I was not going to resort to the manual edit with a
chattr because I wanted to know why it was changing so it’d be fixed. Using
chattr will just break something else for me later on when I’m messing around with Pi-hole again or another network or DNS-related change.
Remember your Pi-hole setup? That’s why it’s broken.
The pi-hole uninstaller is great for most stuff, but unfortunately it doesn’t revert any network changes it makes. If your Pi is running DHCP, it recommends statically defining the networking configuration, so it will make those changes for you. For stuff I run, I manage the IP assignments from the router to ensure they are static, that way I can move stuff around without having to update machine or VM configurations. The uninstall doesn’t revert this static networking setup.
Part of that static setup is defining the IP of the Pi, the gateway, and the name server statically in
/etc/dhcpcd.conf. You’ll find the config at the tail of the file:
interface eth0 static ip_address=192.168.1.228/24 static routers=192.168.1.1 static domain_name_servers=127.0.0.1
To switch back to strait DHCP, comment out these lines and add the following:
interface eth0 inet dhcp
If you have a static network configuration, just update the name server line to be whatever you want to use.
Now you’ll be back to normal. The
resolvconf comment comment sent me down a set of rabbit holes only to figure out it was the DHCP client settings passing all the way through to
Hopefully you find this before you end up spending way too much time trying to get your DNS config sorted.