geerlingguy / internet-pi

Raspberry Pi config for all things Internet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect [ip_address]/admin

foxmulder4223 opened this issue · comments

Hey everyone,

maybe this is not really a bug, but whenever I try to connect to pihole (locally on the rasp_pi or from another device) I receive the message "unable to connect" inside the browser.

I checked if ping [ip_address] has a result, and yes. There is no timeout or anything, only positive results.

Thanks in advance for your help <3

Hi @foxmulder4223,

what address are you trying?
http://[ip-address]:38080/admin or something else?

Hi @martinbrose,

actually it is any address with my local pi ip.

Ok, but are you using the port as well? 38080?

I wanted to access the pihole page. Even with the port I am unable to establish a connection.

Even reinstalling everything won't help.
My inventory file looks like this:

[internet_pi]
#10.0.100.52 ansible_user=pi

# Comment out the previous line and uncomment this to run inside Raspberry Pi.
connection=local ansible_connection=local ansible_user=pi

The congig file is more or less untouched, except for the passwords.

Probably there is the error burried somewhere.

Well, you didn't mention any install errors. So that seems to have run okay?

Let's establish basics and see if your pi-hole docker container is running.
Could you please check the output of 'docker ps' on your Pi?

Alright. There it is..
Sorry I haven't paid much attention to it, since this is just something on the side from regular work. Docker daemon seems to be the problem.

docker ps
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/container/json": dial unix /var/run/docker.sock: connect: permission denied

When I execute the ansible playbook main.yml command docker is skipped due to [connection=local] which I set up in the inventory.

Make copies of the following files and customize them to your liking:

example.inventory.ini to inventory.ini (replace IP address with your Pi's IP, or comment that line and uncomment the connection=local line if you're running it on the Pi you're setting up).
example.config.yml to config.yml

Maybe the way I set it up is not correct.

Ok, you're problem is deeper than just an access problem to the Pi-Hole web frontend.

Your docker permission error would have me believe that your user is not part of the docker group. Which can be a common problem when the install doesn't finish successfully. So I would expect to see an error during your run of the ansible playbook.

Could you please ensure you follow the setup instructions here: https://github.com/geerlingguy/internet-pi?tab=readme-ov-file#setup

If you run the install locally on your Raspberry Pi, then the second option in the first point in step 4 is the option to pick.

If there are any error messages in the setup process, please let me know and we'll take it from there.

Maybe share the whole output from the setup process to be safe.

In case you don't see any errors, have a look at the following closed issue:

Your comment that docker is skipped in the setup process might indicate that you have docker already installed and only a user permission problem.

Alright...

So my inventory.yml looks now like this:

[internet_pi]
#10.0.100.52 ansible_user=pi

# Comment out the previous line and uncomment this to run inside Raspberry Pi.
127.0.0.1 ansible_connection=local ansible_user=pi

But actually it does not make any difference if line 4 starts with 127.0.0.1 or connection=local. The summary is the same, as you see below:

daniel@raspberrypi:~/git_rep/internet-pi $ ansible-playbook main.yml

PLAY [Configure Internet Pi.] **************************************************

TASK [Gathering Facts] *********************************************************
ok: [127.0.0.1]

TASK [Load configuration (with defaults from example file).] *******************
ok: [127.0.0.1] => (item=example.config.yml)
ok: [127.0.0.1] => (item=config.yml)

TASK [Ensure apt cache is up to date.] *****************************************
ok: [127.0.0.1]

TASK [Ensure pacman cache is up to date] ***************************************
skipping: [127.0.0.1]

TASK [Check if Docker is already present.] *************************************
ok: [127.0.0.1]

TASK [Download Docker install convenience script.] *****************************
skipping: [127.0.0.1]

TASK [Run Docker install convenience script.] **********************************
skipping: [127.0.0.1]

TASK [Ensure Docker is started.] ***********************************************
ok: [127.0.0.1]

TASK [Ensure dependencies are installed (Debian).] *****************************
ok: [127.0.0.1]

TASK [Ensure dependencies are installed (Archlinux).] **************************
skipping: [127.0.0.1]

TASK [Ensure user is added to the docker group: pi] ****************************
ok: [127.0.0.1]

TASK [Reset connection so docker group is picked up.] **************************
[WARNING]: Reset is not implemented for this connection

TASK [Gather package facts.] ***************************************************
skipping: [127.0.0.1]

TASK [Add Buster backports apt key.] *******************************************
skipping: [127.0.0.1] => (item=04EE7237B7D453EC) 
skipping: [127.0.0.1] => (item=648ACFD622F3D138) 
skipping: [127.0.0.1] => (item=0E98404D386FA1D9) 
skipping: [127.0.0.1] => (item=6ED0E7B82643E131) 
skipping: [127.0.0.1]

TASK [Add Buster backports for fixed libseccomp2.] *****************************
skipping: [127.0.0.1]

TASK [Install >libseccomp2.4.4 to fix 32-bit OS issue.] ************************
skipping: [127.0.0.1]

TASK [Synchronize internet-monitoring directory.] ******************************
ok: [127.0.0.1]

TASK [Ensure internet-monitoring directory is not a Git repository.] ***********
ok: [127.0.0.1]

TASK [Copy templated internet-monitoring files into place.] ********************
ok: [127.0.0.1] => (item={'src': 'docker-compose.yml.j2', 'dest': 'docker-compose.yml'})
ok: [127.0.0.1] => (item={'src': 'grafana-config.monitoring.j2', 'dest': 'grafana/config.monitoring'})
ok: [127.0.0.1] => (item={'src': 'prometheus.yml.j2', 'dest': 'prometheus/prometheus.yml'})
ok: [127.0.0.1] => (item={'src': 'prometheus-pinghosts.yaml.j2', 'dest': 'prometheus/pinghosts.yaml'})

TASK [Ensure internet-monitoring environment is running.] **********************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "/usr/bin/docker --host unix:///var/run/docker.sock version --format '{{ json . }}'", "msg": "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version\": dial unix /var/run/docker.sock: connect: permission denied", "rc": 1, "stderr": "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version\": dial unix /var/run/docker.sock: connect: permission denied\n", "stderr_lines": ["permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version\": dial unix /var/run/docker.sock: connect: permission denied"], "stdout": "{\"Client\":{\"Platform\":{\"Name\":\"\"},\"Version\":\"20.10.24+dfsg1\",\"ApiVersion\":\"1.41\",\"DefaultAPIVersion\":\"1.41\",\"GitCommit\":\"297e128\",\"GoVersion\":\"go1.19.8\",\"Os\":\"linux\",\"Arch\":\"arm64\",\"BuildTime\":\"Thu May 18 08:41:26 2023\",\"Context\":\"default\",\"Experimental\":true},\"Server\":null}\n", "stdout_lines": ["{\"Client\":{\"Platform\":{\"Name\":\"\"},\"Version\":\"20.10.24+dfsg1\",\"ApiVersion\":\"1.41\",\"DefaultAPIVersion\":\"1.41\",\"GitCommit\":\"297e128\",\"GoVersion\":\"go1.19.8\",\"Os\":\"linux\",\"Arch\":\"arm64\",\"BuildTime\":\"Thu May 18 08:41:26 2023\",\"Context\":\"default\",\"Experimental\":true},\"Server\":null}"]}

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



Perfect, that makes more sense now...

Definitely try the issue I linked above, because I believe your user pi needs to be added to the docker user group.
That should fix it...

In the rare case it is not, there are plenty of closed issues for that error:
https://github.com/geerlingguy/internet-pi/issues?q=is%3Aissue+is%3Aclosed+ensure+internet-monitoring+environment+is+running

<3

That did the trick. No more errors. Pihole gets loaded. It was "just" the matter of adding the $USER to the docker group.

Glad that solved it. Enjoy!