Lost Connection to API

Expected Behaviour:

I logged in to the Web UI and saw "Lost Connection to API". I restarted the pihole-FTL service and checked the Web UI again, to no avail. I then ran pihole -r to repair the subsystems. After running the repair script, I expected to see stats in the Web UI. pihole status shows that DNS is not running.

Actual Behaviour:

The Web UI continues to show "Lost Connection to API".

Debug Token:

https://tricorder.pi-hole.net/jyda8n38az

Have you recently updated you pihole installation? If so, please clear your browser's cache.

Are there any errors in /var/log/pihole-FTL.log

Please run the following commands and post the output of all but the first:

sudo service pihole-FTL restart

sudo service pihole-FTL status

pihole-FTL dnsmasq-test

> sudo service pihole-FTL status
[ ok ] pihole-FTL is running
> pihole-FTL dnsmasq-test
dnsmasq: syntax check OK.

Please generate a fresh debug log and post the new token.

New token: uzkb1lf6sq

I note that the debug process seemed to take a long time while diagnosing the dashboard and block page.

Are there any errors in /var/log/pihole-FTL.log

No errors in /var/log/pihole-FTL.log

I restarted the Raspberry PI and now I see this error:

Error listening on IPv4 port 4711: Cannot assign requested address (99)

What is the output of the following from the Pi terminal:

sudo netstat -nltup | grep 'Proto\|:53 \|:5053 \|:5353 \|:5335 \|:8953 \|:67 \|:80 \|:471'

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1832/lighttpd
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      2659/pihole-FTL
udp        0      0 0.0.0.0:53              0.0.0.0:*                           2659/pihole-FTL
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           1404/avahi-daemon:

And the complete output of: sudo service pihole-FTL status

[ ok ] pihole-FTL is running

I upgraded to 5.2, but problems still persist.

pihole -v
  Pi-hole version is v5.1.2 (Latest: v5.1.2)
  AdminLTE version is v5.1.1 (Latest: v5.1.1)
  FTL version is v5.2 (Latest: v5.2)

Here's my latest debug token: https://tricorder.pi-hole.net/5shxmwqyhn

This is not the complete output.

That's all that I see. Should I look somewhere else?

The output of this command should look something like this:

sudo service pihole-FTL status

● pihole-FTL.service - LSB: pihole-FTL daemon
Loaded: loaded (/etc/init.d/pihole-FTL; generated)
Active: **active (exited)** since Fri 2020-08-07 09:17:46 CDT; 3 days ago
Docs: man:systemd-sysv-generator(8)
Process: 11556 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)
Aug 07 09:17:45 Pi-3B-DEV systemd[1]: Starting LSB: pihole-FTL daemon...
Aug 07 09:17:46 Pi-3B-DEV pihole-FTL[11556]: Not running
Aug 07 09:17:46 Pi-3B-DEV su[11580]: **(to pihole) root on none**
Aug 07 09:17:46 Pi-3B-DEV su[11580]: pam_unix(su:session): session opened for user pihole by (uid=0)
Aug 07 09:17:46 Pi-3B-DEV pihole-FTL[11556]: FTL started!
Aug 07 09:17:46 Pi-3B-DEV su[11580]: pam_unix(su:session): session closed for user pihole
Aug 07 09:17:46 Pi-3B-DEV systemd[1]: Started LSB: pihole-FTL daemon.

I see a script in /etc/init.d that includes the following status function, which corresponds with what I'm seeing:

# Indicate the service status
status() {
  if is_running; then
    echo "[ ok ] pihole-FTL is running"
    exit 0
  else
    echo "[    ] pihole-FTL is not running"
    exit 1
  fi
}

Is this the wrong script/function?

Sounds like the init system isn't systemd.
Can you post output for below to determine the init system implemented by your distro ?

/sbin/init --version

readlink -f /sbin/init

Also post info about your distro pls:

hostnamectl | tail -3

lsb_release -a

From the debug log:

*** [ DIAGNOSING ]: lighttpd version
[i] 1.4.53

*** [ DIAGNOSING ]: php version
[i] 7.3.19

*** [ DIAGNOSING ]: Operating system
[✓] Distro:  Raspbian
[✓] Version: 10

Yeah you can run almost any distro with another init.
You can debootstrap Buster with Upstart init if virtualised for example.

EDIT: still doesnt explain why pihole-FTL didnt bind to 4711 (from netstat).