Restarting Docker Container drops all logs

Issue

When restarting the docker containers, no historical query data is shown on the dashboards. Any query under Long-term Data returns nothing - including setting the range to when the container was started. Under Tools | Generate debug log, enabling "Execute database integrity check" and generating the debug log will pause at the integrity check. I have waited 2+ hours to see if the check will complete but assume there is an issue with pihole-FTL.db in some manner which is stopping it from completing.

Expected Behaviour

Configuration

Hardware

System: 2 x Raspberry Pi 4B
Memory: 2G RAM
Storage: 120GB SSD via USB3

Operating System

Details for pihole-1:

pihole-1 system configuration
$ uname --all
Linux edge1 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

$ hostnamectl
 Static hostname: edge1
       Icon name: computer
Operating System: Debian GNU/Linux 12 (bookworm)
          Kernel: Linux 6.1.21-v8+
    Architecture: arm64

Details for pihole-2:

pihole-2 system configuration
$ uname --all
Linux edge2 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

$ hostnamectl
 Static hostname: edge2
       Icon name: computer
Operating System: Debian GNU/Linux 12 (bookworm)
          Kernel: Linux 6.1.21-v8+
    Architecture: arm64

Docker Compose

For pihole-1, contents of `/srv/pihole/compose.yaml':

pihole-1 compose file
services:
  pihole:
    image: pihole/pihole:latest
    container_name: ${CONTAINER}
    hostname: ${HOSTNAME}
    dns: ${DNS}
    network_mode: host
    shm_size: 512mb
    cap_add:
      - NET_ADMIN # dhcp
    environment:
      - TZ=${TZ}
      - WEBPASSWORD=${WEBPASSWORD}
      - FTLCONF_LOCAL_IPV4=${FTLCONF_LOCAL_IPV4}
      - PIHOLE_DNS_=${PIHOLE_DNS}
      - DNSSEC=${DNSSEC}
      - DNS_BOGUS_PRIV=${DNS_BOGUS_PRIV}
      - DNS_FQDN_REQUIRED=${DNS_FQDN_REQUIRED}
      - REV_SERVER=${REV_SERVER}
      - REV_SERVER_DOMAIN=${REV_SERVER_DOMAIN}
      - REV_SERVER_TARGET=${REV_SERVER_TARGET}
      - REV_SERVER_CIDR=${REV_SERVER_CIDR}
      - DHCP_ACTIVE=${DHCP_ACTIVE}
      - DHCP_START=${DHCP_START}
      - DHCP_END=${DHCP_END}
      - DHCP_ROUTER=${DHCP_ROUTER}
      - DHCP_LEASETIME=${DHCP_LEASETIME}
      - PIHOLE_DOMAIN=${PIHOLE_DOMAIN}
      - VIRTUAL_HOST=${VIRTUAL_HOST}
      - INTERFACE=${INTERFACE}
      - DNSMASQ_LISTENING=${DNSMASQ_LISTENING}
      - WEB_PORT=${WEB_PORT}
      - WEB_BIND_ADDR=${FTLCONF_LOCAL_IPV4}
      - CORS_HOSTS=${CORS_HOSTS}
      - FTLCONF_RATE_LIMIT=${FTLCONF_RATE_LIMIT}
    volumes:
      - ${DIRECTORY_PIHOLE}:/etc/pihole
      - ${DIRECTORY_DNSMASQ}:/etc/dnsmasq.d
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

For pihole-1, contents of `/srv/pihole/.env' with secrets redacted:

pihole-1 .env file
# Host specifics
CONTAINER=pihole-1
HOSTNAME=edge1
DNS=192.168.1.1
#DNS=127.0.0.1
# Timezone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=America/Edmonton
# Directory locations
DIRECTORY_PIHOLE=/srv/pihole/etc-pihole
DIRECTORY_DNSMASQ=/srv/pihole/etc-dnsmasq.d
# Container specifics
WEBPASSWORD=[password]
FTLCONF_LOCAL_IPV4=192.168.1.91
PIHOLE_DNS=208.67.222.222;208.67.220.220
DNSSEC=true
DNS_BOGUS_PRIV=true
DNS_FQDN_REQUIRED=true
REV_SERVER=false
REV_SERVER_DOMAIN=[domain]
REV_SERVER_TARGET=192.168.1.1
REV_SERVER_CIDR=192.168.1.0/24
DHCP_ACTIVE=true
DHCP_START=192.168.1.101
DHCP_END=192.168.1.251
DHCP_ROUTER=192.168.1.1
DHCP_LEASETIME=24
PIHOLE_DOMAIN=[domain]
VIRTUAL_HOST=pihole-1.[domain]
INTERFACE=eth0
DNSMASQ_LISTENING=all
WEB_PORT=8080
WEB_BIND_ADDR=192.168.1.91
CORS_HOSTS=https://[domain],https://homer.[domain],https://dashy.[domain]
FTLCONF_RATE_LIMIT=0/0

For pihole-2, contents of `/srv/pihole/compose.yaml':

pihole-2 compose file
services:
  pihole:
    image: pihole/pihole:latest
    container_name: ${CONTAINER}
    hostname: ${HOSTNAME}
    dns: ${DNS}
    network_mode: host
    shm_size: 512mb
    cap_add:
      - NET_ADMIN # dhcp
    environment:
      - TZ=${TZ}
      - WEBPASSWORD=${WEBPASSWORD}
      - FTLCONF_LOCAL_IPV4=${FTLCONF_LOCAL_IPV4}
      - PIHOLE_DNS_=${PIHOLE_DNS}
      - DNSSEC=${DNSSEC}
      - DNS_BOGUS_PRIV=${DNS_BOGUS_PRIV}
      - DNS_FQDN_REQUIRED=${DNS_FQDN_REQUIRED}
      - REV_SERVER=${REV_SERVER}
      - REV_SERVER_DOMAIN=${REV_SERVER_DOMAIN}
      - REV_SERVER_TARGET=${REV_SERVER_TARGET}
      - REV_SERVER_CIDR=${REV_SERVER_CIDR}
      - DHCP_ACTIVE=${DHCP_ACTIVE}
      - DHCP_START=${DHCP_START}
      - DHCP_END=${DHCP_END}
      - DHCP_ROUTER=${DHCP_ROUTER}
      - DHCP_LEASETIME=${DHCP_LEASETIME}
      - PIHOLE_DOMAIN=${PIHOLE_DOMAIN}
      - VIRTUAL_HOST=${VIRTUAL_HOST}
      - INTERFACE=${INTERFACE}
      - DNSMASQ_LISTENING=${DNSMASQ_LISTENING}
      - WEB_PORT=${WEB_PORT}
      - WEB_BIND_ADDR=${FTLCONF_LOCAL_IPV4}
      - CORS_HOSTS=${CORS_HOSTS}
      - FTLCONF_RATE_LIMIT=${FTLCONF_RATE_LIMIT}
    volumes:
      - ${DIRECTORY_PIHOLE}:/etc/pihole
      - ${DIRECTORY_DNSMASQ}:/etc/dnsmasq.d
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

For pihole-2, contents of `/srv/pihole/.env' with secrets redacted:

pihole-2 .env file
# Host specifics
CONTAINER=pihole-2
HOSTNAME=edge2
DNS=192.168.1.1
#DNS=127.0.0.1
# Timezone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=America/Edmonton
# Directory locations
DIRECTORY_PIHOLE=/srv/pihole/etc-pihole
DIRECTORY_DNSMASQ=/srv/pihole/etc-dnsmasq.d
# Container specifics
WEBPASSWORD=[password]
FTLCONF_LOCAL_IPV4=192.168.1.92
PIHOLE_DNS=208.67.222.222;208.67.220.220
DNSSEC=true
DNS_BOGUS_PRIV=true
DNS_FQDN_REQUIRED=true
REV_SERVER=false
REV_SERVER_DOMAIN=[domain]
REV_SERVER_TARGET=192.168.1.1
REV_SERVER_CIDR=192.168.1.0/24
DHCP_ACTIVE=true
DHCP_START=192.168.1.101
DHCP_END=192.168.1.251
DHCP_ROUTER=192.168.1.1
DHCP_LEASETIME=24
PIHOLE_DOMAIN=[domain]
VIRTUAL_HOST=pihole-2.[domain]
INTERFACE=eth0
DNSMASQ_LISTENING=all
WEB_PORT=8080
WEB_BIND_ADDR=192.168.1.92
CORS_HOSTS=https://[domain],https://homer.[domain],https://dashy.[domain]
FTLCONF_RATE_LIMIT=0/0

Folder Structure

For pihole-1, contents of folder `/srv/pihole/' and subfolders:

pihole-1 directory structure
$ ls -lhaR /srv/pihole/
/srv/pihole/:
total 40K
drwxrwxr-x  4 idsvc idsvc 4.0K Jul  7 15:47 .
drwxr-xr-x 14 idsvc idsvc 4.0K Jul  6 15:06 ..
-rwxrwxr-x  1 idsvc idsvc  996 Jul  6 15:15 .env
-rwxrwxr-x  1 idsvc idsvc  997 Jul  6 15:06 .env.example
-rwxrwxr-x  1 idsvc idsvc 1.2K Jul  6 15:06 Pihole-Configuration.md
-rwxrwxr-x  1 idsvc idsvc  593 Jul  7 15:45 Pihole-Installation.md
-rwxrwxr-x  1 idsvc idsvc 1.6K Jul  6 15:06 README.md
-rwxrwxr-x  1 idsvc idsvc 1.7K Jul  7 15:45 compose.yaml
drwxrwxr-x  2 idsvc idsvc 4.0K Jul 10 08:24 etc-dnsmasq.d
drwxrwxr-x  2   999 idsvc 4.0K Jul 10 12:26 etc-pihole

/srv/pihole/etc-dnsmasq.d:
total 32K
drwxrwxr-x 2 idsvc idsvc 4.0K Jul 10 08:24 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rw-r--r-- 1 root  root  1.5K Jul 10 08:24 01-pihole.conf
-rw-r--r-- 1 idsvc idsvc  523 Jul 10 08:24 02-pihole-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 1.1K Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 2.2K Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 root  root  2.2K Jul 10 08:24 06-rfc6761.conf
-rwxrwxr-x 1 idsvc idsvc  269 Jul  9 07:17 07-id-custom.conf

/srv/pihole/etc-pihole:
total 1.8G
drwxrwxr-x 2   999 idsvc 4.0K Jul 10 12:26 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rwxrwxr-x 1 idsvc idsvc  730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 idsvc idsvc  896 Jul  9 07:17 custom.list
-rw-r--r-- 1   999 idsvc 1020 Jul 10 11:27 dhcp.leases
-rw-r--r-- 1 idsvc idsvc  651 Jul 10 08:24 dns-servers.conf
-rw-rw-r-- 1   999 idsvc  78M Jul 10 08:26 gravity.db
-rw-rw-r-- 1   999 idsvc  78M Jul  9 08:48 gravity_old.db
-rw-r--r-- 1 root  root  4.5M Jul 10 08:24 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  3.8M Jul 10 08:24 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  1.2K Jul 10 08:24 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  6.7K Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  840K Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   18K Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  448K Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  449K Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   59K Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  298K Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  1.9M Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   16M Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 idsvc idsvc   65 Jul 10 08:26 local.list
-rwxrwxr-x 1 idsvc idsvc  241 Jul  6 15:16 logrotate
-rwxrwxr-x 1 idsvc idsvc  202 Jul 10 08:24 pihole-FTL.conf
-rw-rw-r-- 1   999 idsvc 1.6G Jul 10 08:24 pihole-FTL.db
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:24 setupVars.conf
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:24 setupVars.conf.update.bak

For pihole-2, contents of folder `/srv/pihole/' and subfolders:

pihole-2 directory structure
$ ls -lha /srv/pihole/
total 40K
drwxrwxr-x  4 idsvc idsvc  4.0K Jul  7 14:05 .
drwxr-xr-x 13 idsvc docker 4.0K Jul  7 09:27 ..
-rwxrwxr-x  1 idsvc idsvc   996 Jul  7 09:35 .env
-rwxrwxr-x  1 idsvc idsvc   997 Jul  7 09:27 .env.example
-rwxrwxr-x  1 idsvc idsvc  1.2K Jul  7 09:27 Pihole-Configuration.md
-rwxrwxr-x  1 idsvc idsvc   593 Jul  7 14:05 Pihole-Installation.md
-rwxrwxr-x  1 idsvc idsvc  1.6K Jul  7 09:27 README.md
-rwxrwxr-x  1 idsvc idsvc  1.7K Jul  7 14:05 compose.yaml
drwxrwxr-x  2 idsvc idsvc  4.0K Jul 10 08:18 etc-dnsmasq.d
drwxrwxr-x  2   999 idsvc  4.0K Jul 10 08:19 etc-pihole
idsvc@id-edge2:/srv/pihole $ ls -lhar /srv/pihole/
total 40K
drwxrwxr-x  2   999 idsvc  4.0K Jul 10 08:19 etc-pihole
drwxrwxr-x  2 idsvc idsvc  4.0K Jul 10 08:18 etc-dnsmasq.d
-rwxrwxr-x  1 idsvc idsvc  1.7K Jul  7 14:05 compose.yaml
-rwxrwxr-x  1 idsvc idsvc  1.6K Jul  7 09:27 README.md
-rwxrwxr-x  1 idsvc idsvc   593 Jul  7 14:05 Pihole-Installation.md
-rwxrwxr-x  1 idsvc idsvc  1.2K Jul  7 09:27 Pihole-Configuration.md
-rwxrwxr-x  1 idsvc idsvc   997 Jul  7 09:27 .env.example
-rwxrwxr-x  1 idsvc idsvc   996 Jul  7 09:35 .env
drwxr-xr-x 13 idsvc docker 4.0K Jul  7 09:27 ..
drwxrwxr-x  4 idsvc idsvc  4.0K Jul  7 14:05 .
idsvc@id-edge2:/srv/pihole $ ls -lhaR /srv/pihole/
/srv/pihole/:
total 40K
drwxrwxr-x  4 idsvc idsvc  4.0K Jul  7 14:05 .
drwxr-xr-x 13 idsvc docker 4.0K Jul  7 09:27 ..
-rwxrwxr-x  1 idsvc idsvc   996 Jul  7 09:35 .env
-rwxrwxr-x  1 idsvc idsvc   997 Jul  7 09:27 .env.example
-rwxrwxr-x  1 idsvc idsvc  1.2K Jul  7 09:27 Pihole-Configuration.md
-rwxrwxr-x  1 idsvc idsvc   593 Jul  7 14:05 Pihole-Installation.md
-rwxrwxr-x  1 idsvc idsvc  1.6K Jul  7 09:27 README.md
-rwxrwxr-x  1 idsvc idsvc  1.7K Jul  7 14:05 compose.yaml
drwxrwxr-x  2 idsvc idsvc  4.0K Jul 10 08:18 etc-dnsmasq.d
drwxrwxr-x  2   999 idsvc  4.0K Jul 10 08:19 etc-pihole

/srv/pihole/etc-dnsmasq.d:
total 32K
drwxrwxr-x 2 idsvc idsvc 4.0K Jul 10 08:18 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 14:05 ..
-rw-r--r-- 1 root  root  1.5K Jul 10 08:18 01-pihole.conf
-rw-r--r-- 1 idsvc idsvc  523 Jul 10 08:18 02-pihole-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 1.1K Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 2.2K Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 root  root  2.2K Jul 10 08:18 06-rfc6761.conf
-rwxrwxr-x 1 idsvc idsvc  269 Jul  9 07:17 07-id-custom.conf

/srv/pihole/etc-pihole:
total 2.0G
drwxrwxr-x 2   999 idsvc 4.0K Jul 10 08:19 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 14:05 ..
-rwxrwxr-x 1 idsvc idsvc  730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 idsvc idsvc  896 Jul  9 07:17 custom.list
-rw-r--r-- 1   999 idsvc 1.3K Jul 10 12:22 dhcp.leases
-rw-r--r-- 1 idsvc idsvc  651 Jul 10 08:18 dns-servers.conf
-rw-rw-r-- 1   999 idsvc  78M Jul 10 08:19 gravity.db
-rw-rw-r-- 1   999 idsvc  78M Jul  9 08:48 gravity_old.db
-rw-r--r-- 1 root  root  4.5M Jul 10 08:19 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:19 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  3.8M Jul 10 08:19 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:19 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  1.2K Jul 10 08:19 list.21.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:19 list.21.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  6.7K Jul 10 08:19 list.22.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  840K Jul 10 08:19 list.23.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   18K Jul 10 08:19 list.24.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  448K Jul 10 08:19 list.25.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  449K Jul 10 08:19 list.26.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   59K Jul 10 08:19 list.27.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  298K Jul 10 08:19 list.28.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  1.9M Jul 10 08:19 list.29.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   16M Jul 10 08:19 list.30.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:19 list.30.v.firebog.net.domains.sha1
-rw-r--r-- 1 idsvc idsvc   65 Jul 10 08:19 local.list
-rwxrwxr-x 1 idsvc idsvc  241 Jul  7 09:37 logrotate
-rwxrwxr-x 1 idsvc idsvc  202 Jul 10 08:18 pihole-FTL.conf
-rw-rw-r-- 1   999 idsvc 1.9G Jul 10 08:18 pihole-FTL.db
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:18 setupVars.conf
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:18 setupVars.conf.update.bak
-rw-r--r-- 1 idsvc idsvc  382 Jul 10 08:19 versions

Network Topology Overview

Summary of network configuration:

  • 192.168.1.1 - Netgear Orbi RBR-850
    • Primary DNS: 192.168.1.92
    • Secondary DNS: 192.168.1.91
    • DHCP disabled
  • 192.168.1.91 - edge1 - Raspberry Pi 4B
    • Docker container pihole-1 running in host networking mode
  • 192.168.1.92 - edge2 - Raspberry Pi 4B
    • Docker container pihole-2 running in host networking mode

Actual Behaviour:

  1. On restart of docker container, no previous queries shown:

  2. When running any query under Long-term Data, no values are returned:

  3. When generating a debug log with database integrity checked, generation pauses at integrity check:

No errors or issues appear in the docker container logs. No errors or issues appear in the FTL logs, inspected using docker exec pihole-X cat /var/log/pihole/FTL.log.

This feels like a permissions issue, but I cannot work out what it might be, and I've searched both the Discourse forum and Reddit.

Debug Tokens

Here are the debug tokens for each host:

Note that I was unable to check database integrity as previously stated as the check would run over 2 hours without completing - with no obvious errors.

Judging by size and access time, both of your long-term query database files seem to be well populated and reasonably recent, so I'd expect Pi-hole's dashboard to be filled upon restart.

However, your guess at permissions playing a part could be justified.
On my RPi OS Buster Docker installation, I am seeing the following permissions:

 $ ls -lah docker-pihole/etc-pihole/
total 35M
drwxrwxr-x 3 pihole spi  4.0K Jul 10 21:26 .
drwxr-xr-x 4 pi     pi   4.0K May 19 12:02 ..
-rw-r--r-- 1 root   root   65 Nov  7  2022 adlists.list
-rw-r--r-- 1 root   root   21 Mar  2 10:39 custom.list
-rw-r--r-- 1 pihole spi     0 May 16 21:06 dhcp.leases
-rw-r--r-- 1 root   root  651 Jul  9 14:59 dns-servers.conf
-rw-rw-r-- 1 pihole spi   13M Jul  9 15:00 gravity.db
-rw-rw-r-- 1 pihole spi   13M Jul  9 14:59 gravity_old.db
-rw-r--r-- 1 root   root 4.5M Jul  9 14:59 list.1.raw.githubusercontent.com.domains
-rw-r--r-- 1 root   root   95 Jul  9 03:41 list.1.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root   root   65 Jul  9 15:00 local.list
-rw-r--r-- 1 root   root  241 Nov  7  2022 logrotate
lrwxrwxrwx 1 root   root   13 Jul  9 14:59 macvendor.db -> /macvendor.db
drwxr-xr-x 2 root   root 4.0K Nov  7  2022 migration_backup
-rw-rw-r-- 1 pihole root  150 Jul  9 14:59 pihole-FTL.conf
-rw-rw-r-- 1 pihole spi  5.9M Jul 10 21:26 pihole-FTL.db
-rw-r--r-- 1 root   root  523 Jul  9 14:59 setupVars.conf
-rw-r--r-- 1 root   root  523 Jul  9 14:59 setupVars.conf.update.bak
-rw-r--r-- 1 root   root  269 Jul 10 13:32 versions

The main difference seems to be that the pihole user does not show up in your files at all.

And just to be sure:
Your /srv/pihole/ mount point is separate for each Pi-hole, or would it be shared among your two Pi-holes?

First of all, you are an amazing support resource. I don't know how you do it, but kudos to you for being both responsive and technically excellent.

The /srv/pihole/ mount points are indeed separate and local to each physical device. They are not shared.

I have no local pihole user, and according to the Experimental Variables list the UID and GiD internal to the container should be 999.

If this is the case, would the following reset the permissions:

docker compose --file /srv/pihole/compose.yaml down
sudo chown --recursive 9999:9999 /srv/pihole/etc-dnsmasq.d/
sudo chown --recursive 9999:9999 /srv/pihole/etc-pihole/
docker compose --file /srv/pihole/compose.yaml up --detach

I'll wait to check before I attempt this, in case it only needs to be applied to specific files.

Since you are on a different OS and release (and probably Docker version also), I can't really advise on this - your guess is as good as mine here.

That said, I'd probably apply that exclusively only to those files that are shown as pihole in my ls output, and only for etc-pihole, since that is where the database files reside.
And you should check those numbers: Your earlier quotes show three niners 999, where your chown shows four of them. :wink:

EDIT:
It's also unclear why your setup has created those files with different permissions (unless you perhaps would have created them before actually starting the container from an image for the first time, probably in an attempt to pre-configure a fresh container?).
You should keep an eye on that.

That's good, as Pi-hole's database engine SQLite3 doesn't like NFS mounts, and Pi-hole's database is designed as single host/single user.

Thank you - I guess all of our team here just like to help and make Pi-hole a better experience at the same time. :wink:

An interesting point about the OS and docker versions being potentially different:

$ uname --all;docker --version;docker compose version
Linux id-edge1 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
Docker version 24.0.4, build 3713ee1
Docker Compose version v2.19.1

That could have something to do with this issue, perhaps. Not going to rule it out yet.


I did try to configure the sub-folder permissions in advance of the container starting, as part of my deployment scripts. Looks like I need to amend the approach.


I decided to set everything in the two sub-folders to 999:999 (thanks for the extra nine catch!), just to see what happened.

  1. Confirm current permissions

Check folder permissions

commands run
ls -lha /srv/pihole/etc-dnsmasq.d/
ls -lha /srv/pihole/etc-pihole/

Permissions before adjustment

original /srv/pihole/etc-dnsmasq.d
$ ls -lha /srv/pihole/etc-dnsmasq.d/

total 32K
drwxrwxr-x 2 idsvc idsvc 4.0K Jul 10 08:24 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rw-r--r-- 1 root  root  1.5K Jul 10 08:24 01-pihole.conf
-rw-r--r-- 1 idsvc idsvc  523 Jul 10 08:24 02-pihole-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 1.1K Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 idsvc idsvc 2.2K Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 root  root  2.2K Jul 10 08:24 06-rfc6761.conf
-rwxrwxr-x 1 idsvc idsvc  269 Jul  9 07:17 07-id-custom.conf
original /srv/pihole/etc-pihole
$ ls -lha /srv/pihole/etc-pihole/

total 1.8G
drwxrwxr-x 2   999 idsvc 4.0K Jul 10 12:26 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rwxrwxr-x 1 idsvc idsvc  730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 idsvc idsvc  896 Jul  9 07:17 custom.list
-rw-r--r-- 1   999 idsvc 1020 Jul 10 11:27 dhcp.leases
-rw-r--r-- 1 idsvc idsvc  651 Jul 10 08:24 dns-servers.conf
-rw-rw-r-- 1   999 idsvc  78M Jul 10 08:26 gravity.db
-rw-rw-r-- 1   999 idsvc  78M Jul  9 08:48 gravity_old.db
-rw-r--r-- 1 root  root  4.5M Jul 10 08:24 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  3.8M Jul 10 08:24 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  1.2K Jul 10 08:24 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 root  root    96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 root  root  6.7K Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  840K Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   18K Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  448K Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  449K Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   59K Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  298K Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root  1.9M Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 root  root   16M Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1 root  root    84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 idsvc idsvc   65 Jul 10 08:26 local.list
-rwxrwxr-x 1 idsvc idsvc  241 Jul  6 15:16 logrotate
-rwxrwxr-x 1 idsvc idsvc  202 Jul 10 08:24 pihole-FTL.conf
-rw-rw-r-- 1   999 idsvc 1.6G Jul 10 08:24 pihole-FTL.db
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:24 setupVars.conf
-rwxrwxr-x 1 idsvc idsvc  583 Jul 10 08:24 setupVars.conf.update.bak
-rw-r--r-- 1 idsvc idsvc  382 Jul 10 12:26 versions
  1. Adjust permissions

Take container down, update permissions, list folders

commands run
docker compose --file /srv/pihole/compose.yaml down
sudo chown --recursive 999:999 /srv/pihole/etc-dnsmasq.d/
sudo chown --recursive 999:999 /srv/pihole/etc-pihole/
ls -lha /srv/pihole/etc-dnsmasq.d/
ls -lha /srv/pihole/etc-pihole/

docker compose --file /srv/pihole/compose.yaml up --detach
sleep 60
ls -lha /srv/pihole/etc-dnsmasq.d/
ls -lha /srv/pihole/etc-pihole/
adjusted /srv/pihole/etc-dnsmasq.d
$ ls -lha /srv/pihole/etc-dnsmasq.d/

total 32K
drwxrwxr-x 2   999 spi   4.0K Jul 10 14:58 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rw-r--r-- 1   999 spi   1.5K Jul 10 14:58 01-pihole.conf
-rw-r--r-- 1   999 spi    523 Jul 10 14:58 02-pihole-dhcp.conf
-rwxrwxr-x 1   999 spi   1.1K Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1   999 spi   2.2K Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1   999 spi   2.2K Jul 10 14:58 06-rfc6761.conf
-rwxrwxr-x 1   999 spi    269 Jul  9 07:17 07-id-custom.conf
adjusted /srv/pihole/etc-pihole
$ ls -lha /srv/pihole/etc-pihole/

total 1.8G
drwxrwxr-x 2   999 spi   4.0K Jul 10 14:59 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rwxrwxr-x 1   999 spi    730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1   999 spi    896 Jul  9 07:17 custom.list
-rw-r--r-- 1   999 spi   1020 Jul 10 11:27 dhcp.leases
-rw-r--r-- 1   999 spi    651 Jul 10 14:58 dns-servers.conf
-rw-rw-r-- 1   999 spi    78M Jul 10 14:59 gravity.db
-rw-rw-r-- 1   999 spi    78M Jul 10 08:26 gravity_old.db
-rw-r--r-- 1   999 spi   4.5M Jul 10 14:58 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   3.8M Jul 10 14:58 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 14:58 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   1.2K Jul 10 14:58 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   6.7K Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   840K Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    18K Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   448K Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   449K Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    59K Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   298K Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   1.9M Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    16M Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi     65 Jul 10 14:59 local.list
-rwxrwxr-x 1   999 spi    241 Jul  6 15:16 logrotate
-rwxrwxr-x 1   999 spi    202 Jul 10 14:58 pihole-FTL.conf
-rw-rw-r-- 1   999 spi   1.6G Jul 10 14:58 pihole-FTL.db
-rwxrwxr-x 1   999 spi    583 Jul 10 14:58 setupVars.conf
-rwxrwxr-x 1   999 spi    583 Jul 10 14:58 setupVars.conf.update.bak
-rw-r--r-- 1   999 spi    382 Jul 10 14:59 versions
  1. Start container and check permissions

Start container, wait, check folders

commands run
docker compose --file /srv/pihole/compose.yaml up --detach
sleep 60
ls -lha /srv/pihole/etc-dnsmasq.d/
ls -lha /srv/pihole/etc-pihole/
container amended /srv/pihole/etc-dnsmasq.d
$ ls -lha /srv/pihole/etc-dnsmasq.d/

total 32K
drwxrwxr-x 2   999 spi   4.0K Jul 10 15:06 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rw-r--r-- 1 root  root  1.5K Jul 10 15:06 01-pihole.conf
-rw-r--r-- 1   999 spi    523 Jul 10 15:06 02-pihole-dhcp.conf
-rwxrwxr-x 1   999 spi   1.1K Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1   999 spi   2.2K Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 root  root  2.2K Jul 10 15:06 06-rfc6761.conf
-rwxrwxr-x 1   999 spi    269 Jul  9 07:17 07-id-custom.conf
container amended /srv/pihole/etc-pihole
$ ls -lha /srv/pihole/etc-pihole/

total 1.8G
drwxrwxr-x 2   999 idsvc 4.0K Jul 10 15:07 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul  7 15:47 ..
-rwxrwxr-x 1   999 spi    730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1   999 spi    896 Jul  9 07:17 custom.list
-rw-r--r-- 1   999 idsvc 1020 Jul 10 11:27 dhcp.leases
-rw-r--r-- 1   999 spi    651 Jul 10 15:06 dns-servers.conf
-rw-rw-r-- 1   999 idsvc  78M Jul 10 15:06 gravity.db
-rw-rw-r-- 1   999 idsvc  78M Jul 10 14:59 gravity_old.db
-rw-r--r-- 1   999 spi   4.5M Jul 10 15:06 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   3.8M Jul 10 15:06 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 14:58 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   1.2K Jul 10 15:06 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1   999 spi     96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1   999 spi   6.7K Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   840K Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    18K Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   448K Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   449K Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    59K Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   298K Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi   1.9M Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi    16M Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1   999 spi     84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1   999 spi     65 Jul 10 15:06 local.list
-rwxrwxr-x 1   999 spi    241 Jul  6 15:16 logrotate
-rwxrwxr-x 1   999 spi    202 Jul 10 15:06 pihole-FTL.conf
-rw-rw-r-- 1   999 idsvc 1.6G Jul 10 15:06 pihole-FTL.db
-rwxrwxr-x 1   999 spi    583 Jul 10 15:06 setupVars.conf
-rwxrwxr-x 1   999 spi    583 Jul 10 15:06 setupVars.conf.update.bak
-rw-r--r-- 1   999 spi    382 Jul 10 15:07 versions

Analysis

The following files were changed from "999:999" (pihole:pihole, internal to the container) to "0:0" (root:root):

  • etc-dnsmasq.d/01-pihole.conf
  • etc-dnsmasq.d/06-rfc6761.conf

This makes sense as these two files are automatically generated by pi-hole. However, I would have expected file 02-pihole-dhcp.conf to also be set this way. The other three files are provided by me as part of the system configuration.

The following files were changed from "999:999" (pihole:pihole, internal to the container) to "000:1000" (pihole:current user, internal to the container):

  • etc-pihole/dhcp.leases
  • etc-pihole/gravity.db
  • etc-pihole/gravity_old.db
  • etc-pihole/pihole-FTL.db

After doing this the dashboard display, long-term data, and database integrity check do not display current information.

Options

  1. Reset everything current user
    I could take the container down, chown to 1000:1000, bring it up, and see what happens
  2. Use environment variables
    I could use PIHOLE_UID and PIHOLE_GID to run under 1000:1000 and see what happens

Better Options

I could also wait to see what the support team thinks, especially considering pihole-FTL.db appears to be receivng writes, so why mess it up?

Any ideas?

I don't know if this is good advice, or bad, or just advice...

I personally always use named volumes in my docker setups as I find it prevents all sorts of fun and games with setting the permissions correctly

If it helps any (though it doesn't look all that different to yours), here is the compose file for my main Pi-hole running on a Rpi 4

docker-compose.yml
version: '3.3'
services:

  pihole:
    container_name: pihole
    hostname: ${PIHOLE_HOSTNAME}
    image: pihole/pihole:${PIHOLE_TAG}
    environment:
      TZ: europe/London
      FTLCONF_LOCAL_IPV4: ${PIHOLE_IP}
      FTLCONF_PIHOLE_PTR: ${PIHOLE_PTR}
      REV_SERVER: 'true'
      REV_SERVER_DOMAIN: ${REV_SERVER_DOMAIN}
      REV_SERVER_TARGET: ${REV_SERVER_TARGET}
      REV_SERVER_CIDR: ${REV_SERVER_CIDR}
      SKIPGRAVITYONBOOT: ${SKIPGRAVITYONBOOT}
      PIHOLE_DNS_: ${PIHOLE_DNS_}
      WEBPASSWORD: ${WEBPASSWORD}
      DNSMASQ_USER: ${DNSMASQ_USER}
      VIRTUAL_HOST: ${VIRTUAL_HOST}
    volumes:
      - pihole_etc_pihole:/etc/pihole/
      - pihole_etc_dnsmasqd:/etc/dnsmasq.d/
    cap_add:
      - NET_ADMIN
    mac_address: ${PIHOLE_MAC}
    dns:
     - 8.8.8.8
    networks:
      home:
        ipv4_address: ${PIHOLE_IP}
    restart: always

networks:
  home:
    external: true

volumes:
  pihole_etc_pihole:
  pihole_etc_dnsmasqd:

I'm not sure if the information below will help you, but you can use this to compare.

Like you, I don't have pihole user on my host OS.

As a test, I started a new/clean container without volumes and without PIHOLE_UID/PIHOLE_GID.
Right after the container start the database files look like this:

-rw-rw-r-- 1 pihole pihole 12947456 Jul 10 19:05 gravity.db
-rw-rw-r-- 1 pihole pihole    81920 Jul 10 19:23 pihole-FTL.db

My "official" container, using volumes (bind mounts) like yours, without PIHOLE_UID/PIHOLE_GID, has the same pihole:pihole permissions inside the container.

On the host system, the file permissions look like this (ls -ln):

-rw-rw-r-- 1  999 1000  13348864 Jul 10 02:01  gravity.db
-rw-rw-r-- 1  999 1000 319246336 Jul 10 19:21  pihole-FTL.db

@PromoFaux I generally avoid named volumes and prefer bind mounts for ease of backup and Configuration as Code but I do appreciate the ease of use.

Could you run a docker exec pihole ls -lha /etc/pihole/ and a docker exec pihole ls -lha /etc/dnsmasq.d/ and share the results, so I can see what the permissions on your named volumes are? Maybe I can use this information to replicate the ownership settings.

@rdwebdesign Thank you for testing this. What's interesting is on the host the GID is 1000. Let me play with this.


Assumptions

  1. Logged in user (which runs all docker container services and is part of the Docker group) is UID 1000 GID 1000
  2. pi-hole base UID is 999 and base GID is 999 (as per experimental variables defaults)

pihole-1 test

  1. Check the current ownership for bind mounts on /srv/pihole/etc-dnsmasq.d/ and /srv/pihole/etcpihole
  2. Take down container
  3. Set the UID to 1000 and the GID to 1000
  4. Check the ownership for the bind mounts
  5. Start the container
  6. Wait until the container is up
  7. Check the ownership for the bind mounts
Commands run on pihole-1
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
docker compose --file /srv/pihole/compose.yaml down
sudo chown --recursive 1000:1000 /srv/pihole/etc-dnsmasq.d/
sudo chown --recursive 1000:1000 /srv/pihole/etc-pihole/
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
docker compose --file /srv/pihole/compose.yaml up --detach
sleep 60
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
bind mounts before
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
total 24
-rw-r--r-- 1   0   0 1507 Jul 10 15:06 01-pihole.conf
-rw-r--r-- 1 999 999  523 Jul 10 15:06 02-pihole-dhcp.conf
-rwxrwxr-x 1 999 999 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 999 999 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1   0   0 2190 Jul 10 15:06 06-rfc6761.conf
-rwxrwxr-x 1 999 999  269 Jul  9 07:17 07-id-custom.conf
total 1864112
-rwxrwxr-x 1 999  999        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 999  999        896 Jul  9 07:17 custom.list
-rw-r--r-- 1 999 1000        900 Jul 11 13:11 dhcp.leases
-rw-r--r-- 1 999  999        651 Jul 10 15:06 dns-servers.conf
-rw-rw-r-- 1 999 1000   81174528 Jul 10 15:06 gravity.db
-rw-rw-r-- 1 999 1000   81174528 Jul 10 14:59 gravity_old.db
[-rw-r--r-- 1 999  999         65 Jul 10 15:06 local.list
-rwxrwxr-x 1 999  999        241 Jul  6 15:16 logrotate
-rwxrwxr-x 1 999  999        202 Jul 10 15:06 pihole-FTL.conf
-rw-rw-r-- 1 999 1000 1717374976 Jul 10 15:06 pihole-FTL.db
-rwxrwxr-x 1 999  999        583 Jul 10 15:06 setupVars.conf
-rwxrwxr-x 1 999  999        583 Jul 10 15:06 setupVars.conf.update.bak
-rw-r--r-- 1 999  999        382 Jul 10 18:14 versions
bind mounts during
total 24
-rw-r--r-- 1 1000 1000 1507 Jul 10 15:06 01-pihole.conf
-rw-r--r-- 1 1000 1000  523 Jul 10 15:06 02-pihole-dhcp.conf
-rwxrwxr-x 1 1000 1000 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 1000 1000 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 1000 1000 2190 Jul 10 15:06 06-rfc6761.conf
-rwxrwxr-x 1 1000 1000  269 Jul  9 07:17 07-id-custom.conf
total 1864112
-rwxrwxr-x 1 1000 1000        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 1000 1000        896 Jul  9 07:17 custom.list
-rw-r--r-- 1 1000 1000        900 Jul 11 13:11 dhcp.leases
-rw-r--r-- 1 1000 1000        651 Jul 10 15:06 dns-servers.conf
-rw-rw-r-- 1 1000 1000   81174528 Jul 10 15:06 gravity.db
-rw-rw-r-- 1 1000 1000   81174528 Jul 10 14:59 gravity_old.db
-rw-r--r-- 1 1000 1000    4704770 Jul 10 15:06 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000    3928674 Jul 10 15:06 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 10 14:58 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000       1172 Jul 10 15:06 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000       6814 Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     859665 Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000      17552 Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     458104 Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     459703 Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000      59471 Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     304542 Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000    1941414 Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000   16266031 Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000         65 Jul 10 15:06 local.list
-rwxrwxr-x 1 1000 1000        241 Jul  6 15:16 logrotate
-rwxrwxr-x 1 1000 1000        202 Jul 10 15:06 pihole-FTL.conf
-rw-rw-r-- 1 1000 1000 1717374976 Jul 10 15:06 pihole-FTL.db
-rwxrwxr-x 1 1000 1000        583 Jul 10 15:06 setupVars.conf
-rwxrwxr-x 1 1000 1000        583 Jul 10 15:06 setupVars.conf.update.bak
-rw-r--r-- 1 1000 1000        382 Jul 10 18:14 versions
bind mounts after
total 24
-rw-r--r-- 1    0    0 1507 Jul 11 13:26 01-pihole.conf
-rw-r--r-- 1 1000 1000  523 Jul 11 13:26 02-pihole-dhcp.conf
-rwxrwxr-x 1 1000 1000 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 1000 1000 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1    0    0 2190 Jul 11 13:26 06-rfc6761.conf
-rwxrwxr-x 1 1000 1000  269 Jul  9 07:17 07-id-custom.conf
total 1864140
-rwxrwxr-x 1 1000 1000        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 1000 1000        896 Jul  9 07:17 custom.list
-rw-r--r-- 1  999 1000        900 Jul 11 13:11 dhcp.leases
-rw-r--r-- 1 1000 1000        651 Jul 11 13:26 dns-servers.conf
-rw-rw-r-- 1  999 1000   81195008 Jul 11 13:27 gravity.db
-rw-rw-r-- 1  999 1000   81174528 Jul 10 15:06 gravity_old.db
-rw-r--r-- 1 1000 1000    4704770 Jul 11 13:26 list.18.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 10 08:24 list.18.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000    3934194 Jul 11 13:26 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 11 13:26 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000       1172 Jul 11 13:26 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 1000 1000         96 Jul 10 08:24 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 1000 1000       6814 Jul 10 08:25 list.21.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.21.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     859665 Jul 10 08:25 list.22.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000      17552 Jul 10 08:25 list.23.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     458104 Jul 10 08:25 list.24.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     459703 Jul 10 08:25 list.25.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000      59471 Jul 10 08:25 list.26.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000     304542 Jul 10 08:25 list.27.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000    1941414 Jul 10 08:25 list.28.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:25 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000   16266031 Jul 10 08:25 list.29.v.firebog.net.domains
-rw-r--r-- 1 1000 1000         84 Jul 10 08:26 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 1000 1000         65 Jul 11 13:27 local.list
-rwxrwxr-x 1 1000 1000        241 Jul  6 15:16 logrotate
-rwxrwxr-x 1 1000 1000        202 Jul 11 13:26 pihole-FTL.conf
-rw-rw-r-- 1  999 1000 1717374976 Jul 11 13:26 pihole-FTL.db
-rwxrwxr-x 1 1000 1000        583 Jul 11 13:26 setupVars.conf
-rwxrwxr-x 1 1000 1000        583 Jul 11 13:26 setupVars.conf.update.bak
-rw-r--r-- 1 1000 1000        382 Jul 11 13:27 versions

Results

  1. No issues in docker compose logs reported
  2. Web interface shows queries only from when container was restarted
  3. Long Term Data | Graphics | Today shows no results
  4. Tools | Generate debug log | Execute database integrity check gets stuck at pihole-FTL.db

pihole-2 test

  1. Check the current ownership for bind mounts on /srv/pihole/etc-dnsmasq.d/ and /srv/pihole/etcpihole
  2. Take down container
  3. Set the UID to 999 and the GID to 1000
  4. Check the ownership for the bind mounts
  5. Start the container
  6. Wait until the container is up
  7. Check the ownership for the bind mounts
Commands run on pihole-2
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
docker compose --file /srv/pihole/compose.yaml down
sudo chown --recursive 999:1000 /srv/pihole/etc-dnsmasq.d/
sudo chown --recursive 999:1000 /srv/pihole/etc-pihole/
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
docker compose --file /srv/pihole/compose.yaml up --detach
sleep 60
ls -ln /srv/pihole/etc-dnsmasq.d/
ls -ln /srv/pihole/etc-pihole/
bind mounts before
total 24
-rw-r--r-- 1   0   0 1507 Jul 10 14:59 01-pihole.conf
-rw-r--r-- 1 999 999  523 Jul 10 14:59 02-pihole-dhcp.conf
-rwxrwxr-x 1 999 999 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 999 999 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1   0   0 2190 Jul 10 14:59 06-rfc6761.conf
-rwxrwxr-x 1 999 999  269 Jul  9 07:17 07-id-custom.conf
total 2091664
-rwxrwxr-x 1 999  999        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 999  999        896 Jul  9 07:17 custom.list
-rw-r--r-- 1 999 1000       1157 Jul 11 13:11 dhcp.leases
-rw-r--r-- 1 999  999        651 Jul 10 14:59 dns-servers.conf
-rw-rw-r-- 1 999 1000   81174528 Jul 10 14:59 gravity.db
-rw-rw-r-- 1 999 1000   81158144 Jul 10 08:19 gravity_old.db
-rw-r--r-- 1 999  999    4704770 Jul 10 14:59 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 999  999         96 Jul 10 08:19 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999  999    3928674 Jul 10 14:59 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 999  999         96 Jul 10 14:59 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999  999       1172 Jul 10 14:59 list.21.raw.githubusercontent.com.domains
-rw-r--r-- 1 999  999         96 Jul 10 08:19 list.21.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999  999       6814 Jul 10 08:19 list.22.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999     859665 Jul 10 08:19 list.23.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999      17552 Jul 10 08:19 list.24.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999     458104 Jul 10 08:19 list.25.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999     459703 Jul 10 08:19 list.26.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999      59471 Jul 10 08:19 list.27.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999     304542 Jul 10 08:19 list.28.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999    1941414 Jul 10 08:19 list.29.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999   16266031 Jul 10 08:19 list.30.v.firebog.net.domains
-rw-r--r-- 1 999  999         84 Jul 10 08:19 list.30.v.firebog.net.domains.sha1
-rw-r--r-- 1 999  999         65 Jul 10 14:59 local.list
-rwxrwxr-x 1 999  999        241 Jul  7 09:37 logrotate
-rwxrwxr-x 1 999  999        202 Jul 10 14:59 pihole-FTL.conf
-rw-rw-r-- 1 999 1000 1950396416 Jul 10 14:59 pihole-FTL.db
-rwxrwxr-x 1 999  999        583 Jul 10 14:59 setupVars.conf
-rwxrwxr-x 1 999  999        583 Jul 10 14:59 setupVars.conf.update.bak
-rw-r--r-- 1 999  999        382 Jul 11 12:47 versions
bind mounts during
total 24
-rw-r--r-- 1 999 1000 1507 Jul 10 14:59 01-pihole.conf
-rw-r--r-- 1 999 1000  523 Jul 10 14:59 02-pihole-dhcp.conf
-rwxrwxr-x 1 999 1000 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 999 1000 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1 999 1000 2190 Jul 10 14:59 06-rfc6761.conf
-rwxrwxr-x 1 999 1000  269 Jul  9 07:17 07-id-custom.conf
total 2091664
-rwxrwxr-x 1 999 1000        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 999 1000        896 Jul  9 07:17 custom.list
-rw-r--r-- 1 999 1000       1157 Jul 11 13:11 dhcp.leases
-rw-r--r-- 1 999 1000        651 Jul 10 14:59 dns-servers.conf
-rw-rw-r-- 1 999 1000   81174528 Jul 10 14:59 gravity.db
-rw-rw-r-- 1 999 1000   81158144 Jul 10 08:19 gravity_old.db
-rw-r--r-- 1 999 1000    4704770 Jul 10 14:59 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 10 08:19 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000    3928674 Jul 10 14:59 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 10 14:59 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000       1172 Jul 10 14:59 list.21.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 10 08:19 list.21.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000       6814 Jul 10 08:19 list.22.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     859665 Jul 10 08:19 list.23.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000      17552 Jul 10 08:19 list.24.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     458104 Jul 10 08:19 list.25.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     459703 Jul 10 08:19 list.26.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000      59471 Jul 10 08:19 list.27.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     304542 Jul 10 08:19 list.28.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000    1941414 Jul 10 08:19 list.29.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000   16266031 Jul 10 08:19 list.30.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.30.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000         65 Jul 10 14:59 local.list
-rwxrwxr-x 1 999 1000        241 Jul  7 09:37 logrotate
-rwxrwxr-x 1 999 1000        202 Jul 10 14:59 pihole-FTL.conf
-rw-rw-r-- 1 999 1000 1950396416 Jul 10 14:59 pihole-FTL.db
-rwxrwxr-x 1 999 1000        583 Jul 10 14:59 setupVars.conf
-rwxrwxr-x 1 999 1000        583 Jul 10 14:59 setupVars.conf.update.bak
-rw-r--r-- 1 999 1000        382 Jul 11 12:47 versions
bind mounts after
total 24
-rw-r--r-- 1   0    0 1507 Jul 11 13:30 01-pihole.conf
-rw-r--r-- 1 999 1000  523 Jul 11 13:30 02-pihole-dhcp.conf
-rwxrwxr-x 1 999 1000 1103 Jul  9 07:17 04-pihole-static-dhcp.conf
-rwxrwxr-x 1 999 1000 2152 Jul  9 07:17 05-pihole-custom-cname.conf
-rw-r--r-- 1   0    0 2190 Jul 11 13:29 06-rfc6761.conf
-rwxrwxr-x 1 999 1000  269 Jul  9 07:17 07-id-custom.conf
total 2091700
-rwxrwxr-x 1 999 1000        730 Jul  9 07:17 adlists.list
-rwxrwxr-x 1 999 1000        896 Jul  9 07:17 custom.list
-rw-r--r-- 1 999 1000       1157 Jul 11 13:34 dhcp.leases
-rw-r--r-- 1 999 1000        651 Jul 11 13:29 dns-servers.conf
-rw-rw-r-- 1 999 1000   81195008 Jul 11 13:35 gravity.db
-rw-rw-r-- 1 999 1000   81174528 Jul 10 14:59 gravity_old.db
-rw-r--r-- 1 999 1000    4704770 Jul 11 13:30 list.19.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 10 08:19 list.19.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000    3934194 Jul 11 13:31 list.20.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 11 13:31 list.20.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000       1172 Jul 11 13:31 list.21.raw.githubusercontent.com.domains
-rw-r--r-- 1 999 1000         96 Jul 10 08:19 list.21.raw.githubusercontent.com.domains.sha1
-rw-r--r-- 1 999 1000       6814 Jul 10 08:19 list.22.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.22.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     859665 Jul 10 08:19 list.23.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.23.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000      17552 Jul 10 08:19 list.24.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.24.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     458104 Jul 10 08:19 list.25.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.25.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     459703 Jul 10 08:19 list.26.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.26.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000      59471 Jul 10 08:19 list.27.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.27.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000     304542 Jul 10 08:19 list.28.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.28.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000    1941414 Jul 10 08:19 list.29.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.29.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000   16266031 Jul 10 08:19 list.30.v.firebog.net.domains
-rw-r--r-- 1 999 1000         84 Jul 10 08:19 list.30.v.firebog.net.domains.sha1
-rw-r--r-- 1 999 1000         65 Jul 11 13:34 local.list
-rwxrwxr-x 1 999 1000        241 Jul  7 09:37 logrotate
-rwxrwxr-x 1 999 1000        202 Jul 11 13:29 pihole-FTL.conf
-rw-rw-r-- 1 999 1000 1950396416 Jul 11 13:30 pihole-FTL.db
-rwxrwxr-x 1 999 1000        583 Jul 11 13:29 setupVars.conf
-rwxrwxr-x 1 999 1000        583 Jul 11 13:29 setupVars.conf.update.bak
-rw-r--r-- 1 999 1000        382 Jul 11 13:38 versions

Results

  1. No issues in docker compose logs reported
  2. Web interface shows queries only from when container was restarted
  3. Long Term Data | Graphics | Today shows no results
  4. Tools | Generate debug log | Execute database integrity check gets stuck at pihole-FTL.db

This is odd. Let's check the mount status for the databases on both containers:

pihole-1

$ docker exec pihole-1 ls -lha /etc/pihole/ | grep .db
-rw-rw-r-- 1 pihole pihole  78M Jul 11 13:27 gravity.db
-rw-rw-r-- 1 pihole pihole  78M Jul 10 15:06 gravity_old.db
-rw-rw-r-- 1 pihole pihole 1.6G Jul 11 13:26 pihole-FTL.db

$ docker exec pihole-1 ls -ln /etc/pihole/ | grep .db
-rw-rw-r-- 1  999 1000   81195008 Jul 11 13:27 gravity.db
-rw-rw-r-- 1  999 1000   81174528 Jul 10 15:06 gravity_old.db
-rw-rw-r-- 1  999 1000 1717374976 Jul 11 13:26 pihole-FTL.db

pihole-1

$ docker exec pihole-2 ls -lha /etc/pihole/ | grep .db
-rw-rw-r-- 1 pihole pihole  78M Jul 11 13:35 gravity.db
-rw-rw-r-- 1 pihole pihole  78M Jul 10 14:59 gravity_old.db
-rw-rw-r-- 1 pihole pihole 1.9G Jul 11 13:30 pihole-FTL.db

$ docker exec pihole-2 ls -ln /etc/pihole/ | grep .db
-rw-rw-r-- 1 999 1000   81195008 Jul 11 13:35 gravity.db
-rw-rw-r-- 1 999 1000   81174528 Jul 10 14:59 gravity_old.db
-rw-rw-r-- 1 999 1000 1950396416 Jul 11 13:30 pihole-FTL.db

Identical. Huh. Okay, this is odd. Should I try setting PIHOLE_UID and PIHOLE_GID to 1000? Any other ideas?

mutters I bet this is because I upgraded to Debian 12 the other day gah

I'd like to suggest a different approach:
After backing up those of your existing files that you would want to reuse, shut down your containers and completely remove the ${DIRECTORY_PIHOLE} and ${DIRECTORY_DNSMASQ} directories.

Then restart the container, which would create and populate the directories, and take a note of the permissions then.
Copy the necessary backup files (if any) to their location and apply permissions as noted.

And to take yet another approach:
Are you strongly determined to pre-populate your Pi-hole mounts, or did you take a look of other potential means to recreate your container configuration?
What's your motivation here?

I am strongly determined to pre-populate my pihole mounts using a git repository. My motivation is to manage my server infrastructure and configuration via a DevOps approach.


A local reset! Such a good idea! No need to backup existing files, due to GitOps!

commands used on pihole-1 and pihole-2
cd /srv/pihole
docker compose --file /srv/pihole/compose.yaml down
sudo rm -r /srv/pihole/etc-dnsmasq.d
sudo rm -r /srv/pihole/etc-pihole
ls -lha
git status;git stash push;git rebase --reset
ls -lha
docker compose up --detach
sleep 60
docker compose logs
git status
resulting permissions pihole-1
./etc-dnsmasq.d:
total 32K
drwxr-xr-x 2 idsvc idsvc 4.0K Jul 11 14:48 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul 11 14:48 ..
-rw-r--r-- 1 root  root  1.5K Jul 11 14:48 01-pihole.conf
-rw-r--r-- 1 root  root   523 Jul 11 14:48 02-pihole-dhcp.conf
-rw-r--r-- 1 idsvc idsvc 1.1K Jul 11 14:48 04-pihole-static-dhcp.conf
-rw-r--r-- 1 idsvc idsvc 2.2K Jul 11 14:48 05-pihole-custom-cname.conf
-rw-r--r-- 1 root  root  2.2K Jul 11 14:48 06-rfc6761.conf
-rw-r--r-- 1 idsvc idsvc  269 Jul 11 14:48 07-id-custom.conf

./etc-pihole:
total 400K
drwxrwxr-x 3   999 idsvc 4.0K Jul 11 14:55 .
drwxrwxr-x 4 idsvc idsvc 4.0K Jul 11 14:48 ..
-rw-r--r-- 1 idsvc idsvc  896 Jul 11 14:48 custom.list
-rw-r--r-- 1   999 idsvc    0 Jul 11 14:48 dhcp.leases
-rw-r--r-- 1 root  root   651 Jul 11 14:48 dns-servers.conf
-rw-rw-r-- 1   999 idsvc  96K Jul 11 14:48 gravity.db
-rw-rw-r-- 1   999 idsvc  92K Jul 11 14:48 gravity_old.db
-rw-r--r-- 1 root  root    65 Jul 11 14:48 local.list
-rw-r--r-- 1 root  root   241 Jul 11 14:48 logrotate
-rw-rw-r-- 1   999 root   177 Jul 11 14:48 pihole-FTL.conf
-rw-rw-r-- 1   999 idsvc 164K Jul 11 14:55 pihole-FTL.db
-rw-r--r-- 1 root  root   583 Jul 11 14:48 setupVars.conf
-rw-r--r-- 1 root  root    27 Jul 11 14:48 setupVars.conf.update.bak
-rw-r--r-- 1 root  root   382 Jul 11 14:49 versions
resulting permissions pihole-2
./etc-dnsmasq.d:
total 24
-rw-r--r-- 1    0    0 1507 Jul 11 14:54 01-pihole.conf
-rw-r--r-- 1    0    0  523 Jul 11 14:54 02-pihole-dhcp.conf
-rw-r--r-- 1 1000 1000 1103 Jul 11 14:52 04-pihole-static-dhcp.conf
-rw-r--r-- 1 1000 1000 2152 Jul 11 14:52 05-pihole-custom-cname.conf
-rw-r--r-- 1    0    0 2190 Jul 11 14:53 06-rfc6761.conf
-rw-r--r-- 1 1000 1000  269 Jul 11 14:52 07-id-custom.conf

./etc-pihole:
total 308
-rw-r--r-- 1 1000 1000   896 Jul 11 14:52 custom.list
-rw-r--r-- 1  999 1000     0 Jul 11 14:54 dhcp.leases
-rw-r--r-- 1    0    0   651 Jul 11 14:53 dns-servers.conf
-rw-rw-r-- 1  999 1000 98304 Jul 11 14:55 gravity.db
-rw-rw-r-- 1  999 1000 94208 Jul 11 14:54 gravity_old.db
-rw-r--r-- 1    0    0    65 Jul 11 14:55 local.list
-rw-r--r-- 1    0    0   241 Jul 11 14:53 logrotate
-rw-rw-r-- 1  999    0   177 Jul 11 14:54 pihole-FTL.conf
-rw-rw-r-- 1  999 1000 81920 Jul 11 14:57 pihole-FTL.db
-rw-r--r-- 1    0    0   583 Jul 11 14:55 setupVars.conf
-rw-r--r-- 1    0    0    27 Jul 11 14:54 setupVars.conf.update.bak
-rw-r--r-- 1    0    0   357 Jul 11 14:56 versions

Results

  1. No issues in docker compose logs
  2. Dashboard shows queries only from when container was restarted
  3. Long Term Data | Graphics | Today shows results from restart NEW
  4. Tools | Generate debug log | Execute database integrity check completed NEW

The only issue I can see is that the long term data does not show anything BEFORE today. The databases may be large, but the system cannot show them.

Here are the debug tokens for each host:

It looks like a hard reset resolved the issues as the container set up the essential items, and just the additional configuration elements that are part of my repository were used but not touched.

For reference, my repository folder structure for my pi-hole containers looks like this:

/srv/pihole:
.env.example                  # settings for each server
compose.yaml                  # docker compose file

/srv/pihole/etc-dnsmasq.d:
04-pihole-static-dhcp.conf    # list of devices that need a static dhcp lease
05-pihole-custom-cname.conf   # list of cnames for local subdomains
07-id-custom.conf             # dhcp-options for dnsmasq

/srv/pihole/etc-pihole:
custom.list                   # local a records

I copy .env.example to .env and edit the environment file to add the password, then start the container.

The only thing missing is the ability to import an adlist as configuration but I know that went away.


Thank you @Bucking_Horn - this was a great help. The only issue now appears to be permissions on the SQLite3 database contents. I could fire up an Adminer container and see if I can poke around to see what the issue is, but I'll ask the community first if there's a way to fix this.

1 Like

Ok.
It seeems that, by itself, that would't preclude other means, as long as they can be externalised and reapplied in a repeatable fashion.
I'd like to encourage you to take a second look, if only to verify if that may (partially) work for you.

One could consider e.g. to feed specific FTLCONF_[SETTING] as a parameter into the container instead of moving around a copy of /etc/pihole/pihole-FTL.conf, or to apply a teleporter import instead of copying /etc/pihole/custom.list and /etc/dnsmasq.d/05-pihole-custom-cname.conf.
A teleporter import would also cover restoration of gravity contents, potentially addressing your adlist configuration requirement.

Of course, for files like custom dnsmasq configurations, you'd have to keep storing and copying them, and the same would be true for the long-term database.

I've been monitoring my two containers and even after restarts or reboots the data is now visible, so resetting the folder structure and letting pi-hole create what it needed fixed the issue.

In terms of my approach to GitOps, the use of FTLCONF_[SETTING] is exactly what I like to use where possible. I am very pleased that the pi-hole team expose so many environment variables for their docker image.

1 Like

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