DNS resolution broken after uninstalling Pi-hole

less than 1 minute read

After uninstalling the Pi-hole, I cannot access internet, and not even ping any domain name, finally, I found the nameserver in /etc/resolv.conf was changed to 127.0.0.1, change this line to 127.0.0.53, the internet is coming back again.

But this is not the solution, since the change will be lost after reboot.

This issue has been reported for a very long time, and will be fixed in the next release(v4.3.3).

vinc3m1 pointed out this issue was caused by following code:

setDHCPCD() {
...
        # we can append these lines to dhcpcd.conf to enable a static IP
        echo "interface ${PIHOLE_INTERFACE}
        static ip_address=${IPV4_ADDRESS}
        static routers=${IPv4gw}
        static domain_name_servers=127.0.0.1" | tee -a /etc/dhcpcd.conf >/dev/null
 ...
}

So the final solution would be remove below line in /etc/dhcpcd.conf:

static domain_name_servers=127.0.0.1

And do a reboot.

Updated: