Lost Connection to API

/sbin/init --version

SysV init version: 2.93

readlink -f /sbin/init

/sbin/init

hostnamectl | tail -3

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to create bus connection: Host is down

lsb_release -a

No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Old school System-V init.
That explains below:

Do you have an IPv4 stack:

ip -4 address show lo

Do you have an IPv4 stack

No.

If you dont have the loopback interface named lo setup, pihole-FTL wouldnt be able to bind to 127.0.0.1 port 4711 (or IPv6 address ::1 port 4711):

pi@ph5:~ $ ip address show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

EDIT: added IPv6

Here's what I see:

$ ip address show lo
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

Two questions then: how did it work before? How do I fix it? This Raspberry Pi is used exclusively for Pi-Hole.

I dont know.
Your sytem is in a weird state using System-V instead of default systemd for Raspbian.
Also all distro's out of the box have the lo interface configured and yours doesnt.
So some customization is screwing things up for you.

You could for diagnosing assign an IP to the lo interface manually:

sudo ip address add 127.0.0.1/8 dev lo

Restart pihole-FTL:

pihole restartdns

And check again if listening now on port 4711 for the API:

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

I dont know what network manager (if any) is taking care of IP settings for your system so you could make above IP address assignment for the lo interface reboot persistent.

Thanks for your help. I see that pihole-FTL is now listening on port 4711, but the Web UI still shows "Lost Connection to API". Moreover, requests are slow even from curl on the Pi!

I might reinstall the entire OS and then Pi-hole.

Reload the page with CTRL-F5.

Good one :wink:

This may be your best approach to get back to a known good configuration. Before you do this, export your Pi-hole settings with the teleporter function, then you can restore them to the new install.

1 Like

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