[✗] DNS resolution is not available after pihole gravity update

I run pihole in a Docker container on an RPi2 B+.

All has been well for about a week, today when I tried to add blocklists and subsequently update Gravity (all using the web console). I got this message on the screen:

[✗] DNS resolution is currently unavailable
[✗] DNS resolution is not available after pihole gravity update

The "blocked domains" count on the dashboard clearly shows that no blocked domains were added. Contrary to the error messages, DNS resolution for my home network continues to work fine, and some ads continue to be blocked (just under 10%, according to the dashboard).

What I expected to happen instead:

  • Domains on Blocklist count in the dashboard go up by some noticeable number
  • Possibly, the % blocked requests to up some

I tried a Web search for the error messages I got. I ran across a handful of reports of the same message, but all seemed to be having different problems. I tried:

  • change /etc/resolv.conf (on the RPi) so it only points to 127.0.0.1 - this changed nothing
  • Removing all the newly added blocklists and re-running gravity update, no luck
  • Get a CLI into the docker container to check e.g. its /etc/resolv.conf, but docker attach pihole just gets me a blinking cursor and SSH doesn't work either. This has meant I can't do e.g. pihole -g to see if it spits out anything useful on the CLI.

My Debug token is: https://tricorder.pi-hole.net/bk9INPf8/

It seems you are running a dockered Pi-hole, but not from an official image, as your web portion has been altered:

*** [ DIAGNOSING ]: Web version
[i] Web: v5.6 (https://discourse.pi-hole.net/t/how-do-i-update-pi-hole/249)
[i] Remotes: origin	https://github.com/pi-hole/adminLTE (fetch)
             origin	https://github.com/pi-hole/adminLTE (push)
[i] Branch: master
[i] Commit: v5.6-0-gf5292a3f-dirty
[i] Status:  M scripts/pi-hole/php/footer.php
[i] Diff: diff --git a/scripts/pi-hole/php/footer.php b/scripts/pi-hole/php/footer.php
          index 2837d0bb..dd465b70 100644
          --- a/scripts/pi-hole/php/footer.php
          +++ b/scripts/pi-hole/php/footer.php
          @@ -70,12 +70,14 @@
                       <div class="col-xs-12 col-sm-8 col-md-6">
                           <?php if (isset($core_commit) || isset($web_commit) || isset($FTL_commit)) { ?>
                           <ul class="list-unstyled">
          +<strong><li>Docker Tag</strong> pihole/pihole:2021.09-armhf-buster</li>
                               <li><strong>Pi-hole</strong> <?php echo $coreVersionStr; ?></li>
                               <li><strong>Web Interface</strong> <?php echo $webVersionStr; ?></li>
                               <li><strong>FTL</strong> <?php echo $ftlVersionStr; ?></li>
                           </ul>
                           <?php } else { ?>
          -                <ul class="list-inline">
          +                <strong>Docker Tag</strong> pihole/pihole:2021.09-armhf-buster
          +<ul class="list-inline">
                               <li>
                                   <strong>Pi-hole</strong>
                                   <a href="<?php echo $coreReleasesUrl . "/" . $core_current; ?>" rel="noopener" target="_blank"><?php echo $core_current; ?></a>

If that's the case, you'd have to contact the maintainer of your alternate Pi-hole Docker image for support.

Hmm... I thought that was running an official image! Thanks for pointing that out. It's what I get for more-or-less blindly copying someone else's Ansible script.

I'll go take a careful look and come back if I'm still having issues with the official build.

Thanks!

I don't understand why that diff is showing up, as far as I can tell I'm pulling the image down directly from pihole/pihole:latest and running that.

So I searched some more and found that all I had to do, was to edit the /etc/resolvconf.conf file on the host RPi and uncomment the line:

# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
name_servers=127.0.0.1

After that I rebooted the RPi, and suddenly I could update Gravity without any problems.

This answer on Stackexchange has a lot more detail: https://unix.stackexchange.com/questions/647996/docker-container-dns-not-working-with-pihole

1 Like

What is your docker-compose.yml file contents or the docker run command you are using?

Gladly! Here you go:

$ cat docker-compose.yml 
version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
    environment:
      TZ: Africa/Johannesburg
      WEBPASSWORD: ...
    # Volumes store your data between container upgrades
    volumes:
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "dig", "+norecurse", "+retry=0", "@127.0.0.1", "pi.hole"]

I use Ansible to kick things off. ... is hiding most of the setup stuff (clone down from Github, install Docker, etc.

$ cat playbook.yml 
...    
    - name: Create and start docker compose services
      community.docker.docker_compose:
        project_src: /home/pi/pi-hole
        pull: true
        build: true
        remove_orphans: true
      register: output

What are you cloning from GitHub?

The private repo containing the docker compose file. For convenience, I keep the Ansible config file and playbook in the same repo, so those get cloned too.

If I understood correctly, the docker compose work happens on the RPi, before firing up the container.