On the original link it said I have to use exec it ip -a on the container to check the IP but Docker cant do it because the container is not up yet ... Is there a solution for this ? Help
Hey @Deuxst , welcome! Not to worry about the whole new topic thing, its actually good that you have a referring link cause I got notified, amazing how this works seamlessly!
It seems the problem is with permissions, could you run the following and try starting pi-hole again: chmod 755 10-fixroutes.sh
If that didn't work, then run this and share it with me: ls -la 10-fixroutes.sh
Looks like I missed that in the tutorial so thanks for sharing.
In the steps of the tutorial this is how the file gets created (notice the correct path in the end):
echo '#!/usr/bin/with-contenv bash
set -e
echo "fixing routes"
ip route del default
ip route add default via 172.18.0.1
echo "done fixing routes"' >> ./pihole/etc-cont-init.d/10-fixroutes.sh
Can you mv 10-fixroutes.sh /pihole/etc-cont-init.d/ and try again? I think that should solve it.
Ok then, lets remove 10-fixroutes.sh so container does not read it anymore, just comment out (add a hashtag at the beginning) the line in docker-compose.yml as such:
[cont-init.d] 20-start.sh: executing...
::: Starting docker specific checks & setup for docker pihole/pihole
Failed to set capabilities on file `/usr/bin/pihole-FTL' (Operation not supported)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file
ERROR: Unable to set capabilities for pihole-FTL. Cannot run as non-root.
If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'
[cont-init.d] 20-start.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
And of course cannot
because the container is not up yet (always restarting because of the error).
Let's try using the same pihole version I have, it's a 6 months old version, though I haven't gotten to updating pihole but this version works great.
Take a backup and of the pihole directory and clean things up a bit:
# pihole-latest.tar is the backup, if you can share with me the output of the tar command for later reference
tar -cvf pihole-latest.tar pihole
# removing the pihole directory
rm -rf pihole
# recreating the folders as in the tutorial
mkdir -p ./pihole/etc-pihole/
mkdir -p ./pihole/etc-dnsmasq.d/
mkdir -p ./pihole/var-log/
mkdir -p ./pihole/etc-cont-init.d/
Modify the line in the docker-compose.yml file and try to start pihole again, change
image: pihole/pihole:latest
to
image: pihole/pihole:2021.09
And try again, if this works then we can continue with the steps in the tutorial to fully setup pihole.
And thank god the container was healthy and running but then I check the log it was
lighttpd: no process found
Starting lighttpd
2022-04-08 19:02:00: (server.c.750) opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
2022-04-08 19:02:00: (server.c.1461) Opening errorlog failed. Going down.
Stopping lighttpd
lighttpd: no process found
over and over again. what should I do next ?
ps : I'm so sorry for my bad English and if my responses is hard to understand
The container status was healthy but the logs is just repeat of lighthttpd error..
Here is the container status
root@OpenWrt:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e71d20fcd78c pihole/pihole:2021.09 "/s6-init" 2 hours ago Up 33 seconds (healthy) pihole
But the logs is
Starting lighttpd
2022-04-08 21:00:59: (server.c.750) opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
2022-04-08 21:00:59: (server.c.1461) Opening errorlog failed. Going down.
Stopping lighttpd
lighttpd: no process found
Starting lighttpd
2022-04-08 21:01:00: (server.c.750) opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
2022-04-08 21:01:00: (server.c.1461) Opening errorlog failed. Going down.
Stopping lighttpd
lighttpd: no process found
Starting lighttpd
2022-04-08 21:01:01: (server.c.750) opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
2022-04-08 21:01:01: (server.c.1461) Opening errorlog failed. Going down.
Stopping lighttpd
lighttpd: no process found
The container was running and it the lighthttpd error fixed. Continuing step from the original post @ahasbini you've made..
Ping the container , work
root@OpenWrt:~# ping 192.168.1.3
PING 192.168.1.3 (192.168.1.3): 56 data bytes
64 bytes from 192.168.1.3: seq=0 ttl=64 time=0.356 ms
64 bytes from 192.168.1.3: seq=1 ttl=64 time=0.260 ms
64 bytes from 192.168.1.3: seq=2 ttl=64 time=0.258 ms
--- 192.168.1.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
nslookup the container, nope..
root@OpenWrt:~# nslookup openwrt.org 192.168.1.3
;; connection timed out; no servers could be reached
executing docker exec -it pihole ip a
root@OpenWrt:~# docker exec -it pihole ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
8: eth0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:c0:a8:01:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.1.3/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
9: eth1@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.18.0.2/16 brd 172.18.255.255 scope global eth1
valid_lft forever preferred_lft forever
Now is the time for dealing the 10-fixroutes.sh and the SetupVars.conf ? how to do it ?
And also the last nslookup didn't work too and of course http://192.168.1.3/admin cant be reached..
root@OpenWrt:~# nslookup $root.lan 192.168.1.3
;; connection timed out; no servers could be reached
echo '#!/usr/bin/with-contenv bash
set -e
echo "fixing routes"
ip route del default
ip route add default via 172.18.0.1
echo "done fixing routes"' >> ./pihole/etc-cont-init.d/10-fixroutes.sh
chmod 755 ./pihole/etc-cont-init.d/10-fixroutes.sh
Continue with the tutorial from the step Start PiHole and finalize its setup. If you've already done the changes from some of the steps, then you can skip them.
Removing # from .yml file > creating 10-fixroutes.sh and chmod > compose up again > creating the setupVars.conf and the logs was ..
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 01-resolver-resolv: applying...
[fix-attrs.d] 01-resolver-resolv: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-fixroutes.sh: executing...
foreground: warning: unable to spawn /var/run/s6/etc/cont-init.d/10-fixroutes.sh: Exec format error
[cont-init.d] 10-fixroutes.sh: exited 127.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
Its the 10-fixroutes again ..
root@OpenWrt:~/pihole/etc-cont-init.d# ls -la
drwxr-xr-x 2 root root 4096 Apr 10 13:23 .
drwxr-xr-x 6 root root 4096 Apr 10 13:22 ..
-rwxr-xr-x 1 root root 147 Apr 10 13:28 10-fixroutes.sh
root@OpenWrt:~/pihole/etc-cont-init.d# cat 10-fixroutes.sh
echo '#!/usr/bin/with-contenv bash
set -e
echo "fixing routes"
ip route del default
ip route add default via 172.18.0.1
echo "done fixing routes"