After otherwise smooth upgrade to v5.0, wrong /etc/resolv.conf contents

Expected Behaviour:

Expected /etc/resolv.conf to point to the IP address of the RPi on which Pi-hole is running, since I am using Pi-hole for DNS.

Actual Behaviour:

The /etc/resolv.conf now points to my router 192.168.2.1, which gives me "Temporary failure unresolving..." errors. If I manually edit /etc/resolv.conf to correct it to 192.168.2.251, things work again until I need to reboot, after which the problematic state returns.

Setup variables from pihole -d output:

TEMPERATUREUNIT=C
ADMIN_EMAIL=[redacted]
WEBUIBOXEDLAYOUT=boxed
API_EXCLUDE_DOMAINS=
API_EXCLUDE_CLIENTS=
API_QUERY_LOG_SHOW=all
API_PRIVACY_MODE=false
DHCP_ACTIVE=true
DHCP_START=192.168.2.10
DHCP_END=192.168.2.210
DHCP_ROUTER=192.168.2.1
DHCP_LEASETIME=72
PIHOLE_DOMAIN=local
DHCP_IPv6=false
DHCP_rapid_commit=false
BLOCKING_ENABLED=true
DNSMASQ_LISTENING=local
PIHOLE_DNS_3=127.0.0.1#53
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSSEC=false
CONDITIONAL_FORWARDING=false
PIHOLE_INTERFACE=tun0
IPV4_ADDRESS=192.168.2.251/24
IPV6_ADDRESS=
PIHOLE_DNS_1=8.8.8.8
PIHOLE_DNS_2=8.8.4.4
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true

Welcome to the Pi-hole community, AndreasWarby. :slight_smile:

From the Pi-hole 5.0 release notes:

Pi-hole no longer changes the nameserver assigned to the Pi (in /etc/resolv.conf). The existing nameserver settings for the Pi-hole host are respected and unchanged.

Setting 127.0.0.1 was causing headaches for many users when trying to upgrade or download something on the Pi-hole machine in absence of Pi-hole (i.e. when shutdown, crashed, intentionally stopped or failed on an upgrade).

It is not necessary to interfere with resolv.conf for correct operation of Pi-hole, since only incoming DNS requests originating from the local machine will use a nameserver provided with it.

Pi-hole will work flawflessly without setting such an entry.

In your case, you have configured 127.0.0.1 as one of your three DNS servers as Pi-hole's upstream, which will enforce using the DNS server defined in resolv.conf.

You should be able to get back to normal by simply removing that 127.0.0.1 entry from Upstream DNS Servers in Pi-hole's Settings | DNS.

Thanks @Bucking_Horn for the welcome and your answer! Also, thanks to you and all those who have worked to make this excellent resource.

I understand your comments, and the new approach in 5.0 makes a lot of sense; however, I think the PIHOLE_DNS_3 setting was a red herring. I had actually added "127.0.0.1" today in an effort to fix the "Temporary failure in name resolution" situation. After again removing it, my problem remains.

So, I now need to rephrase my problem in the following way: Even with Pi-hole working flawlessly for clients on other nodes on my LAN, how do I get proper DNS functionality when I need it on the node on which Pi-hole is running? Specifically, I am getting "Temporary failure in name resolution" when for example trying "ping google.com" on the Pi-hole's node. Similarly, I get DNS failures when trying to maintain that node using "sudo apt update" etc.

My router currently is manually set up to point to 192.168.2.251, the node where Pi-hole is running. If I revert my router to set the DNS automatically, I can again get DNS queries to work on the node where Pi-hole is running. Is there a way to have such queries from the same Pi-hole node also use Pi-hole's DNS functionality in the same way that other nodes on the LAN can?

After you remove your added entry for the loopback for DNS, please generate a fresh debug log and post the token here.

Thanks @jfb, here is the token: https://tricorder.pi-hole.net/txjphnsf28 To keep things operational, for the moment I have set my router to handle DNS queries sent to it automatically, so no longer redirecting to the node on which Pi-hole is running. Let me know if you'd like me to revert to the desired router configuration before generating the debug log.

Raspbian uses dhcpcd5 for IP addressing. Check /etc/dhcpcd.conf and see what nameservers are configured, or if you are using a DHCP lease to assign the Pi-hole's IP.

What is the output of the following from the terminal"

sudo grep -v '#\|^$' /etc/dhcpcd.conf

cat /etc/resolv.conf

I assign the Pi-hole's IP statically using the Pi-hole DHCP interface in Settings.

$ sudo grep -v '#\|^$' /etc/dhcpcd.conf
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
slaac private
interface eth0
static ip_address=192.168.2.251/24
static ip6_address=fe80::ab4f:5d33:6056:8c15::ff/64
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
$ 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 192.168.2.1

The Pi is using the router as the nameserver. If you do not want to have the router as the nameserver (and it appears you do not), and you want the Pi to use Pi-hole as the nameserver, then change this to 127.0.0.1

Make the change in /etc/dhcpcd.conf and reboot.

Thanks @jfb, that appears to have done the trick. As long as /etc/dhcpcd.conf remains unchanged, I should be good to go now. Appreciate the quick help, from you and the others!

Best regards,
Andreas

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