@storms posted a new topic, subject "[SOLVED] FTL says its active, interface says it isnt". It read:

   Hey guys!
    
    ## Expected Behaviour:
    
    Green light on the pihole web interface.
    
    ## Actual Behaviour:
    
    Red light on the pihole web interface.
    
    ## Debug Token:
    
    https://tricorder.pi-hole.net/xvvcq8us3w!
    [code] 
        uname -a 
        Linux odroid 4.14.107-157 #1 SMP PREEMPT Thu Mar 21 09:59:50 -03 2019 armv7l armv7l armv7l GNU/Linux
        
        its the ARM Ubuntu minimal version for ODROID (please dont shoot me)
        
    [/code]
    [code] 
        systemctl status pihole-FTL
        
        ● pihole-FTL.service - LSB: pihole-FTL daemon
           Loaded: loaded (/etc/init.d/pihole-FTL; generated)
           Active: active (exited) since Sat 2019-04-13 01:51:45 UTC; 13min ago
             Docs: man:systemd-sysv-generator(8)
          Process: 3623 ExecStop=/etc/init.d/pihole-FTL stop (code=exited, status=0/SUCCESS)
          Process: 3658 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)
        
          Apr 13 01:51:44 odroid systemd[1]: Starting LSB: pihole-FTL daemon...
          Apr 13 01:51:44 odroid pihole-FTL[3658]: Not running
          Apr 13 01:51:45 odroid su[3700]: Successful su for pihole by root
          Apr 13 01:51:45 odroid su[3700]: + ??? root:pihole
          Apr 13 01:51:45 odroid su[3700]: pam_unix(su:session): session opened for user pihole by   (uid=0)
          Apr 13 01:51:45 odroid pihole-FTL[3658]: FTL started!
          Apr 13 01:51:45 odroid su[3700]: pam_unix(su:session): session closed for user pihole
          Apr 13 01:51:45 odroid systemd[1]: Started LSB: pihole-FTL daemon.
        
        
    [/code]
    [code] 
        sudo lsof -i -n -P
        
        COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
        dhcpcd     531     root   11u  IPv4  15782      0t0  UDP *:68
        sshd       558     root    3u  IPv4    847      0t0  TCP *:9512 (LISTEN)
        sshd       558     root    4u  IPv6    849      0t0  TCP *:9512 (LISTEN)
        lighttpd  3475 www-data    4u  IPv4  37616      0t0  TCP *:80 (LISTEN)
        lighttpd  3475 www-data    5u  IPv6  37617      0t0  TCP *:80 (LISTEN)
        lighttpd  3475 www-data   11u  IPv4  45804      0t0  TCP (443)288-7091:80->(443)288-7091:44812 (ESTABLISHED)
        pihole-FT 3716   pihole    4u  IPv4  39949      0t0  UDP *:67
        pihole-FT 3716   pihole    6u  IPv4  39952      0t0  UDP (443)288-7091:53
        pihole-FT 3716   pihole    7u  IPv4  39953      0t0  TCP (443)288-7091:53 (LISTEN)
        pihole-FT 3716   pihole    8u  IPv4  39954      0t0  UDP (443)288-7091:53
        pihole-FT 3716   pihole    9u  IPv4  39955      0t0  TCP (443)288-7091:53 (LISTEN)
        pihole-FT 3716   pihole   10u  IPv6  39956      0t0  UDP [8b7c:f320:99b9:690f:4595:cd17:293a:c06921e:6ff:fe36:38b3]:53
        pihole-FT 3716   pihole   11u  IPv6  39957      0t0  TCP [8b7c:f320:99b9:690f:4595:cd17:293a:c06921e:6ff:fe36:38b3]:53 (LISTEN)
        pihole-FT 3716   pihole   12u  IPv6  39958      0t0  UDP [8b7c:f320:99b9:690f:4595:cd17:293a:c069]:53
        pihole-FT 3716   pihole   13u  IPv6  39959      0t0  TCP [8b7c:f320:99b9:690f:4595:cd17:293a:c069]:53 (LISTEN)
        pihole-FT 3716   pihole   16u  IPv4  26803      0t0  TCP (443)288-7091:4711 (LISTEN)
        pihole-FT 3716   pihole   17u  IPv6  26805      0t0  TCP [8b7c:f320:99b9:690f:4595:cd17:293a:c069]:4711 (LISTEN)
        sshd      4610     root    3u  IPv4  43147      0t0  TCP (443)288-7091:9512->(443)288-7091:42142 (ESTABLISHED)
        sshd      4656    cunha    3u  IPv4  43147      0t0  TCP (443)288-7091:9512->(443)288-7091:42142 (ESTABLISHED)
        
        
    [/code]
    [code] 
        sudo systemctl status ufw
        
        ● ufw.service - Uncomplicated firewall
           Loaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)
           Active: inactive (dead)
             Docs: man:ufw(8)
        
        
    [/code]
    
    also i know i have to portfoward  
    TCP 53 --> any  
    UDP 53 --> any  
    but do i need to:  
    TCP 4711 --> any  
    UDP 4711 --> any  
    this part is answered i was fording on the WAN router, already disabled that stuff.
    
    thanks!

To which @jfb replied

    Your debug log shows that pihole-FTL is running and DNS queries are properly processed:
    [code] 
        *** [ DIAGNOSING ]: Ports in use
        ....
        (443)288-7091:53] is in use by pihole-FTL
        (443)288-7091:53] is in use by pihole-FTL
        [[8b7c:f320:99b9:690f:4595:cd17:293a:c06921e:6ff:fe36:38b3]:53] is in use by pihole-FTL
        [[8b7c:f320:99b9:690f:4595:cd17:293a:c069]:53] is in use by pihole-FTL
        (443)288-7091:4711] is in use by pihole-FTL
        [[8b7c:f320:99b9:690f:4595:cd17:293a:c069]:4711] is in use by pihole-FTL
        
        *** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
        [âœ“] www.eboatstampa.com is (443)288-7091 via localhost (443)288-7091)
        [âœ“] www.eboatstampa.com is (443)288-7091 via Pi-hole (443)288-7091)
        [âœ“] doubleclick.com is (443)288-7091 via a remote, public DNS server (443)288-7091)
        
    [/code]
    
    storms:
    
    > Red light on the pihole web interface.
    
    What word appears to the right of the light - active?

After which, @storms added

    Hello!  
    thank you for the extremely quick reply! that has to be a record!
    
    web interface:  
    FTL offline
    
    but since the logs says its working i dont rly mind the red thing.  
    was just scratching my head for 1 hours trying to fix it.
    
    already did a bunch of googling and:  
    pihole -r

To which @jfb replied

    Perhaps one of the developers will have some thoughts.

So @jfb replied

    storms:
    
    > also i know i have to portfoward
    
    Where are you forwarding these ports? Internally or out to the WAN?

After which, @storms added

    WAN, on the ISP router page.
    
    right now the odroid has everything open (ufw disabled), its kinda of a fresh install, only thing i did was secure sshd, get the keys in, **TCP hardening (maybe the problem?)** , and fail2ban
    [code] 
        TCP HARDENING
        on /etc/sysctl.d/50-ip-sec.conf
        
        # Disable Source Routing
        net.ipv4.conf.all.accept_source_route = 0
        net.ipv6.conf.all.accept_source_route = 0 
        net.ipv4.conf.default.accept_source_route = 0
        net.ipv6.conf.default.accept_source_route = 0
        
        # Disable acceptance of all ICMP redirected packets on all interfaces
        net.ipv4.conf.all.accept_redirects = 0
        net.ipv6.conf.all.accept_redirects = 0
        net.ipv4.conf.default.accept_redirects = 0 
        net.ipv6.conf.default.accept_redirects = 0
        
        # Disable send IPv4 redirect packets
        net.ipv4.conf.all.send_redirects = 0
        net.ipv4.conf.default.send_redirects = 0
        
        # Set Reverse Path Forwarding to strict mode as defined in RFC 3704
        net.ipv4.conf.all.rp_filter = 1
        net.ipv4.conf.default.rp_filter = 1
        
        # Ignore ICMP broadcast requests
        net.ipv4.icmp_echo_ignore_broadcasts = 1
        
        # Block pings
        net.ipv4.icmp_echo_ignore_all = 1
        
        # Syn flood help
        net.ipv4.tcp_syncookies = 1
        net.ipv4.tcp_max_syn_backlog = 2048
        net.ipv4.tcp_synack_retries = 2
        net.ipv4.tcp_syn_retries = 5
        
        # Log suspicious martian packets
        net.ipv4.conf.all.log_martians = 1
        net.ipv4.conf.default.log_martians=1
        net.ipv4.icmp_ignore_bogus_error_responses = 1
        
        # Disable IPv6 auto config
        net.ipv6.conf.default.accept_ra=0
        net.ipv6.conf.default.autoconf=0
        net.ipv6.conf.all.accept_ra=0
        net.ipv6.conf.all.autoconf=0
        net.ipv6.conf.eth0.accept_ra=0
        net.ipv6.conf.eth0.autoconf=0
        
    [/code]

Then @jfb said

    Why are your forwarding port 53 traffic to WAN? That is not required (nor desired) for Pi-Hole to operate. You are setting yourself up for problems here.

After which, @storms added

    oh thanks! thought i had to do it in order for the pihole to be able to query... i'm not that smart when it comes to portforwaring.  
    thanks for the tip!
    
    totally my fault, i should read up on it and stop winging it as i go

So @jfb replied

    With a Pi-Hole installed on a device in your network only the ports on the Pi-Hole host need to be open to your LAN. That is handled with the Pi-Hole installer. You don't need (nor want) to open any ports on your router for Pi-Hole to work properly. Opening ports can cause a host of problems, most commonly an open resolver that will quickly be found on the internet and put to no good use.
    
    Pi-Hole gets its DNS queries from clients on the LAN, and you want to block all traffic from the WAN.

@Mcat12 (Mcat12) replied

    What is the output of these commands?
    [code] 
        pihole status
        pihole status web
        
    [/code]

To which @storms replied

    [code]
        pihole status
        
          [✓] DNS service is running
          [✓] Pi-hole blocking is Enabled
        
        
    [/code]
    [code] 
        pihole status web
        
        1
        
    [/code]
    
    edit:  
    new debug token  
    https://tricorder.pi-hole.net/i0ojggcs98!

After which, @DL6ER added

    What is the output of
    [code] 
        sudo -u www-data pihole status
        sudo -u www-data pihole status web
        
    [/code]

After which, @storms added

    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!
    [code] 
        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.
        
        
    [/code]
    
    edit:  
    /etc/sudoers file
    [code] 
        #
        # 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
        
        
        
    [/code]

After which, @DL6ER added

    Also check for a Pi-hole specific `sudoers` file (`/etc/sudoers.d/pihole`), see this line as reference:
    
    github.com
    
    #### pi-hole/pi-hole/blob/master/automated install/basic-install.sh#L1674
    [code]     
          1664.     local str="Update local cache of available packages"
          1665.     printf "  %b %s..." "${INFO}" "${str}"
          1666.     # Create a command from the package cache variable
          1667.     if eval "${UPDATE_PKG_CACHE}" &> /dev/null; then
          1668.         printf "%b  %b %s\\n" "${OVER}" "${TICK}" "${str}"
          1669.     # Otherwise,
          1670.     else
          1671.         # show an error and exit
          1672.         printf "%b  %b %s\\n" "${OVER}" "${CROSS}" "${str}"
          1673.         printf "  %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "${UPDATE_PKG_CACHE}" "${COL_NC}"
          1674.         return 1
          1675.     fi
          1676. }
          1677.   1678. # Let user know if they have outdated packages on their system and
          1679. # advise them to run a package update at soonest possible.
          1680. notify_package_updates_available() {
          1681.     # Local, named variables
          1682.     local str="Checking ${PKG_MANAGER} for upgraded packages"
          1683.     printf "\\n  %b %s..." "${INFO}" "${str}"
          1684.     # Store the list of packages in a variable
        
        
        
    [/code]

Then @storms said

    thanks, was kinda lost, the script helped it.
    [code] 
        ls /etc/sudoers.d/
        pihole  README
        
        
    [/code]
    [code] 
        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
        
        
        
    [/code]
    
    edit: hmmm?, aw ok, just saw the chmod 0440
    [code] 
        ls -l /etc/sudoers.d/pihole
        
        -r--r----- 1 root root 367 Apr 13 01:51 /etc/sudoers.d/pihole
        
        
    [/code]
    
    edit edit!  
    just taking a guess here.
    
    but it seems the defaults secure_path IF, didnt worked.
    [code] 
        # 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
        
    [/code]
    
    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.

To which @DL6ER replied

    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.
    
    storms:
    
    > 
    [code]
    >     Sorry, user www-data is not allowed to execute '/bin/bash /usr/local/bin/pihole status' as root on odroid.
    >     
    [/code]
    
    Maybe the content of your `/etc/sudoers.d` is not sourced somewhere?...

To which @Mcat12 (Mcat12) replied

    What is the output of this command? This will show if the web server is executing the status command successfully.
    [code] 
        journalctl -u lighttpd
        
    [/code]

After which, @storms added

    Mcat12:
    
    > journalctl -u lighttpd
    [code] 
        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 --
        
        
    [/code]
    [code] 
        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
        
        
    [/code]
    [code] 
        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 --
        
        
    [/code]
    
    ok now i'm rly lost...

After which, @Mcat12 (Mcat12) added

    What is the output of `sudo journalctl -u lighttpd`?

So @storms replied

    Mcat12:
    
    > 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:
    [code] 
        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
        
    [/code]
    [code] 
        Apr 14 19:11:38 nether lighttpd[533]: sudo: unable to resolve host nether
        
    [/code]
    
    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:
    [code] 
        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.
        
    [/code]
    
    so, doing the command:
    [code] 
        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
        
        
    [/code]
    [code] 
         sudo -u www-data sudo pihole status web
        
        sudo: unable to resolve host nether
        sudo: unable to resolve host nether
        1
        
        
    [/code]
    
    edit edit:
    
    as far as the nether thing goes, found the problem!  
    i forgot to edit /etc/hosts  
    the /etc/host (443)288-7091 was poiting to odroid.  
    fixed, rebooting the thing now

So @Mcat12 (Mcat12) replied

    That extra output is causing the issue, as the web interface only expects a number to be returned.

To which @storms replied

    what extra output? i fixed the hosts. heres the commands now:
    [code] 
        sudo -u www-data sudo pihole status web
        1
        
        
    [/code]
    [code] 
        sudo -u www-data sudo pihole status
          [✓] DNS service is running
          [✓] Pi-hole blocking is Enabled
        
        
    [/code]
    
    web interface:  
    FTL offline

So @Mcat12 (Mcat12) replied

    The extra output you mentioned:
    [code] 
        sudo: unable to resolve host nether
        sudo: unable to resolve host nether
        
    [/code]

@storms replied

    storms:
    
    > sudo journalctl -u lighttpd
    
    the new log doesnt have that. 
    [code] 
        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)
        
        
    [/code]

Then @Mcat12 (Mcat12) said

    The web interface simply calls that command and checks the output, so it must not be getting the expected output:
    
    github.com
    
    #### pi-hole/AdminLTE/blob/79c7c893acfbf0e35308d116655503b6780fe2c1/scripts/pi-hole/php/header.php#L326
    [code]     
          316. <!-- sidebar: style can be found in sidebar.less -->
          317. <section class="sidebar">
          318.     <!-- Sidebar user panel -->
          319.     <div class="user-panel">
          320.         <div class="pull-left image">
          321.             <img src="img/logo.svg" class="img-responsive" alt="Pi-hole logo" style="display: table; table-layout: fixed; height: 67px;" />
          322.         </div>
          323.         <div class="pull-left info">
          324.             <p>Status</p>
          325.                 <?php
          326.                 $pistatus = exec('sudo pihole status web');
          327.                 if ($pistatus == "1") {
          328.                     echo '<a id="status"><i class="fa fa-circle" style="color:#7FFF00"></i> Active</a>';
          329.                 } elseif ($pistatus == "0") {
          330.                     echo '<a id="status"><i class="fa fa-circle" style="color:#FF0000"></i> Offline</a>';
          331.                 } elseif ($pistatus == "-1") {
          332.                     echo '<a id="status"><i class="fa fa-circle" style="color:#FF0000"></i> DNS service not running</a>';
          333.                 } else {
          334.                     echo '<a id="status"><i class="fa fa-circle" style="color:#ff9900"></i> Unknown</a>';
          335.                 }
          336. 
        
        
    [/code]

To which @storms replied

    weird...really weird.
    [code] 
        sudo pihole status web
        1
        
    [/code]
    
    but as other people pointed out, if it working i dont really mind the red light, just thought it wasnt working.

Then @Mcat12 (Mcat12) said

    Have you tried restarting lighttpd? `sudo service lighttpd restart`

To which @storms replied

    Mcat12:
    
    > sudo service lighttpd restart
    
    just did it. no errors.
    [code] 
        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.
        
    [/code]
    
    still red.

After which, @Mcat12 (Mcat12) added

    You could theoretically try inserting `var_dump($pistatus);` after the line I linked in `/var/www/html/admin/scripts/pi-hole/php/header.php`

So @Mcat12 (Mcat12) replied

    That will print the variable's info to to the response, which should be shown in the dashboard

After which, @storms added

    Mcat12:
    
    > var_dump($pistatus);
    [code] 
         $pistatus = exec('sudo pihole status web'); var_du
        mp($pistatus);
        
        
    [/code]
    
    web interface:  
    string(1) "1" Active FTL offlin  
    the left bar isnt big enought to display everything.  
    but that does the trick!
    
    pic-full-190414-2239-231366×768 180 KB

@Mcat12 (Mcat12) replied

    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:
    [code] 
        if ($pistatus == "1") {
        
    [/code]
    
    to be
    [code] 
        if ($pistatus === "1") {
        
    [/code]
    
    Does anything change?

To which @Mcat12 (Mcat12) replied

    What's the output of these commands?
    [code] 
        pidof pihole-FTL
        sudo -u www-data pidof pihole-FTL
        
    [/code]

Then @storms said

    Mcat12:
    
    > sudo -u www-data pidof pihole-FTL
    
    ok, lets go one by one
    
    reverthing the php settings to the pihole defaults
    [code] 
         $pistatus = exec('sudo pihole status web');
        
    [/code]
    
    pic-full-190414-2245-301366×768 195 KB
    
    changing to
    [code] 
        if ($pistatus === "1") {
        
    [/code]
    
    nothing changed on the webinterface.
    
    adding
    [code] 
        $pistatus = exec('sudo pihole status web'); var_du
        mp($pistatus);
        **WITH**
        
    [/code]
    
    if ($pistatus === "1") {
    [/code]
    [code] 
    it broke the website
    
    pic-full-190414-2247-561366×768 11.7 KB
    
    reverthing back to factory default.
    [code] 
        pidof pihole-FTL
        
        (nothing, no output)
        
    [/code]
    [code] 
        sudo -u www-data pidof pihole-FTL
        
        (nothing, no output)
        
    [/code]
    
    trying that sudo trick again:
    [code] 
        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.
        
        
    [/code]

@Mcat12 (Mcat12) replied

    So the status issue is fixed, now there's just the issue of not getting FTL's PID. Make a new debug token.

Then @storms said

    should i stick with the
    [code] 
        $pistatus = exec('sudo pihole status web'); var_du
        mp($pistatus);
        
    [/code]
    
    for the debug token?
    
    probly doesnt matter either way!  
    here:
    
    https://tricorder.pi-hole.net/ho1e5b7y7h!

After which, @Mcat12 (Mcat12) added

    You can remove the `var_dump` statement now that we know the general status is working.
    
    What is the output of these commands?
    [code] 
        sudo service pihole-FTL restart
        # Wait for a few seconds
        cat /var/run/pihole-FTL.pid
        pidof pihole-FTL
        pidof /usr/bin/pihole-FTL
        
    [/code]

So @storms replied

    Mcat12:
    
    > pidof /usr/bin/pihole-FTL
    [code] 
        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:~$
        
        
    [/code]
    
    starting to think its a pidof problem.  
    it doesnt give any output no matter what i give it
    [code] 
        cunha@nether:~$ pidof /lib/systemd/systemd-networkd
        (nothing)
        cunha@nether:~$ pidof /lib/systemd/systemd-journald
        (nothing)
        
    [/code]

@Mcat12 (Mcat12) replied

    What is the output of this command?
    [code] 
        ps -ef | grep pihole
        
    [/code]

So @storms replied

    [code]
        ps -ef | grep pihole
        
        cunha     5455  5217  0 22:05 pts/0    00:00:00 grep --color=auto pihole
        
        
    [/code]

Then @Mcat12 (Mcat12) said

    Try with `sudo`?

@storms replied

    oh...LOL my bad  
    here we go!
    [code] 
        cunha@nether:~$ sudo pidof pihole-FTL
        5432
        
        cunha@nether:~$ sudo pidof /usr/bin/pihole-FTL
        5432
        
        
    [/code]

Then @Mcat12 (Mcat12) said

    Perhaps your operating system is preventing regular users from seeing other processes.

@storms replied

    hmmm...possible!  
    i would need to take some time to investigate the problem.  
    as i said, its simple minimal ubuntu with no major changes. ( aside i had to download the arm image from the odroid website, since the arm image form the ubuntu website doesnt boot)  
    so i find it weird not working.

So @Mcat12 (Mcat12) replied

    It might be an ODROID thing. Try installing on a different system, like a Ubuntu VM, and see if it has the same issue.

@storms replied

    ok thanks to irc, i found the problem
    
    on fstab i was hiding the pid on /proc. (the fact that i did not remembered this was some next level retardeness from me, really sorry for wasting everybody's time!)  
    removed it, now its all dandy! <3 much love boys and thank you SO much for wasting all this time with me
    
    setting in question
    [code] 
        proc     /proc     proc     defaults,hidepid=2     0     0
        
    [/code]

To which @system (system) replied

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


{'source': 'discourse', 'url': 'https://discourse.pi-hole.net/t/solved-ftl-says-its-active-interface-says-it-isnt/19126', 'title': '[SOLVED] FTL says its active, interface says it isnt', 'views': 4471, 'has_accepted_answer': True, 'word_count': 4166, 'like_count': 0, 'reply_count': 37, 'participant_count': 4, 'posts': 47, 'tags': '', 'author': '@storms', 'participants': '@storms, @jfb, @Mcat12 (Mcat12), @DL6ER, @system (system)', 'image_url': [None], 'created_at': '2019-04-13T02:09:30.821Z', 'last_posted_at': '2019-05-06T18:10:18.537Z'}