PiHole-FTL Lost Connection to API

I recently updated PiHole and ever since then the web interface reports FTL is offline. I get lost connection to API across the top where the graphs are. I've tried uninstalling, reinstalling, switching over to the dev channel. I found a few commands to run after the uninstall. Any help would be greatly appreciated.

Run pihole -d for a debug token.

A post was split to a new topic: FTL offline now and then

You can also run sudo service pihole-FTL restart

2 Likes

Here is my token: ohetdnzvpa

What's the output of these commands?

sudo service lighttpd status
sudo service dnsmasq status
sudo service pihole-FTL status

[dave@barracuda ~]$ sudo service lighttpd status
Redirecting to /bin/systemctl status lighttpd.service
● lighttpd.service - Lightning Fast Webserver With Light System Requirements
Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2017-05-18 17:48:19 CDT; 13h ago
Main PID: 8877 (lighttpd)
CGroup: /system.slice/lighttpd.service
├─ 8877 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
├─ 8881 /usr/bin/php-cgi
├─ 8886 /usr/bin/php-cgi
├─ 8911 /usr/bin/php-cgi
├─ 8912 /usr/bin/php-cgi
├─ 8913 /usr/bin/php-cgi
├─ 8914 /usr/bin/php-cgi
├─ 8915 /usr/bin/php-cgi
└─29799 /usr/bin/php-cgi

May 18 17:48:19 barracuda systemd[1]: Started Lightning Fast Webserver With Light System Requirements.
May 18 17:48:19 barracuda systemd[1]: Starting Lightning Fast Webserver With Light System Requirements...
May 18 17:48:30 barracuda sudo[9251]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:48:31 barracuda sudo[9273]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:48:39 barracuda sudo[9298]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:48:42 barracuda sudo[9320]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:48:44 barracuda sudo[9336]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:48:50 barracuda sudo[9358]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:51:14 barracuda sudo[9390]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
May 18 17:51:16 barracuda sudo[9406]: lighttpd : TTY=unknown ; PWD=/var/www/html/admin ; USER=root ;... web
Hint: Some lines were ellipsized, use -l to show in full.
[dave@barracuda ~]$ sudo service dnsmasq status
Redirecting to /bin/systemctl status dnsmasq.service
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2017-05-18 17:48:25 CDT; 13h ago
Main PID: 9188 (dnsmasq)
CGroup: /system.slice/dnsmasq.service
└─9188 /usr/sbin/dnsmasq -k

May 18 17:48:25 barracuda systemd[1]: Started DNS caching server..
May 18 17:48:25 barracuda systemd[1]: Starting DNS caching server....
[dave@barracuda ~]$ sudo service pihole-FTL status
/etc/init.d/pihole-FTL: line 69: status: command not found

A post was split to a new topic: Unknown job: pihole-FTL

Now there are already three different people with issues with are not the same at first glance. I'll split them in different topics in order to ensure that we are able to help anyone of you best.

I see from your debug log that your system it running on CentOS Linux 7 (Core) which is a system we officially support. Apparently, you found some CentOS speciality I have not encountered during testing. A quick searching through the web found several similar issues with other software. You can play e.g. with this here:

Let us know if it helps for your issue and we will incorporate it for the next release!

2 posts were split to a new topic: Pihole-FTL receiving SIGTERM

Here is my startup script for pihole-FTL. I'm confused on where I should add the RETVAL=0. I tried a few places but I still get /etc/init.d/pihole-FTL: line 68: status: command not found. Any help would be greatly appreciated. Thanks!

#!/bin/bash
### BEGIN INIT INFO
# Provides:          pihole-FTL
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: pihole-FTL daemon
# Description:       Enable service provided by pihole-FTL daemon
### END INIT INFO
FTLUSER=pihole
PIDFILE=/var/run/pihole-FTL.pid
get_pid() {
    pidof "pihole-FTL"
}
is_running() {
    ps "$(get_pid)" > /dev/null 2>&1
}
# Start the service
start() {
  if is_running; then
    echo "pihole-FTL is already running"
  else
    touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
    chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
    chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
    su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
    echo
  fi
}
# Stop the service
stop() {
  if is_running; then
    kill "$(get_pid)"
    for i in {1..5}; do
      if ! is_running; then
        break
      fi
      echo -n "."
      sleep 1
    done
    echo
    if is_running; then
      echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
      kill -9 "$(get_pid)"
      exit 1
    else
      echo "Stopped"
    fi
  else
    echo "Not running"
  fi
  echo
}
### main logic ###
case "$1" in
  stop)
        stop
        ;;
  status)
	status pihole-FTL
	;;
  start|restart|reload|condrestart)
        stop
        start
	;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0

Had same issue on ubuntu.

Had = you solved it? If, how? If not, please provide further information - preferably in a separate topic, so we can keep the threads nice and clean.

I was thinking that you might want to try something like this:

Add

. /etc/init.d/functions
RETVAL=0

in between

### END INIT INFO

and

FTLUSER=pihole

I installed CentOS + Pi-hole on one of my testing systems and have been able to reproduce your particular issue:

[root@vultr ~]# service pihole-FTL status
/etc/init.d/pihole-FTL: line 69: status: command not found

after adding the lines I suggested in me previous post, it works as expected:

[root@vultr ~]# service pihole-FTL status
● pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/rc.d/init.d/pihole-FTL; bad; vendor preset: disabled)
   Active: active (exited) since Sat 2017-05-20 23:22:07 UTC; 1min 25s ago
     Docs: man:systemd-sysv-generator(8)

May 20 23:22:07 vultr.guest systemd[1]: Starting LSB: pihole-FTL daemon...
May 20 23:22:07 vultr.guest pihole-FTL[10614]: Not running
May 20 23:22:07 vultr.guest su[10624]: (to pihole) root on none
May 20 23:22:07 vultr.guest pihole-FTL[10614]: FTL started!
May 20 23:22:07 vultr.guest systemd[1]: Started LSB: pihole-FTL daemon.
Warning: pihole-FTL.service changed on disk. Run 'systemctl daemon-reload' to reload units.

That fixed the service issue for me. Thanks! The web page still reports "Lost connection to api."

Okay, does the sudo service pihole-FTL status command show you that FTL is active?
If yes, please try to connect to FTL locally using telnet:

telnet 127.0.0.1 4711

If that works, try to get some statistics by typing

>stats

and hitting Return.

To quit you type >quit + Return.

So that works fine for me.

Connected to 127.0.0.1.
Escape character is '^]'.

stats
domains_being_blocked 106964
dns_queries_today 8495
ads_blocked_today 1044
ads_percentage_today 12.289582
unique_domains 1027
queries_forwarded 4686
queries_cached 2765

JFYI I solved it by removing the whole container and installing it on new one, this time Debian one, since the installer failed on Ubuntu containers. Works fine, though I had to connect via ssh to the machine, otherwise I couldnt operate the installer.