[SOLVED] FTL says its active, interface says it isnt

What is the output of these commands?

pihole status
pihole status web
pihole status

  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled

pihole status web

1

edit:
new debug token
https://tricorder.pi-hole.net/i0ojggcs98!

What is the output of

sudo -u www-data pihole status
sudo -u www-data pihole status web

couldnt find out what the www-data user password was, tried everything so i just changed it. (i hope thats alright)

anyway i think you are on to something!

sudo -u www-data pihole status
Sorry, user www-data is not allowed to execute '/bin/bash /usr/local/bin/pihole status' as root on odroid.


sudo -u www-data pihole status web
Sorry, user www-data is not allowed to execute '/bin/bash /usr/local/bin/pihole status web' as root on odroid.

edit:
/etc/sudoers file

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sb
in:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d


Also check for a Pi-hole specific sudoers file (/etc/sudoers.d/pihole), see this line as reference:

thanks, was kinda lost, the script helped it.

ls /etc/sudoers.d/
pihole  README

sudo cat /etc/sudoers.d/pihole

# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Allows the WebUI to use Pi-hole commands
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
#
www-data ALL=NOPASSWD: /usr/local/bin/pihole


edit: hmmm?, aw ok, just saw the chmod 0440


ls -l /etc/sudoers.d/pihole

-r--r----- 1 root root 367 Apr 13 01:51 /etc/sudoers.d/pihole

edit edit!
just taking a guess here.

but it seems the defaults secure_path IF, didnt worked.

# If the Web server user is lighttpd,
if [[ "$LIGHTTPD_USER" == "lighttpd" ]]; then
    # Allow executing pihole via sudo with Fedora
    # Usually /usr/local/bin is not permitted as directory for sudoable programs
    echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin" >> /etc/sudoers.d/pihole
fi

as i said just a guess, i know i'm using lighttpd, as i said before, this is an fresh odroid-minimal-ubuntu install and i did the pihole install "by the book", so theres no reasoning for not be using lightppd.

EDIT EDIT EDIT!!!
never mind, after reading the full script, i see what the IF is there for.

I'm not exactly sure what is happening then. You have the file and it looks okay, still, your sudo is complaining that you cannot execute the command.

Maybe the content of your /etc/sudoers.d is not sourced somewhere?...

What is the output of this command? This will show if the web server is executing the status command successfully.

journalctl -u lighttpd
journalctl -u lighttpd

Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
-- Logs begin at Fri 2019-04-12 23:50:00 UTC, end at Sun 2019-04-14 21:04:21 UTC.
-- No entries --

sudo systemctl status lighttpd

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: e
   Active: active (running) since Sun 2019-04-14 18:20:43 UTC; 2h 45min ago
  Process: 508 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
 Main PID: 533 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           ├─533 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
           ├─548 /usr/bin/php-cgi
           ├─556 /usr/bin/php-cgi
           ├─557 /usr/bin/php-cgi
           ├─558 /usr/bin/php-cgi
           └─559 /usr/bin/php-cgi

Apr 14 18:20:43 nether systemd[1]: Started Lighttpd Daemon.
Apr 14 18:25:58 nether sudo[642]: www-data : TTY=unknown ; PWD=/var/www/html/admin
Apr 14 18:25:58 nether sudo[642]: pam_unix(sudo:session): session opened for user
Apr 14 18:25:58 nether sudo[642]: pam_unix(sudo:session): session closed for user
Apr 14 19:11:38 nether sudo[4224]: www-data : unable to resolve host nether
Apr 14 19:11:38 nether sudo[4224]: www-data : problem with defaults entries ; TTY=
Apr 14 19:11:38 nether lighttpd[533]: sudo: unable to resolve host nether
Apr 14 19:11:38 nether sudo[4224]: www-data : TTY=unknown ; PWD=/var/www/html/admi
Apr 14 19:11:38 nether sudo[4224]: pam_unix(sudo:session): session opened for user
Apr 14 19:11:38 nether sudo[4224]: pam_unix(sudo:session): session closed for user

journalctl --user -u lighttpd
-- Logs begin at Fri 2019-04-12 23:50:00 UTC, end at Sun 2019-04-14 21:04:21 UTC.
-- No entries --

ok now i'm rly lost...

What is the output of sudo journalctl -u lighttpd?

oh lol, my bad.

it was rather big, so i piped it to 0x0.st (hopes thats ok)

https://0x0.st/zNOf.txt

relevant info after the last reboot here anyway:

Apr 14 18:20:43 nether systemd[1]: Starting Lighttpd Daemon...
Apr 14 18:20:43 nether systemd[1]: Started Lighttpd Daemon.
Apr 14 18:25:58 nether sudo[642]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 18:25:58 nether sudo[642]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 18:25:58 nether sudo[642]: pam_unix(sudo:session): session closed for user root
Apr 14 19:11:38 nether sudo[4224]: www-data : unable to resolve host nether
Apr 14 19:11:38 nether sudo[4224]: www-data : problem with defaults entries ; TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;
Apr 14 19:11:38 nether lighttpd[533]: sudo: unable to resolve host nether
Apr 14 19:11:38 nether sudo[4224]: www-data : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Apr 14 19:11:38 nether sudo[4224]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 14 19:11:38 nether sudo[4224]: pam_unix(sudo:session): session closed for user root
Apr 14 19:11:38 nether lighttpd[533]: sudo: unable to resolve host nether

probly because i changed the hostname from odroid --> nether , just today

EDIT RELEVANT PLEASE READ
so i went ahead and asked for help too in the odroid forums.
https://forum.odroid.com/viewtopic.php?f=95&t=34558

here one answer:

your /etc/sudoers.d/pihole file allows www-data to run a command with root permissions without asking for a password.

Normally www-data does not have root permission, means it can't run any application that requires root.
But with that file, it allows www-data to run one single command to run with sudo commad "/usr/local/bin/pihole"

So you're command would actually have to look like this: 
sudo -u www-data sudo pihole status

Which is quite hilarious considering that you ARE root, make yourself to "www-data" and then run a command as "root" :D

Simply running pihole status should work if you are connected as root via ssh.

btw: pihole was probably made with Debian in mind instead of Ubuntu and it might run better if you actually install it on a Debian instead of Ubuntu.

so, doing the command:

sudo -u www-data sudo pihole status

sudo: unable to resolve host nether
sudo: unable to resolve host nether
  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled

 sudo -u www-data sudo pihole status web

sudo: unable to resolve host nether
sudo: unable to resolve host nether
1

edit edit:

as far as the nether thing goes, found the problem!
i forgot to edit /etc/hosts
the /etc/host 127.0.0.1 was poiting to odroid.
fixed, rebooting the thing now

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. :frowning:

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