pi-hole / docker-pi-hole

Pi-hole in a docker container
https://pi-hole.net
Other
8.53k stars 1.13k forks source link

Improper exec causes container to stop without telling the user why it stopped. #1614

Closed Magicrafter13 closed 2 months ago

Magicrafter13 commented 3 months ago

This is a: Bug

Details

My previous container, created through cockpit, worked fine. So while the fact that this container is no longer starting with a new systemd config isn't technically a bug, I believe the fact that the container just shuts itself down without any explanation, is in fact, a bug. Here is the journalctl output:

Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service s6rc-oneshot-runner: starting
Jul 26 13:31:12 centauri podman[2449763]: 2024-07-26 13:31:12.546500184 -0700 PDT m=+0.282731127 container start 564ab25f1f3cd5e19244e872aae7e93531708c733fb88e53bc34183e2d7d2073 (image=docker.io/pihole/pihole:latest, name=systemd-pihole, org.opencontainers.image.url=https://github.com/pi-hole/docker-pi-hole, org.opencontainers.image.licenses=NOASSERTION, org.opencontainers.image.source=https://github.com/pi-hole/docker-pi-hole, org.opencontainers.image.created=2024-07-05T18:19:25.777Z, org.opencontainers.image.version=2024.07.0, org.opencontainers.image.description=Pi-hole in a docker container, org.opencontainers.image.title=docker-pi-hole, PODMAN_SYSTEMD_UNIT=pihole.service, org.opencontainers.image.revision=4149693092ea364c7aab6c30ba0b308e4bc45716)
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service s6rc-oneshot-runner successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service fix-attrs: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service fix-attrs successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-cont-init: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-cont-init successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service cron: starting
Jul 26 13:31:12 centauri pihole[2449763]: 564ab25f1f3cd5e19244e872aae7e93531708c733fb88e53bc34183e2d7d2073
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service cron successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _uid-gid-changer: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _uid-gid-changer successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _startup: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Starting docker specific checks & setup for docker pihole/pihole
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Setting capabilities on pihole-FTL where possible
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Applying the following caps to pihole-FTL:
Jul 26 13:31:12 centauri systemd-pihole[2449870]:         * CAP_CHOWN
Jul 26 13:31:12 centauri systemd-pihole[2449870]:         * CAP_NET_BIND_SERVICE
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Ensuring basic configuration by re-running select functions from basic-install.sh
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Installing configs from /etc/.pihole...
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
Jul 26 13:31:12 centauri systemd-pihole[2449870]: [101B blob data]
Jul 26 13:31:12 centauri systemd-pihole[2449870]: [110B blob data]
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Installing latest logrotate script...
Jul 26 13:31:12 centauri systemd-pihole[2449870]:         [i] Existing logrotate file found. No changes made.
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Assigning password defined by Environment Variable
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [✓] New password set
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [✓] Set temperature unit to C
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Added ENV to php:
Jul 26 13:31:12 centauri systemd-pihole[2449870]:                     "TZ" => "America/Los_Angeles",
Jul 26 13:31:12 centauri systemd-pihole[2449870]:                     "PIHOLE_DOCKER_TAG" => "",
Jul 26 13:31:12 centauri systemd-pihole[2449870]:                     "PHP_ERROR_LOG" => "/var/log/lighttpd/error-pihole.log",
Jul 26 13:31:12 centauri systemd-pihole[2449870]:                     "CORS_HOSTS" => "",
Jul 26 13:31:12 centauri systemd-pihole[2449870]:                     "VIRTUAL_HOST" => "564ab25f1f3c",
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Using IPv4 and IPv6
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]: [80B blob data]
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] setup_blocklists now setting default blocklists up: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] TIP: Use a docker volume for /etc/pihole/adlists.list if you want to customize for first boot
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Blocklists (/etc/pihole/adlists.list) now set to:
Jul 26 13:31:12 centauri systemd-pihole[2449870]: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Existing DNS servers detected in setupVars.conf. Leaving them alone
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Applying pihole-FTL.conf setting LOCAL_IPV4=[redacted]
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] FTL binding to default interface: eth0
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Enabling Query Logging
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Testing lighttpd config: Syntax OK
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] All config checks passed, cleared for startup ...
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Docker start setup complete
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] pihole-FTL (no-daemon) will be started as pihole
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _startup successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service pihole-FTL: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service pihole-FTL successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service lighttpd: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service lighttpd successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _postFTL: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _postFTL successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-services: starting
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   Checking if custom gravity.db is set in /etc/pihole/pihole-FTL.conf
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-services successfully started
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-services: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-services successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _postFTL: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _postFTL successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service lighttpd: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: Stopping lighttpd
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service lighttpd successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service pihole-FTL: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: Stopping pihole-FTL
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service pihole-FTL successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _startup: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _startup successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _uid-gid-changer: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service _uid-gid-changer successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service cron: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]:   [i] Neutrino emissions detected...
Jul 26 13:31:12 centauri systemd-pihole[2449870]: Stopping cron
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service cron successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-cont-init: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: [53B blob data]
Jul 26 13:31:12 centauri systemd-pihole[2449870]: 
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service legacy-cont-init successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service fix-attrs: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service fix-attrs successfully stopped
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service s6rc-oneshot-runner: stopping
Jul 26 13:31:12 centauri systemd-pihole[2449870]: s6-rc: info: service s6rc-oneshot-runner successfully stopped
Jul 26 13:31:16 centauri systemd-pihole[2449870]:   [i] Preparing new gravity database...
Jul 26 13:31:16 centauri podman[2450302]: 2024-07-26 13:31:16.890478604 -0700 PDT m=+0.019600247 container died 564ab25f1f3cd5e19244e872aae7e93531708c733fb88e53bc34183e2d7d2073 (image=docker.io/pihole/pihole:latest, name=systemd-pihole, org.opencontainers.image.revision=4149693092ea364c7aab6c30ba0b308e4bc45716, org.opencontainers.image.created=2024-07-05T18:19:25.777Z, org.opencontainers.image.source=https://github.com/pi-hole/docker-pi-hole, org.opencontainers.image.version=2024.07.0, org.opencontainers.image.title=docker-pi-hole, org.opencontainers.image.url=https://github.com/pi-hole/docker-pi-hole, PODMAN_SYSTEMD_UNIT=pihole.service, org.opencontainers.image.description=Pi-hole in a docker container, org.opencontainers.image.licenses=NOASSERTION)
Jul 26 13:31:17 centauri podman[2450302]: 2024-07-26 13:31:17.16577758 -0700 PDT m=+0.294899259 container remove 564ab25f1f3cd5e19244e872aae7e93531708c733fb88e53bc34183e2d7d2073 (image=docker.io/pihole/pihole:latest, name=systemd-pihole, org.opencontainers.image.title=docker-pi-hole, org.opencontainers.image.created=2024-07-05T18:19:25.777Z, org.opencontainers.image.revision=4149693092ea364c7aab6c30ba0b308e4bc45716, org.opencontainers.image.source=https://github.com/pi-hole/docker-pi-hole, org.opencontainers.image.url=https://github.com/pi-hole/docker-pi-hole, org.opencontainers.image.version=2024.07.0, org.opencontainers.image.description=Pi-hole in a docker container, org.opencontainers.image.licenses=NOASSERTION, PODMAN_SYSTEMD_UNIT=pihole.service)
Jul 26 13:31:17 centauri systemd[1]: pihole.service: Deactivated successfully.
░░ Subject: Unit succeeded
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit pihole.service has successfully entered the 'dead' state.

Related Issues

How to reproduce the issue

  1. Environment data

    • Operating System: Fedora Server 40
    • Hardware: Dell PowerEdge T40
    • Kernel Architecture: x86_64, Linux Kernel 6.8.11
    • Docker Install Info and version:
    • Software source: OS provided podman package
    • Supplimentary Software:
    • Hardware architecture: x86_64
  2. docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here pihole.container:

    
    [Unit]
    Description=Pi-Hole DNS Blocker/Resolver

[Container] Image=docker.io/pihole/pihole:latest

Volume=pihole.volume:/etc/pihole Volume=pihole-dnsmasq.volume:/etc/dnsmasq.d Network=podman.network DNS=[redacted (my ISP)] PublishPort=10.0.0.5:53:53 PublishPort=10.0.0.5:53:53/udp PublishPort=980:80 Environment=TZ=America/Los_Angeles Environment=WEBPASSWORD=[redacted] Environment=FTLCONF_LOCAL_IPV4=[redacted] Environment=TEMPERATUREUNIT=c

Exec=bash

[Service] Restart=unless-stopped

[Install] WantedBy=multi-user.target default.target

pihole.volume and pihole-dnsmasq.volume:

[Volume] User=root Group=root

podman.network:

[Network] Gateway=10.88.0.1 IPRange=10.88.0.0/16 Subnet=10.88.0.0/16 Label=org.test.Key=value


3. any additional info to help reproduce
- First, this assumes that these generators/services don't already exist, and neither do the associated volumes, so remove them I suppose if you have them.
- Create /etc/containers/systemd/pihole.container, /etc/containers/systemd/pihole.volume, /etc/containers/systemd/pihole-dnsmasq.volume, and /etc/containers/systemd/podman.network
- Run `sudo systemctl daemon-reload`
- Run `sudo systemctl start pihole`
- Wait
- Observe (`journalctl -xeu pihole`)

## These common fixes didn't work for my issue
<!-- IMPORTANT! Help me help you! Ordered with most common fixes first. -->
- [X] I have tried removing/destroying my container, and re-creating a new container
- [X] I have tried fresh volume data by backing up and moving/removing the old volume data
- [ ] I have tried running the stock `docker run` example(s) in the readme (removing any customizations I added) - N/A as I use podman with systemd and I don't believe you provide examples for such
- [ ] I have tried a newer or older version of Docker Pi-hole (depending what version the issue started in for me) - No, however I created a container with the same image (:latest) through the cockpit podman web UI, and it started up without issue. And there would be no reason to try an older version because this is an issue with the latest version (the lack of distinctive error output).
- [X] I have tried running without my volume data mounts to eliminate volumes as the cause

If the above debugging / fixes revealed any new information note it here.
Add any other debugging steps you've taken or theories on root cause that may help.
Magicrafter13 commented 3 months ago

It appears the issue was caused by setting Exec=bash, even though that's what Cockpit claimed was being exec'd in the container. Still, there was no indication of this, or any hint towards it. image

rdwebdesign commented 3 months ago

It appears the issue was caused by setting Exec=bash, even though that's what Cockpit claimed was being exec'd in the container.

The file you posted is not a Pi-hole file.

Where did you find it?

Magicrafter13 commented 3 months ago

I posted it under the

docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here

section - that's my container declaration

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.