That extra output is causing the issue, as the web interface only expects a number to be returned.
what extra output? i fixed the hosts. heres the commands now:
sudo -u www-data sudo pihole status web
1
sudo -u www-data sudo pihole status
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled
web interface:
FTL offline
The extra output you mentioned:
sudo: unable to resolve host nether
sudo: unable to resolve host nether
the new log doesnt have that.
sudo journalctl -u lighttpd
-- Reboot --
Apr 14 21:25:14 nether systemd[1]: Starting Lighttpd Daemon...
Apr 14 21:25:14 nether systemd[1]: Started Lighttpd Daemon.
Apr 14 21:26:48 nether sudo[781]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:26:48 nether sudo[781]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:26:48 nether sudo[781]: pam_unix(sudo:session): session closed for user root
Apr 14 21:26:54 nether sudo[803]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:26:54 nether sudo[803]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:26:54 nether sudo[803]: pam_unix(sudo:session): session closed for user root
Apr 14 21:27:56 nether sudo[903]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:27:56 nether sudo[903]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:27:56 nether sudo[903]: pam_unix(sudo:session): session closed for user root
Apr 14 21:28:32 nether sudo[962]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:28:32 nether sudo[962]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:28:32 nether sudo[962]: pam_unix(sudo:session): session closed for user root
Apr 14 21:28:33 nether sudo[980]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:28:33 nether sudo[980]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:28:34 nether sudo[980]: pam_unix(sudo:session): session closed for user root
Apr 14 21:29:08 nether sudo[1036]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 21:29:08 nether sudo[1036]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 21:29:08 nether sudo[1036]: pam_unix(sudo:session): session closed for user root
lines 626-663/663 (END)
The web interface simply calls that command and checks the output, so it must not be getting the expected output:
weird...really weird.
sudo pihole status web
1
but as other people pointed out, if it working i dont really mind the red light, just thought it wasnt working.
Have you tried restarting lighttpd? sudo service lighttpd restart
just did it. no errors.
cunha@nether:~$ sudo service lighttpd status
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-04-14 21:33:58 UTC; 4s ago
Process: 1432 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
Main PID: 1442 (lighttpd)
CGroup: /system.slice/lighttpd.service
├─1442 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
├─1452 /usr/bin/php-cgi
├─1453 /usr/bin/php-cgi
├─1454 /usr/bin/php-cgi
├─1455 /usr/bin/php-cgi
└─1456 /usr/bin/php-cgi
Apr 14 21:33:58 nether systemd[1]: Starting Lighttpd Daemon...
Apr 14 21:33:58 nether systemd[1]: Started Lighttpd Daemon.
still red.
You could theoretically try inserting var_dump($pistatus);
after the line I linked in /var/www/html/admin/scripts/pi-hole/php/header.php
That will print the variable's info to to the response, which should be shown in the dashboard
$pistatus = exec('sudo pihole status web'); var_du
mp($pistatus);
web interface:
string(1) "1" Active FTL offlin
the left bar isnt big enought to display everything.
but that does the trick!
EDIT: Just adding var_dump
should not have changed the status. Are you sure it was not Active
before that change?
If you edit this line:
if ($pistatus == "1") {
to be
if ($pistatus === "1") {
Does anything change?
What's the output of these commands?
pidof pihole-FTL
sudo -u www-data pidof pihole-FTL
ok, lets go one by one
reverthing the php settings to the pihole defaults
$pistatus = exec('sudo pihole status web');
changing to
if ($pistatus === "1") {
nothing changed on the webinterface.
adding
$pistatus = exec('sudo pihole status web'); var_du
mp($pistatus);
**WITH**
if ($pistatus === "1") {
it broke the website
reverthing back to factory default.
pidof pihole-FTL
(nothing, no output)
sudo -u www-data pidof pihole-FTL
(nothing, no output)
trying that sudo trick again:
sudo -u www-data sudo pidof pihole-FTL
[sudo] password for www-data:
Sorry, user www-data is not allowed to execute '/bin/pidof pihole-FTL' as root on
nether.
So the status issue is fixed, now there's just the issue of not getting FTL's PID. Make a new debug token.
should i stick with the
$pistatus = exec('sudo pihole status web'); var_du
mp($pistatus);
for the debug token?
probly doesnt matter either way!
here:
You can remove the var_dump
statement now that we know the general status is working.
What is the output of these commands?
sudo service pihole-FTL restart
# Wait for a few seconds
cat /var/run/pihole-FTL.pid
pidof pihole-FTL
pidof /usr/bin/pihole-FTL
cunha@nether:~$ sudo service pihole-FTL restart
cunha@nether:~$ cat /var/run/pihole-FTL.pid
5432
cunha@nether:~$ pidof pihole-FTL
(no output)
cunha@nether:~$ pidof /usr/bin/pihole-FTL
(no output)
cunha@nether:~$
starting to think its a pidof problem.
it doesnt give any output no matter what i give it
cunha@nether:~$ pidof /lib/systemd/systemd-networkd
(nothing)
cunha@nether:~$ pidof /lib/systemd/systemd-journald
(nothing)
What is the output of this command?
ps -ef | grep pihole
ps -ef | grep pihole
cunha 5455 5217 0 22:05 pts/0 00:00:00 grep --color=auto pihole