Pi-hole stops working after power outage or restart

Here it is

pi@raspberrypi:~ $ sudo systemctl status pihole-FTL.service
● pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/init.d/pihole-FTL; generated; vendor preset: enabled)
   Active: active (exited) since Fri 2018-06-08 10:38:11 EDT; 3min 42s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 284 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/pihole-FTL.service

Jun 08 10:38:07 raspberrypi systemd[1]: Starting LSB: pihole-FTL daemon...
Jun 08 10:38:08 raspberrypi pihole-FTL[284]: Not running
Jun 08 10:38:08 raspberrypi pihole-FTL[284]: rm: cannot remove '/var/run/pihole/FTL.sock': No such file or directory
Jun 08 10:38:09 raspberrypi su[361]: Successful su for pihole by root
Jun 08 10:38:09 raspberrypi su[361]: + ??? root:pihole
Jun 08 10:38:09 raspberrypi su[361]: pam_unix(su:session): session opened for user pihole by (uid=0)
Jun 08 10:38:11 raspberrypi pihole-FTL[284]: FTL started!
Jun 08 10:38:11 raspberrypi systemd[1]: Started LSB: pihole-FTL daemon.

pi@raspberrypi:~ $

    pi@raspberrypi:~ $ sudo systemctl status dnsmasq
    ● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
       Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2018-06-08 10:38:11 EDT; 3min 41s ago
      Process: 467 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
      Process: 450 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
      Process: 379 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
     Main PID: 463 (dnsmasq)
       CGroup: /system.slice/dnsmasq.service
               └─463 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg

    Jun 08 10:38:08 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
    Jun 08 10:38:11 raspberrypi dnsmasq[379]: dnsmasq: syntax check OK.
    Jun 08 10:38:11 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
    ...skipping...

Those outputs look fine.

What about:

nslookup flurry.com

sudo systemctl status lighttpd.service

See below. I did two nslookups back to back.

pi@raspberrypi:~ $ nslookup flurry.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: flurry.com
Address: 192.168.1.12

pi@raspberrypi:~ $ nslookup flurry.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: flurry.com
Address: 192.168.1.12

pi@raspberrypi:~ $ sudo systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-06-08 13:15:27 EDT; 3min 40s ago
Process: 415 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
Main PID: 550 (lighttpd)
CGroup: /system.slice/lighttpd.service
├─550 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
├─562 /usr/bin/php-cgi
├─659 /usr/bin/php-cgi
├─660 /usr/bin/php-cgi
├─661 /usr/bin/php-cgi
└─662 /usr/bin/php-cgi

Jun 08 13:15:22 raspberrypi systemd[1]: Starting Lighttpd Daemon...
Jun 08 13:15:27 raspberrypi lighttpd[415]: 2018-06-08 13:15:23: (server.c.1295) WARNING: unknown config-key: alias.url (ignor
Jun 08 13:15:27 raspberrypi systemd[1]: Started Lighttpd Daemon.
pi@raspberrypi:~ $
pi@raspberrypi:~ $
pi@raspberrypi:~ $ echo after refreshing http://192.168.1.12/admin/index.php?login
after refreshing http://192.168.1.12/admin/index.php?login
pi@raspberrypi:~ $ nslookup flurry.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: flurry.com
Address: 192.168.1.12

pi@raspberrypi:~ $ sudo systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-06-08 13:15:27 EDT; 4min 51s ago
Process: 415 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
Main PID: 550 (lighttpd)
CGroup: /system.slice/lighttpd.service
├─550 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
├─562 /usr/bin/php-cgi
├─659 /usr/bin/php-cgi
├─660 /usr/bin/php-cgi
├─661 /usr/bin/php-cgi
└─662 /usr/bin/php-cgi

Jun 08 13:15:22 raspberrypi systemd[1]: Starting Lighttpd Daemon...
Jun 08 13:15:27 raspberrypi lighttpd[415]: 2018-06-08 13:15:23: (server.c.1295) WARNING: unknown config-key: alias.url (ignor
Jun 08 13:15:27 raspberrypi systemd[1]: Started Lighttpd Daemon.
Jun 08 13:19:59 raspberrypi sudo[1046]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin
Jun 08 13:19:59 raspberrypi sudo[1046]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jun 08 13:19:59 raspberrypi sudo[1046]: pam_unix(sudo:session): session closed for user root

Both nslookup commands returned the correct reply. That means that the DNS resolution was working, at least locally. (flurry.com is a known blocked domain and it was Pi-holed).

The Lighttpd Daemon on the other hand ... is behaving weirdly

Thanks for your help. Let me know, or anyone else, what I should do.

Thanks

Ramset,
Any suggestions on this issue?

Thanks for your help.

What about the same nslookup command on a client, after the raspberry came back online?

Form the above test you did locally, Pi-hole was working as expected (after power failure).

Is your raspberry hardwired into the router or ar you using the WiFi connection ?

It's a hardwired connection. Here is the output of ifconfig. Should wlan0 be down?

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::f56a:6de9:acb6:1811 prefixlen 64 scopeid 0x20
ether b8:27:eb:8f:e6:f2 txqueuelen 1000 (Ethernet)
RX packets 10942786 bytes 1286202824 (1.1 GiB)
RX errors 0 dropped 224948 overruns 0 frame 0
TX packets 4185446 bytes 449738352 (428.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 3388759 bytes 237819550 (226.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3388759 bytes 237819550 (226.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::ee61:e0b5:9dcf:465a prefixlen 64 scopeid 0x20
ether b8:27:eb:da:b3:a7 txqueuelen 1000 (Ethernet)
RX packets 6079409 bytes 601220673 (573.3 MiB)
RX errors 0 dropped 213739 overruns 0 frame 0
TX packets 9210 bytes 636651 (621.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Nslookup on my macbook after reboot but nothing else:
2017-Bens-MacBook-Pro:Downloads Ben$ nslookup flurry.com
;; connection timed out; no servers could be reached

VNC'd to rasberry pi 192.168.1.12
Nslookup on rasberry pi:
pi@raspberrypi:~ $ nslookup flurry.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: flurry.com
Address: 192.168.1.12

Still no internet on macbook

From macbook using chrome browser after connecting to raspberry pi http://192.168.1.12/admin/index.php

dns is working;

2017-Bens-MacBook-Pro:Downloads Ben$ nslookup flurry.com
Server: 192.168.1.12
Address: 192.168.1.12#53

Name: flurry.com
Address: 192.168.1.12

This does not seem to be related to the Pi-hole instance.
You were able to connect to the raspberry via VNC and the DNS worked when you queried the domain.

what's the response you get from your client when you run

nslookup flurry.com 192.168.1.12

After raspberry reboot, can you access the flurry page on a different device (maybe cell phone/tablet)?

Here are the results from my macbook pro

2017-Bens-MacBook-Pro:Downloads Ben$ echo before reboot of raspberry pi
before reboot of raspberry pi
2017-Bens-MacBook-Pro:Downloads Ben$ nslookup flurry.com 192.168.1.12
Server: 192.168.1.12
Address: 192.168.1.12#53

Name: flurry.com
Address: 192.168.1.12

2017-Bens-MacBook-Pro:Downloads Ben$ echo after raspberry pi reboot
after raspberry pi reboot
2017-Bens-MacBook-Pro:Downloads Ben$ nslookup flurry.com 192.168.1.12
;; connection timed out; no servers could be reached

After reboot on my iphone i could not reach yahoo.com.
Then I went to pi-hole admin page on my iphone
Then I was able to access yahoo.com from my iphone.

Does your router have DNS rebind protection ?

I dig up this conversation because I had the same issue with a newly installed pi-hole.

I turn off all devices at night, included the pi. So the pi-hole need to restart correctly each day. After one week trying, I finally succeeded! It's a dirty solution but it work, maybe some of you will find something more clean.

For me, pi-hole can't work as a DNS server when restarted because he don't have the right time.
So :
1/ I installed ntp on the Pi.
2/ I forced "nameserver 8.8.8.8" on /etc/resolv.conf
3/ I change the right of this file to 555 to avoid system modification each time.

After each start, the pi need a bit of time to sync with ntp server but after that, all good to go.

1 Like

1/ I installed ntp on the Pi.
2/ I forced “nameserver 8.8.8.8” on /etc/resolv.conf
3/ I change the right of this file to 555 to avoid system modification each time.

Thanks! I had the same problem and this fixed it.

1 Like

This is true only for the Pi itself. Other clients will continue to use the Pi-Hole as DNS.

1 Like

You can change it back to 127.0.0.1 after ntp setup if you want. but ntp to be installed and configured, I needed to change the DNS to 8.8.8.8

A post was split to a new topic: Pi-hole not running after reboot

This has got to be the stupidest thing ever. So time goes off and internet doesn't work.
You cannot manually set the time. You cannot edit the file for the name server. You cannot install NTP.

Last time power went out the only solution was to wipe the pi and install it again.

Pi-hole since version 5.0 (May 2020) no longer changes the nameserver assigned to the Pi-hole host device.

https://pi-hole.net/2020/05/10/pi-hole-v5-0-is-here/#page-content

If your Pi-hole host is using Pi-hole as nameserver, you change this in the OS and the host will have access to a DNS server whether Pi-hole is operating or not.

after the 6th time of setting the time it finally worked. Hopefully with just the install of NTP is enough to not have this issue again.

A post was split to a new topic: Pi-hole not working