Pihole fresh install working but admin/web interface inaccessible

So.. fresh install of a PiHole on a NanoPi black running Ubuntu1604

Expected Behaviour:

Access admin interface by IP anytime without it going down...

Actual Behaviour:

Admin/web interface works, then after maybe 30 seconds it goes down and doesn't come back... yet PiHole is still blocking ads.

I can reboot, mess with it a bit and get the admin interface to work again, then it disappears again and can't be reached. I tried a full reset and also a pihole repair command but neither have resolved the issue.

I cat the /var/log/pihole.log and I can see that queries are still getting blocked

I have checked many potential solutions such as 'lighthttpd' service not working or not having permissions, however that is running ok and I checked the var log permissions for ww. Also nothing else is listening on port 80. Can't figure out this one. Possibly dnsmasq? Thanks to anyone who can help figure this out... I have used PiHole on raspberry pi and also on proxMox before and never had this issue

netstat -pntle  | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          20345       3032/lighttpd
tcp6       0      0 :::80                   :::*                    LISTEN      0          20346
sudo service lighttpd status -l
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-05-09 22:36:22 UTC; 17min ago

Debug Token:

mhg7kywob5

Hi, I have similar behaviour, also in a new fresh instalation under armbian (range Pi Zero board).
The situation is also similar abot other guy few month ago in this topic: Pihole running, but can't access admin page - #13 by deHakkelaar
I tried all steps, with the difference that the folder /var/log/lighttpd doesn't esxist, but it is already located in /etc/lighttpd (or I hope)
If I check the status of PiHole, it seems that locally it is working properly, but the admin web access is not accessible, (as your situation).

With this command: journalctl --no-pager -u lighttpd

The response is too long, but seems that the issue comes with: Failed to start Lighttpd Daemon

May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Main process exited, code=exited, status=255/n/a
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Unit entered failed state.
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Failed with result 'exit-code'.
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
May 09 01:10:27 orangepizero systemd[1]: Stopped Lighttpd Daemon.
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Start request repeated too quickly.
May 09 01:10:27 orangepizero systemd[1]: Failed to start Lighttpd Daemon.
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Unit entered failed state.
May 09 01:10:27 orangepizero systemd[1]: lighttpd.service: Failed with result 'exit-code'.

Debug Token: 227xfgucun

Tomorrow I will reinstall all again. (here 1.11 am).

thanks in advance!

SinE80

Yeah late here too... still can't get it working. Just rebooted it again and every time I can get to access the admin interface by IP but with 'Lost connection to API' and no stats visible.

On the ssh terminal, I run

root@pi:~# pihole status
  [✗] DNS service is NOT running
root@pi:~# pihole restartdns
  [✓] Restarting DNS service

And that fixes the web interface stats error, but the stats are reset (ie back to zero). DNS works again. I see a couple of queries working... AND THEN within a minute, I try clicking on one of the settings options on the admin page and it fails to load again with the error This site can’t be reached

EDIT: Ok, doing some further late night troubleshooting - I decided to tail the FTL log and found something interesting - a lot of errors. A quick google led me to see it was related to the time being out of sync. I then noticed that the time and date was way off (2016) it was not persisting - every time I rebooted the time was going back to 2016. Whatever was happening it was causing some issues for sure.

Now I am seeing all my previous queries in the web interface (ie. from earlier in the evening). I have yet to figure out how to get the time and date to persist however through reboots, bizarre. This is the command I set it with:

sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start

EDIT again: I spoke too soon, it's gone again. Admin interface / web interface down again. It took longer to go down this time though (maybe 5-10 minutes). Time and date are all correct now so it's not that. Everything is running ok, just the web interface is not.

pihole status
  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled
pihole -a -i
  [i] Listening only on interface eth0
  [✓] Restarting DNS service

Here is a fresh debug... sigh: 83efiim0a4

If the time is too far off, it will have difficulty syncing to the time servers. Use this command with the appropriate date/time to set the clock to your local time:

timedatectl set-time '2015-11-20 16:14:50'

If you continue to have this problem, you can pick up an inexpensive RTC (real time clock) module that plugs onto the GPIO pins. About $6 or so last time I checked.

What is the output of the following command from the Pi terminal:

journalctl -u lighttpd

Thanks that looks like a cool module, gonna pick one up!

This is the output of that command:

journalctl -u lighttpd
-- Logs begin at Thu 2016-02-11 16:28:00 GMT, end at Sun 2020-05-10 10:25:01 IST. --
Feb 11 16:28:03 pihole systemd[1]: Starting Lighttpd Daemon...
Feb 11 16:28:04 pihole lighttpd[713]: Syntax OK
Feb 11 16:28:04 pihole systemd[1]: Started Lighttpd Daemon.
May 10 01:35:27 pihole sudo[1745]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:35:27 pihole sudo[1745]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:35:27 pihole sudo[1745]: pam_unix(sudo:session): session closed for user root
May 10 01:35:28 pihole sudo[1753]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:35:28 pihole sudo[1753]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:35:28 pihole sudo[1753]: pam_unix(sudo:session): session closed for user root
May 10 01:35:32 pihole sudo[1761]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:35:32 pihole sudo[1761]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:35:32 pihole sudo[1761]: pam_unix(sudo:session): session closed for user root
May 10 01:35:34 pihole sudo[1769]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:35:34 pihole sudo[1769]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:35:34 pihole sudo[1769]: pam_unix(sudo:session): session closed for user root
May 10 01:35:58 pihole sudo[1855]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:35:58 pihole sudo[1855]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:35:58 pihole sudo[1855]: pam_unix(sudo:session): session closed for user root
May 10 01:36:51 pihole sudo[1925]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:36:51 pihole sudo[1925]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:36:51 pihole sudo[1925]: pam_unix(sudo:session): session closed for user root
May 10 01:36:51 pihole sudo[1936]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:36:51 pihole sudo[1936]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:36:52 pihole sudo[1936]: pam_unix(sudo:session): session closed for user root
May 10 01:37:15 pihole sudo[1964]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:37:15 pihole sudo[1964]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:37:15 pihole sudo[1964]: pam_unix(sudo:session): session closed for user root
May 10 01:38:16 pihole sudo[1986]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:38:16 pihole sudo[1986]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:38:16 pihole sudo[1986]: pam_unix(sudo:session): session closed for user root
May 10 01:39:26 pihole sudo[2046]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; C
May 10 01:39:26 pihole sudo[2046]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 10 01:39:26 pihole sudo[2046]: pam_unix(sudo:session): session closed for user root

The funny thing is, I left the Pi last night with time set correctly, and no web access, and now this morning the web interface is accessible. But for how long until it goes down again...

Strange thing is in the above output it shows the lighttpd daemon as starting back when the date was wrong in 2016 lol! Definitely could be the issue but how to fix?

EDIT: again 2 minutes later web access is gone again.

systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-02-11 16:28:04 GMT; 4 years 2 months ago
  Process: 713 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, statu
 Main PID: 771 (lighttpd)

So I restarted the daemon and now it is accessible again with the correct start date. Will see how long it lasts for this time...

sudo service lighttpd restart
root@pihole:/var/log# systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-05-10 10:45:03 IST; 6s ago
  Process: 9944 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, stat
 Main PID: 9955 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           ├─9955 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
           ├─9962 /usr/bin/php-cgi
           ├─9963 /usr/bin/php-cgi
           ├─9964 /usr/bin/php-cgi
           ├─9965 /usr/bin/php-cgi
           └─9966 /usr/bin/php-cgi

May 10 10:45:03 pihole systemd[1]: Starting Lighttpd Daemon...
May 10 10:45:03 pihole lighttpd[9944]: Syntax OK
May 10 10:45:03 pihole systemd[1]: Started Lighttpd Daemon.
lines 1-16/16 (END)

EDIT: 2 minutes or so after I restarted the lighttpd service the web portal its gone yet again took too long to respond. :frowning:

EDIT: After around 10 minutes its back again. It seems to just come and go. I thought maybe it's the switch I have the nanopi connected to thats dodgy, but it cant be as I have my computer on it, and I have an uninterrupted SSH session open to the PI. I am out of ideas on this tbh...

EDIT: Now its back to web portal working, but displaying 'Lost Connection to API'

Final EDIT: Gave up on this. Wiped the SD, fresh installed ubuntu, updated everything, ran the installer from scratch, the one thing I didn't do was assign a static IP as each time I tried that after rebooting I lost access. Everything is working now

Hi again!
I did the same this morning

  • Fresh installation with armbian, after delete partitions and format in NTFS, then Balena Etcher will reformat again with the correct partition format.
  • I Installed piHole and keep it as no change in the configuration.
  • I Updated/Upgraded the OS (Armbian) (sudo apt-get update / upgrade).
  • I changed my router as not DHCP server and acivate piHole as DHCP Server, also changed domain name as my domain name in my home network.

And now is working.

These listed steps are the same steps that I did yesterday moren than 5 times.

"Magic"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.