# PiHole-FTL Lost Connection to API

**URL:** <https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234>\
**Category:** Help\
**Created:** [May 18, 2017, 10:57pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234 "2017-05-18T22:57:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 18, 2017, 10:57pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/1 "2017-05-18T22:57:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)\
**Post date:** [May 18, 2017, 11:13pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/2 "2017-05-18T23:13:55Z")

</div>

Run `pihole -d` for a debug token.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 19, 2017, 2:45pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/3 "2017-05-19T14:45:42Z")

</div>

A post was split to a new topic: [FTL offline now and then](https://discourse.pi-hole.net/t/ftl-offline-now-and-then/3245)

---

<div class="post-metadata">

**Author:** ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)\
**Post date:** [May 19, 2017, 1:31am UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/4 "2017-05-19T01:31:12Z")

</div>

You can also run `sudo service pihole-FTL restart`

---

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 19, 2017, 1:37am UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/5 "2017-05-19T01:37:23Z")

</div>

Here is my token: ohetdnzvpa

---

<div class="post-metadata">

**Author:** ![Mcat12](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mcat12/32/20_2.png) [@Mcat12](https://discourse.pi-hole.net/u/Mcat12)\
**Post date:** [May 19, 2017, 1:42am UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/6 "2017-05-19T01:42:04Z")

</div>

What's the output of these commands?

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

```

---

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 19, 2017, 12:03pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/7 "2017-05-19T12:03:18Z")

</div>

[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

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 19, 2017, 2:52pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/8 "2017-05-19T14:52:55Z")

</div>

A post was split to a new topic: [Unknown job: pihole-FTL](https://discourse.pi-hole.net/t/unknown-job-pihole-ftl/3246)

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 19, 2017, 2:45pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/9 "2017-05-19T14:45:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 19, 2017, 2:52pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/10 "2017-05-19T14:52:26Z")

</div>

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:

[https://serverfault.com/a/667794](https://serverfault.com/a/667794)

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

---

<div class="post-metadata">

**Author:** ![DanSchaper](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/danschaper/32/91_2.png) [@DanSchaper](https://discourse.pi-hole.net/u/DanSchaper)\
**Post date:** [May 19, 2017, 6:37pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/11 "2017-05-19T18:37:55Z")

</div>

2 posts were split to a new topic: [Pihole-FTL receiving SIGTERM](https://discourse.pi-hole.net/t/pihole-ftl-receiving-sigterm/3250)

---

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 20, 2017, 12:54pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/12 "2017-05-20T12:54:38Z")

</div>

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
> 
> ```

---

<div class="post-metadata">

**Author:** ![warsawday](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@warsawday](https://discourse.pi-hole.net/u/warsawday)\
**Post date:** [May 20, 2017, 9:46pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/13 "2017-05-20T21:46:49Z")

</div>

Had same issue on ubuntu.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 20, 2017, 11:01pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/14 "2017-05-20T23:01:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 20, 2017, 11:02pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/15 "2017-05-20T23:02:49Z")

</div>

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

Add

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

```

in between

```plaintext
### END INIT INFO

```

and

```plaintext
FTLUSER=pihole

```

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [May 20, 2017, 11:25pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/16 "2017-05-20T23:25:15Z")

</div>

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

```plaintext
[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:

```plaintext
[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.

```

---

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 21, 2017, 2:08am UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/17 "2017-05-21T02:08:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MrD](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mrd/32/980_2.png) [@MrD](https://discourse.pi-hole.net/u/MrD)\
**Post date:** [May 21, 2017, 1:14pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/18 "2017-05-21T13:14:36Z")

</div>

> [@maxpower](#):
>
> 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`:

```auto
telnet 127.0.0.1 4711

```

If that works, try to get some statistics by typing

```auto
>stats

```

and hitting Return.

To quit you type `>quit` + Return.

---

<div class="post-metadata">

**Author:** ![maxpower](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/maxpower/32/1384_2.png) [@maxpower](https://discourse.pi-hole.net/u/maxpower)\
**Post date:** [May 21, 2017, 2:38pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/19 "2017-05-21T14:38:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warsawday](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@warsawday](https://discourse.pi-hole.net/u/warsawday)\
**Post date:** [May 21, 2017, 4:47pm UTC](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234/20 "2017-05-21T16:47:58Z")

</div>

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.

[Next page](https://discourse.pi-hole.net/t/pihole-ftl-lost-connection-to-api/3234.md?page=2)
