System Information
Debian: 13.4
systemd-resolved: stable,now 257.9-1~deb13u1 amd64
pihole:
Core
Version is v6.4.2 (Latest: N/A)
Branch is master
Hash is 3413768c (Latest: N/A)
Web
Version is N/A (Latest: N/A)
Branch is N/A
Hash is N/A (Latest: N/A)
FTL
Version is N/A (Latest: N/A)
Branch is N/A
Hash is N/A (Latest: N/A)
Yesterday when I installed pihole + unbound, everything was a-ok. But today after I messed with systemd-resolved, something went wrong. But I can't figure out why; any help would be greatly appreciated!
Expected Behaviour:
When docker compose up is ran, the DNS resolving should not error.
Actual Behaviour:
My /srv/services/docker-compose.yml file is
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
secrets:
pihole_password:
file: "./pihole_password"
services:
pihole:
secrets:
- pihole_password
container_name: pihole
image: pihole/pihole:latest
ports:
# DNS Ports
- "53:53/tcp"
- "53:53/udp"
# Default HTTP Port
- "80:80/tcp"
# Default HTTPs Port. FTL will generate a self-signed certificate
- "443:443/tcp"
# Uncomment the below if using Pi-hole as your DHCP Server
#- "67:67/udp"
# Uncomment the line below if you are using Pi-hole as your NTP server
#- "123:123/udp"
environment:
# Set the appropriate timezone for your location from
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones, e.g:
TZ: 'Asia/Singapore'
# Set a password to access the web interface. Not setting one will result in a random password being assigned
WEBPASSWORD_FILE: pihole_password
# If using Docker's default `bridge` network setting the dns listening mode should be set to 'ALL'
FTLCONF_dns_listeningMode: 'ALL'
# FTLCONF_dns_upstreams: '127.17.0.1#5335'
# Volumes store your data between container upgrades
volumes:
# For persisting Pi-hole's databases and common configuration file
- './etc-pihole:/etc/pihole'
# Uncomment the below if you have custom dnsmasq config files that you want to persist. Not needed for most starting fresh with Pi-hole v6. If you're upgrading from v5 you and have used this directory before, you should keep it enabled for the first v6 container start to allow for a complete migration. It can be removed afterwards. Needs environment variable FTLCONF_misc_etc_dnsmasq_d: 'true'
#- './etc-dnsmasq.d:/etc/dnsmasq.d'
cap_add:
# See https://docs.pi-hole.net/docker/configuration/#note-on-capabilities
# Required if you are using Pi-hole as your DHCP server, else not needed
# - NET_ADMIN
# Required if you are using Pi-hole as your NTP client to be able to set the host's system time
# - SYS_TIME
# Optional, if Pi-hole should get some more processing time
- SYS_NICE
restart: unless-stopped
I'm using systemd-resolved with the configuration file /etc/systemd/resolved.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# the /etc/systemd/resolved.conf.d/ directory. The latter is generally
# recommended. Defaults can be restored by simply deleting the main
# configuration file and all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
#
# See resolved.conf(5) for details.
[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
# Google: 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
DNS=127.0.0.1
FallbackDNS=127.0.0.1:5335 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net 8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=yes
#LLMNR=yes
#Cache=yes
#CacheFromLocalhost=no
DNSStubListener=no
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
#StaleRetentionSec=0
When I run
sudo docker compose down --volumes --remove-orphans && sudo rm -r "./etc-pihole/" && sudo docker compose up && sudo docker compose logs -f
I get
[+] down 2/2
✔ Container pihole
✔ Network services_default Removed
[+] up 2/2
✔ Network services_default Created
✔ Container pihole
Attaching to pihole
pihole | [i] Setting up user & group for the pihole user
pihole | [i] PIHOLE_UID not set in environment, using default (1000)
pihole | [i] PIHOLE_GID not set in environment, using default (1000)
pihole |
pihole | [i] Starting FTL configuration
pihole | [i] No DNS upstream set in environment or config file, defaulting to Google DNS
pihole | [i] Setting FTLCONF_webserver_api_password from file
pihole | [i] Assigning password defined by Environment Variable
pihole | [i] Starting crond for scheduled scripts. Randomizing times for gravity and update checker
pihole |
pihole | [i] Ensuring logrotate script exists in /etc/pihole
pihole |
pihole | [i] Gravity migration checks
pihole | [i] No adlist file found, creating one with a default blocklist
pihole | [i] /etc/pihole/gravity.db does not exist (Likely due to a fresh volume). This is a required file for Pi-hole to operate.
pihole | [i] Gravity will now be run to create the database
pihole | [✗] DNS resolution is currently unavailable
I tried this with the sample Docker compose file given at https://docs.pi-hole.net/docker/ and the same error appeared.
Attempts at debugging
I tried the solutions posted in [SOLVED] DNS resolution is currently unavailable - #3 by SinE80 but none seem to work, and return the same error as above.
I also try following Gravity Update: DNS resolution is currently unavailable - #10 by Bucking_Horn :
- When I run
sudo docker exec -it pihole pihole -g, I get
[✓] DNS resolution is available
[✗] Migrating the list's cache directory to new location
Error: in prepare, no such table: info
[i] Neutrino emissions detected...
[✓] Preparing new gravity database
[i] Creating new gravity databases...
[✗] Unable to copy data from /etc/pihole/gravity.db to /etc/pihole/gravity.db_temp
Parse error near line 11: no such table: OLD.group
Parse error near line 13: no such table: OLD.domainlist
Parse error near line 14: no such table: OLD.domainlist_by_group
Parse error near line 15: no such table: OLD.domainlist_by_group
Parse error near line 17: no such table: OLD.adlist
Parse error near line 18: no such table: OLD.adlist_by_group
Parse error near line 19: no such table: OLD.adlist_by_group
Parse error near line 21: no such table: OLD.client
Parse error near line 22: no such table: OLD.client_by_group
Parse error near line 23: no such table: OLD.client_by_group
[✗] Unable to create gravity database. Please try again later. If the problem persists, please contact support.
Similarly,
grassglass@sh-touchsmart:/srv/services$ dig raw.githubusercontent.com
; <<>> DiG 9.20.21-1~deb13u1-Debian <<>> raw.githubusercontent.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20445
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;raw.githubusercontent.com. IN A
;; ANSWER SECTION:
raw.githubusercontent.com. 2328 IN A 185.199.108.133
raw.githubusercontent.com. 2328 IN A 185.199.109.133
raw.githubusercontent.com. 2328 IN A 185.199.111.133
raw.githubusercontent.com. 2328 IN A 185.199.110.133
;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Sat May 02 13:52:18 +08 2026
;; MSG SIZE rcvd: 118
grassglass@sh-touchsmart:/srv/services$ nslookup raw.githubusercontent.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: raw.githubusercontent.com
Address: 185.199.111.133
Name: raw.githubusercontent.com
Address: 185.199.108.133
Name: raw.githubusercontent.com
Address: 185.199.109.133
Name: raw.githubusercontent.com
Address: 185.199.110.133
grassglass@sh-touchsmart:/srv/services$ at /etc/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.1
search .
Weird observation: I went to have lunch and I could magically reach the pihole WebGUI again, though there was error (-2) on the top right. But when I did sudo docker compose down --volumes --remove-orphans && sudo rm -r "./etc-pihole/" && sudo docker compose up && sudo docker compose logs -f , it broke again.
Update
Ok so this is baffling [✗] DNS resolution is currently unavailable lasts for some time. But then it becomes resolved, albeit with the constant error message Cannot read gravity database at /etc/pihole/gravity.db - file does not exist or is not readable.