Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK [Ensure Pi-hole is running.] fatal: [127.0.0.1]: FAILED! #613

Open
trifu22 opened this issue Aug 18, 2024 · 7 comments
Open

TASK [Ensure Pi-hole is running.] fatal: [127.0.0.1]: FAILED! #613

trifu22 opened this issue Aug 18, 2024 · 7 comments

Comments

@trifu22
Copy link

trifu22 commented Aug 18, 2024

Hi,
While trying to install Internet PI, (i am allready running Pihole for some time).
Ran into permissions issues with Docker but they got fixed when i added my user to the group dokcer.
Pihole is up and running ass it should.
On running $ ansible-playbook main.yml
i get the following error:

`TASK [Ensure Pi-hole is running.] **********************************************
fatal: [127.0.0.1]: FAILED! => {"actions": [{"id": "pihole",
 "status": "Starting",
 "what": "container"}],
 "changed": true,
 "cmd": "/usr/bin/docker compose --ansi never --progress json --project-directory /home/Trifu22/pi-hole up --detach --no-color --quiet-pull --no-build --",
 "containers": [{"Command": "\"/s6-init\"",
 "CreatedAt": "2024-08-19 02:30:08 +0300 EEST",
 "ExitCode": 0,
 "Health": "",
 "ID": "d8fd4e3ec0ebe85b0812df0404a876023f4ea828d5fad395e5a8dd7a197e2a19",
 "Image": "pihole/pihole:latest",
 "Labels": {"com.docker.compose.config-hash": "92a7f6326b422219e3402b32e05221c978f19c1824353c9ffa0f99f4e8d38cc3",
 "com.docker.compose.container-number": "1",
 "com.docker.compose.depends_on": "",
 "com.docker.compose.image": "sha256:78de8a1eefcf9777ff7199f58252bf171d082e8368b50c21bd11625877905781",
 "com.docker.compose.oneoff": "False",
 "com.docker.compose.project": "pi-hole",
 "com.docker.compose.project.config_files": "/home/Trifu22/pi-hole/docker-compose.yml",
 "com.docker.compose.project.working_dir": "/home/Trifu22/pi-hole",
 "com.docker.compose.replace": "1017931dd37a0858509c71acb3e330b60d04a5e0fd6a4e7fe8c27e5d0a9fba07",
 "com.docker.compose.service": "pihole",
 "com.docker.compose.version": "2.29.1",
 "org.opencontainers.image.created": "2024-07-05T18:19:25.777Z",
 "org.opencontainers.image.description": "Pi-hole in a docker container",
 "org.opencontainers.image.licenses": "NOASSERTION",
 "org.opencontainers.image.revision": "4149693092ea364c7aab6c30ba0b308e4bc45716",
 "org.opencontainers.image.source": "https://github.com/pi-hole/docker-pi-hole",
 "org.opencontainers.image.title": "docker-pi-hole",
 "org.opencontainers.image.url": "https://github.com/pi-hole/docker-pi-hole",
 "org.opencontainers.image.version": "2024.07.0"},
 "LocalVolumes": "0",
 "Mounts": "/home/Trifu22/pi-hole/etc-dnsmasq.d,
/etc/localtime,
/home/Trifu22/pi-hole/etc-pihole",
 "Name": "pihole",
 "Names": ["pihole"],
 "Networks": ["pi-hole_default"],
 "Ports": "",
 "Project": "pi-hole",
 "Publishers": [],
 "RunningFor": "3 minutes ago",
 "Service": "pihole",
 "Size": "0B",
 "State": "created",
 "Status": "Created"},
 {"Command": "\"./pihole-exporter\"",
 "CreatedAt": "2024-08-19 01:52:19 +0300 EEST",
 "ExitCode": 0,
 "Health": "",
 "ID": "1bcf3edd44e3f76e035200f9a6ff29f57d1d2550fdd9490663f785f4feab2f2e",
 "Image": "ekofr/pihole-exporter:latest",
 "Labels": {"com.docker.compose.config-hash": "a37a4b9297f54cda5756bbbe0ec66109cdd3b662c3d10bb3c0fa26ddfe88ee6c",
 "com.docker.compose.container-number": "1",
 "com.docker.compose.depends_on": "",
 "com.docker.compose.image": "sha256:8c7e537fea3c3ba2df5462c0024e63e4edd920bf7eecff0d685e912d5d8537b5",
 "com.docker.compose.oneoff": "False",
 "com.docker.compose.project": "pi-hole",
 "com.docker.compose.project.config_files": "/home/Trifu22/pi-hole/docker-compose.yml",
 "com.docker.compose.project.working_dir": "/home/Trifu22/pi-hole",
 "com.docker.compose.service": "pihole-exporter",
 "com.docker.compose.version": "2.29.1",
 "name": "pihole-exporter"},
 "LocalVolumes": "0",
 "Mounts": "",
 "Name": "pihole-exporter",
 "Names": ["pihole-exporter"],
 "Networks": ["pi-hole_default"],
 "Ports": "0.0.0.0:9617->9617/tcp,
 :::9617->9617/tcp",
 "Project": "pi-hole",
 "Publishers": [{"Protocol": "tcp",
 "PublishedPort": 9617,
 "TargetPort": 9617,
 "URL": "0.0.0.0"},
 {"Protocol": "tcp",
 "PublishedPort": 9617,
 "TargetPort": 9617,
 "URL": "::"}],
 "RunningFor": "41 minutes ago",
 "Service": "pihole-exporter",
 "Size": "0B",
 "State": "running",
 "Status": "Up 40 minutes"}],
 "images": [{"ContainerName": "pihole",
 "ID": "sha256:78de8a1eefcf9777ff7199f58252bf171d082e8368b50c21bd11625877905781",
 "Repository": "pihole/pihole",
 "Size": 306001631,
 "Tag": "latest"},
 {"ContainerName": "pihole-exporter",
 "ID": "sha256:8c7e537fea3c3ba2df5462c0024e63e4edd920bf7eecff0d685e912d5d8537b5",
 "Repository": "ekofr/pihole-exporter",
 "Size": 8716288,
 "Tag": "latest"}],
 "msg": "General error: Error response from daemon: driver failed programming external connectivity on endpoint pihole (5489dfe52571609d5b004322aeed02f8b15ed6c19bd40e24acf8a5ad14def64c): failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use",
 "rc": 1,
 "stderr": "{\"id\":\"Container pihole-exporter\",
\"status\":\"Running\"}\n{\"id\":\"Container pihole\",
\"status\":\"Starting\"}\n{\"error\":true,
\"message\":\"Error response from daemon: driver failed programming external connectivity on endpoint pihole (5489dfe52571609d5b004322aeed02f8b15ed6c19bd40e24acf8a5ad14def64c): failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use\"}\n",
 "stderr_lines": ["{\"id\":\"Container pihole-exporter\",
\"status\":\"Running\"}",
 "{\"id\":\"Container pihole\",
\"status\":\"Starting\"}",
 "{\"error\":true,
\"message\":\"Error response from daemon: driver failed programming external connectivity on endpoint pihole (5489dfe52571609d5b004322aeed02f8b15ed6c19bd40e24acf8a5ad14def64c): failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use\"}"],
 "stdout": "",
 "stdout_lines": []}

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=13   changed=1    unreachable=0    failed=1    skipped=8    rescued=0    ignored=0   ` 

My PiHole is handling DHCP on the network, so it makes sense to be bound on port 53.
Any thought on how to proceed with the installation?

@quadespresso
Copy link
Contributor

It looks to me like something else is already bound to 0.0.0.0:53 before you attempt to run the playbook.

Run this to get the PID:

sudo ss -tulpen | grep -w '0.0.0.0:53'

where you should get back something like pid=75382 if you get a match. You may well get 2 lines back for that port, where one is for TCP, the other for UDP.

Then from there (for each matching PID):

ps -ef | grep -w '75382' | grep -v grep

where in this example the PID is 75382. Let's see what that process is (/those processes are).

@trifu22
Copy link
Author

trifu22 commented Aug 19, 2024

Hi, well like i said, it's Pihole DHCP server

udp   UNCONN 0      0            0.0.0.0:53         0.0.0.0:*    users:(("pihole-FTL",pid=1092,fd=6),("pihole-FTL",pid=1083,fd=6),("pihole-FTL",pid=1079,fd=6),("pihole-FTL",pid=1020,fd=6))                                                                                
tcp   LISTEN 0      32           0.0.0.0:53         0.0.0.0:*    users:(("pihole-FTL",pid=1092,fd=7),("pihole-FTL",pid=1083,fd=7),("pihole-FTL",pid=1079,fd=7),("pihole-FTL",pid=1020,fd=7)) uid:999 ino:9369 sk:d cgroup:/system.slice/pihole-FTL.service <->

pihole 1092 1020 0 01:54 ? 00:00:00 /usr/bin/pihole-FTL -f

@quadespresso
Copy link
Contributor

I think more context is needed. It almost sounds like you're trying to run 2 different listeners on the same host.

What does your docker-compose.yml file look like?

And please when responding, follow this style guide and use code fences around pasted config files, logs, etc: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

@trifu22
Copy link
Author

trifu22 commented Aug 19, 2024

Hi, thanks for the quick reply.

And please when responding, follow this style guide and use code fences around pasted config files, logs, etc: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

Will comply

What does your docker-compose.yml file look like?

Well, meanwhile i have done a few thnings:
I've stopped Pihole DNS that uses port 53, tried again.
After doing that i've got a conflict on port 80 which is being used by nginx,
Stopped nginx service
The task was completed successfuly
BUT:
my DHCP reservations from pihole were gone
and now docker-pr was using port 80 and couldn't use nginx to serve my website so i needed to uninstall.
All i have now is a Rpi 3B+ with Bookworm distro.
will try to remake the install to show the contents of docker-compose.yml

@trifu22
Copy link
Author

trifu22 commented Aug 20, 2024

What does your docker-compose.yml file look like?

# Ansible managed
---

# 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
    restart: unless-stopped
    hostname: 'pihole'
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: '******'
      ServerIP: '192.168.0.2'
    dns:
      - 127.0.0.1
      - 8.8.8.8
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    cap_add:
      - NET_ADMIN

  pihole-exporter:
    container_name: pihole-exporter
    image: ekofr/pihole-exporter:latest
    restart: unless-stopped
    hostname: 'pihole-exporter'
    ports:
      - "9617:9617"
    environment:
      PIHOLE_HOSTNAME: 'pihole'
      PIHOLE_PASSWORD: '******'
      INTERVAL: '30s'
      PORT: 9617

@quadespresso
Copy link
Contributor

I see. So you're trying to run an instance of pihole using this stack, in addition to your preexisting pihole instance?

@trifu22
Copy link
Author

trifu22 commented Aug 20, 2024

Thank you for getting back to me so quick!
Well yes, i have been running Pihole for about two years, plus Nginx to serve my website htat's why port 80 and 443 are open.
Pihole manages the DHCP leases on the network so this xplains why port 53 is in use.
i thought that the preexisting installment of pihole would work.
need to find a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants