Pihole not starting: "Lost connection to API"

I'm unable to get pihole working after several attempts. As other users I'm also running raspAP on my raspberry but as soon as I install pihole I got the error in the subject.

I've seen a few other topics with the same issue but I'm opening this one since any of the proposed solutions have worked on my side.

The error is located in dnsmasq module with the following error:
Apr 06 22:12:43 raspberrypi dnsmasq[5393]: illegal repeated keyword at line 8 of /etc/dnsmasq.d/090_raspap.conf

But I can't see what the error might be in the file contents:

interface=wlan0
dhcp-range=10.3.141.50,10.3.141.60,255.255.255.0,30d
dhcp-host=80:ad:16:45:50:b2,10.3.141.51
dhcp-host=60:ab:67:98:dd:63,10.3.141.52
dhcp-host=1c:cc:d6:f9:ae:69,10.3.141.53
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
conf-dir=/etc/dnsmasq.d

Debug Token:

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

This file is a custom file form what I gather.

Any reason why you would build this there?

The whole DHCP range and setting are defined in another file that's default for Pi-hole.

L.E. Never mind .. it's raspAP generated file ...

this is a duplicate instruction as this is also defined in /etc/dnsmasq.d/01-pihole.conf as
log-facility=/var/log/pihole.log

See if removing/disabling that line, gets the stuff running.

Maybe something else will fail further down as it seems that the raspAP enables the DHCP server which in turn might cause conflict with Pi-hole's DHCP server side (at some point).

Thanks for your reply @RamSet!

As you correctly guessed removing that line from /etc/dnsmasq.d/090_raspap.conf solved the situation but generated another one :frowning:

Apr 07 15:43:24 raspberrypi dnsmasq[756]: failed to bind DHCP server socket: Address already in use

I know from other replies in the forum (and the INTERNETS) that it somehow tricky to get these two pieces of software running at the same time but it really could save my day if I achieved that!

My new debug token is
https://tricorder.pi-hole.net/xpboeotjg4

You’d have to poke at the settings files and make sure you are not setting parameters twice.

The Pi-hole files are mandatory for Pi-hole to work (the ones in /etc/dnsmasq.d/ numbered from 01 to 04 - some showing up when different settings are enabled within Pi-hole)

They set the same parameters as the ap thingy and then the parameters overlap ...

I’m sure that the file generated by the ap is mandatory too. I do think you can tinker with that and have it work, but one thing to keep in mind:
If you end -up modifying any Pi-hole files, if you ever update Pi-hole in the future, those files get overwritten ...

My intention is not to modify any of the default values from pihole, I must have done it unadvertively. My current situation is that pihole starts, can be repaired and managed from the web interface, but it does not seem to be blocking any ads.

I forced the DNS server of my router to be the local ip of my raspberry as well than in my laptop, but when I browse the web I can still see many ads and I can't see the "queries blocked" section being increased dramatically.

A new debug token has been generated in:
https://tricorder.pi-hole.net/hqj8p8n0rk

Thanks for your help!

Some ads are delivered via script side loading and depending on the ad lists you have loaded, they could be only cosmetic (see what happens when you click on one; does it load?).

OR, they can show up because of IPV6 (if IPV6 is enabled, there's a chance the Pi-hole IPV4 IP is bypassed and IPV6 is used instead).

You can either disable IPV6 OR make sure your IPV6 Pi-hole IP is used as the IPV6 DNS.

Hi @Ramset, once again many thanks for your help, really appreciate it!

The ads are indeed loaded, I recall something in the debug log:

*** [ DIAGNOSING ]: Networking
[✓] IPv4 address(es) bound to the eth0 interface:
   **192.168.1.44/24** matches the IP found in /etc/pihole/setupVars.conf

[✓] IPv6 address(es) bound to the eth0 interface:
   *fe80::d857:2b8a:e472:2cb9* does not match the IP found in /etc/pihole/setupVars.conf (https://discourse.pi-hole.net/t/use-ipv6-ula-addresses-for-pi-hole/2127)

   ^ Please note that you may have more than one IP address listed.
   As long as one of them is green, and it matches what is in /etc/pihole/setupVars.conf, there is no need for concern.

Since the ipv4 IP was OK (green) and I didn't concern about ipv6 being red.

Something else that I can read in my log:

*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[✓] app-sj09.marketo.com is 0.0.0.0 via localhost (127.0.0.1)
[✗] Failed to resolve app-sj09.marketo.com via Pi-hole (192.168.1.44)
[✓] doubleclick.com is 216.58.201.174 via a remote, public DNS server (8.8.8.8)

that leads me to pi-hole not being able to resolve the names, and only because the secondary dns I am able to navigate without issues from the access point. The contents of my /etc/dhcpcd.conf follows:

# RaspAP wlan0 configuration
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
interface wlan0
static ip_address=10.3.141.1/24
static routers=10.3.141.1
static domain_name_server=1.1.1.1 8.8.8.8
interface eth0
        static ip_address=192.168.1.44/24
        static routers=192.168.1.1
        static domain_name_servers=8.8.8.8

Any ideas?

I did not get this issue solved. I re installed pihole and noticed a different issue now. I'll open a new request at the shortest.

Many thanks for your help anyhow :slight_smile:

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