Illegal repeated keyword at line 32 of /etc/dnsmasq.d/01-pihole.conf

Expected Behaviour:

-Pi Hole working on beablebone:
-Debian flasher 10.3
-Beaglebone Black

Actual Behaviour:

Failing to start Lighttpd daemon

Debug Token:

_https://tricorder.pi-hole.net/sog80d2nlk_

Hi guys!
I've been following this guide, but I cannot get this to work. Thank you very much in advance.

Run from a terminal on your Pi-hole machine, what's the output of:

grep -nRv '^#\|^$' /etc/dnsmasq.*

Thank you! This is the response:

/etc/dnsmasq.conf:1:conf-dir=/etc/dnsmasq.d
/etc/dnsmasq.conf.old:668:conf-dir=/etc/dnsmasq.d
/etc/dnsmasq.d/SoftAp0:1:interface=usb0
/etc/dnsmasq.d/SoftAp0:2:interface=usb1
/etc/dnsmasq.d/SoftAp0:3:port=53
/etc/dnsmasq.d/SoftAp0:4:dhcp-authoritative
/etc/dnsmasq.d/SoftAp0:5:domain-needed
/etc/dnsmasq.d/SoftAp0:6:bogus-priv
/etc/dnsmasq.d/SoftAp0:7:expand-hosts
/etc/dnsmasq.d/SoftAp0:8:cache-size=2048
/etc/dnsmasq.d/SoftAp0:9:dhcp-range=usb0,192.168.7.1,192.168.7.1,2m
/etc/dnsmasq.d/SoftAp0:10:dhcp-range=usb1,192.168.6.1,192.168.6.1,2m
/etc/dnsmasq.d/SoftAp0:11:listen-address=127.0.0.1
/etc/dnsmasq.d/SoftAp0:12:listen-address=192.168.7.2
/etc/dnsmasq.d/SoftAp0:13:listen-address=192.168.6.2
/etc/dnsmasq.d/SoftAp0:14:dhcp-option=usb0,3
/etc/dnsmasq.d/SoftAp0:15:dhcp-option=usb0,6
/etc/dnsmasq.d/SoftAp0:16:dhcp-option=usb1,3
/etc/dnsmasq.d/SoftAp0:17:dhcp-option=usb1,6
/etc/dnsmasq.d/SoftAp0:18:dhcp-leasefile=/var/run/dnsmasq.leases
/etc/dnsmasq.d/01-pihole.conf:21:addn-hosts=/etc/pihole/local.list
/etc/dnsmasq.d/01-pihole.conf:22:addn-hosts=/etc/pihole/custom.list
/etc/dnsmasq.d/01-pihole.conf:23:localise-queries
/etc/dnsmasq.d/01-pihole.conf:24:no-resolv
/etc/dnsmasq.d/01-pihole.conf:25:log-queries
/etc/dnsmasq.d/01-pihole.conf:26:log-facility=/var/log/pihole.log
/etc/dnsmasq.d/01-pihole.conf:27:local-ttl=2
/etc/dnsmasq.d/01-pihole.conf:28:log-async
/etc/dnsmasq.d/01-pihole.conf:29:server=8.8.8.8
/etc/dnsmasq.d/01-pihole.conf:30:server=8.8.4.4
/etc/dnsmasq.d/01-pihole.conf:31:interface=eth0

Sure you got the complete output?
Seems that the offending line 32 from 01-pihole.conf wasn't included.

Anways, it shows one file that isn't part of Pi-hole:
/etc/dnsmasq.d/SoftAp0

If you are not dependent on that file, just delete it or move it out of the way, e.g. to your home dir:

sudo mv /etc/dnsmasq.d/SoftAp0 ~

Then restart Pi-hole to reread its dnsmasq configuration:

pihole restartdns

If you need that SoftAp0, you'd have to resolve the configuration conflicts.

Thank you very much for taking the time. Looks like dns is working now, but I get a "failed to open page" when navigating to the beagle's IP / admin.
I am attaching the new debug token. It seems like it cannot find the gateway, but if I ping it, it answers.

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

Thanks!

You have quite a few issues with your installation:

Pi-hole failed to bind any of its ports, and it is conflicting with a separate dnsmasq on your machine over port 53:

*** [ DIAGNOSING ]: Ports in use
[53] is in use by dnsmasq (https://docs.pi-hole.net/main/prerequisites/#ports)
[53] is in use by dnsmasq (https://docs.pi-hole.net/main/prerequisites/#ports)

This results in no DNS resolution via Pi-hole's local IP addresses:

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

Also, Pi-hole's web server isn't running at all:

*** [ DIAGNOSING ]: Pi-hole processes
[✗] lighttpd daemon is failed

*** [ DIAGNOSING ]: Dashboard and block page
[✗] Block page X-Header: X-Header does not match or could not be retrieved.
[✗] Web interface X-Header: X-Header does not match or could not be retrieved.

Did you choose to install Pi-hole's web server?

And finally, none of your clients seem to actually use Pi-hole for DNS yet:

*** [ DIAGNOSING ]: contents of /var/log
-rw-r--r-- 1 pihole pihole 20045 Nov  1 11:23 /var/log/pihole-FTL.log
   -----tail of pihole-FTL.log------
   [2020-11-01 11:23:58.704 2300M] Imported 0 queries from the long-term database
   [2020-11-01 11:23:58.705 2300M]  -> Total DNS queries: 0
   [2020-11-01 11:23:58.705 2300M]  -> Cached DNS queries: 0
   [2020-11-01 11:23:58.705 2300M]  -> Forwarded DNS queries: 0
   [2020-11-01 11:23:58.705 2300M]  -> Blocked DNS queries: 0
   [2020-11-01 11:23:58.705 2300M]  -> Unknown DNS queries: 0
   [2020-11-01 11:23:58.705 2300M]  -> Unique domains: 0
   [2020-11-01 11:23:58.705 2300M]  -> Unique clients: 0
   [2020-11-01 11:23:58.705 2300M]  -> Known forward destinations: 0

I suspect a separate dnsmasq to be present because of some other software requiring it as a dependency, probably the same package that introduced the additional SoftAp0 configurations that caused your intial conflict.

If you don't need that software, you should consider removing it from your machine, along with dnsmasq.
If you do need it, you'd have to find a way to resolve the conflicts in dnsmasq's configuration, in addition to disabling or removing dnsmasq.

Thank you for such a detailed explanation and apologies for not seeing it.
I uninstalled dnsmasq with:

sudo apt-get remove dnsmasq

I rebooted the Beagle. Looks like lighttpd daemon fails to run. When installing Pihole I left everything by default, so I guess I installed web server. I'm sorry that I don't know how to solve this. I think it can help other users. Again, the token:

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

Thanks!

What's the output of

pihole status

Your debug log shows still no ports for Pi-hole or lighttpd:

*** [ DIAGNOSING ]: Ports in use
*:1880 systemd (IPv6)
*:8080 systemd (IPv6)
*:3000 systemd (IPv6)
*:22 sshd (IPv4)
*:22 sshd (IPv6)

You should check your firewall settings - the docs on ports I've linked previously contain a section on firewalls, too.

Once you've verified ports are available as required, you may test your lighttpd installation for syntactical correctness by running:

lighttpd -t -f /etc/lighttpd/lighttpd.conf

If that comes back with Syntax OK, try restarting it:

sudo service lighttpd restart

In case that fails, please provide the output for:

sudo systemctl status --full --no-pager lighttpd.service

All above commands need to be run on your Pi-hole machine.

Thank you!

Regarding the first query:

[✗] DNS service is NOT running

Regarding the second query:

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2020-11-01 12:10:04 UTC; 4h 49min ago
  Process: 1246 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)

Nov 01 12:10:04 beaglebone systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Nov 01 12:10:04 beaglebone systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 9.
Nov 01 12:10:04 beaglebone systemd[1]: Stopped Lighttpd Daemon.
Nov 01 12:10:04 beaglebone systemd[1]: lighttpd.service: Start request repeated too quickly.
Nov 01 12:10:04 beaglebone systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Nov 01 12:10:04 beaglebone systemd[1]: Failed to start Lighttpd Daemon.

About the lighttpd configuration:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Duplicate config variable in conditional 0 global: server.port
2020-11-01 17:04:07: (configfile.c.1296) source: cat external.conf 2>/dev/null line: 2 pos: 1 parser failed somehow near here: (EOL) 
2020-11-01 17:04:07: (configfile.c.1296) source: /etc/lighttpd/lighttpd.conf line: 116 pos: 1 parser failed somehow near here: (EOL) 

Sorry about that. Thank you very much.

Please run

sudo systemctl restart pihole-FTL.service

and provide the output of:

sudo systemctl status --full --no-pager pihole-FTL.service

You'd have to resolve those conflicts in your lighttpd configuration.

If those were introduced to allow for coexistence with your nginx installation, you may have to consult the instructions you've used to configure that.

Here it goes :slight_smile:

Here it shows red but it's green (looks good):

● pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/init.d/pihole-FTL; generated)
   Active: active (exited) since Sun 2020-11-01 18:11:05 UTC; 10s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5826 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)

Nov 01 18:11:04 beaglebone systemd[1]: Starting LSB: pihole-FTL daemon...
Nov 01 18:11:04 beaglebone pihole-FTL[5826]: Not running
Nov 01 18:11:04 beaglebone su[5844]: (to pihole) root on none
Nov 01 18:11:04 beaglebone su[5844]: pam_unix(su:session): session opened for user pihole by (uid=0)
Nov 01 18:11:05 beaglebone pihole-FTL[5826]: dnsmasq: cannot open or create lease file /var/lib/misc/dnsmasq.leases: Permission denied
Nov 01 18:11:05 beaglebone su[5844]: pam_unix(su:session): session closed for user pihole
Nov 01 18:11:05 beaglebone systemd[1]: Started LSB: pihole-FTL daemon.

Okay! Solved.
Here is what I did, with the provided information:

  1. Flash my beagle again.

  2. Install pihole again and fix the issues.

pihole -d

Okay, step by step. In my case, some red crosses would appear. I had three of them.

1: Port 53 is used, and it has to bee free for pihole. Who is using this port? Our lovely dnsmasq service, as pointed out by @Bucking_Horn. So, I uninstalled it.

sudo apt-get remove dnsmasq

And then, you'll see this:

[53] is in use by pihole-FTL

As is. Bye bye dnsmasq. Now it highlights the port 53 in green, indicating pihole is using it. YES!

2: Port 80 is used by nginx, and it has to bee freed as well. So I changed the port from 80 to 81, by changing all the "80"s by "81" in the following file:

sudo vi /etc/nginx/sites-enabled/default

Yes, now the port 80 is free, and 81 isn't.

[80] is in use by lighttpd
[80] is in use by lighttpd
*:81 nginx (IPv4)
*:81 nginx (IPv6)

3. DNS not working
Now my dashboard would load when navigating to the beagle IP, but the DNS would not work yet. As @Bucking_Horn pointed out (THANKS!), there is a file that interferes with the pihole DNS. So, get rid of it with:

sudo mv /etc/dnsmasq.d/SoftAp0 ~

Reboot the beagle, and works. It does not stop the youtube ads, yet, but works.
Thanks to @Bucking_Horn again for taking the time. Thank you very much.