spud
June 27, 2019, 11:09am
1
Every time I reboot pihole I have to do a "pihole restartdns" and everything then comes up and starts working.
I've searched here and askubuntu and nothing is working for me.
Tried this:
https://discourse.pi-hole.net/t/ubuntu-mint-after-rebooting-pi-hole-doesnt-work-until-i-run-the-command-pihole-restartdns/1645
Doesn't work for me.
Tried this:
https://askubuntu.com/questions/536787/dnsmasq-starting-before-eth0-is-ready-and-therefore-not-binding
Doesn't work for me because I don't have dnsmasq.service
I've searched for other ways to try and delay dnsmasq from starting but seem to be going round in circles.
So can anyone tell me how to fix this problem. I'm pretty sure if I can just delay the start of dns it will fix the problem.
thanks
mibere
June 27, 2019, 12:04pm
2
After the reboot and before you run pihole restartdns
, run
sudo systemctl status --full --no-pager pihole-FTL.service
and post the output here.
spud
June 28, 2019, 7:16am
3
? pihole-FTL.service - LSB: pihole-FTL daemon
Loaded: loaded (/etc/init.d/pihole-FTL; generated)
Active: active (exited) since Sat 2019-06-29 03:02:05 AEST; 1min 17s ago
Docs: man:systemd-sysv-generator(8)
Process: 822 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)
Jun 29 03:01:59 USPH1804 systemd[1]: Starting LSB: pihole-FTL daemon...
Jun 29 03:02:00 USPH1804 pihole-FTL[822]: Not running
Jun 29 03:02:02 USPH1804 su[1003]: Successful su for pihole by root
Jun 29 03:02:02 USPH1804 su[1003]: + ??? root:pihole
Jun 29 03:02:02 USPH1804 su[1003]: pam_unix(su:session): session opened for user pihole by (uid=0)
Jun 29 03:02:05 USPH1804 pihole-FTL[822]: FTL started!
Jun 29 03:02:05 USPH1804 systemd[1]: Started LSB: pihole-FTL daemon.
spud
June 28, 2019, 9:14am
5
Only thing that looks sus to me is:
ERROR compiling regex on line 1: Invalid preceding regular expression (13)
And the outout from netstat before restarting DNS
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 21063 928/lighttpd
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 999 21580 1047/pihole-FTL
tcp 0 0 127.0.0.1:4711 0.0.0.0:* LISTEN 999 21591 1047/pihole-FTL
tcp6 0 0 :::80 :::* LISTEN 0 21064 928/lighttpd
tcp6 0 0 fe80::e852:c420:4de::53 :::* LISTEN 999 21912 1047/pihole-FTL
tcp6 0 0 ::1:53 :::* LISTEN 999 21582 1047/pihole-FTL
tcp6 0 0 ::1:4711 :::* LISTEN 999 21593 1047/pihole-FTL
udp 0 0 127.0.0.1:53 0.0.0.0:* 999 21579 1047/pihole-FTL
udp 0 0 0.0.0.0:68 0.0.0.0:* 0 21376 975/dhcpcd
udp6 0 0 fe80::e852:c420:4de::53 :::* 999 21911 1047/pihole-FTL
udp6 0 0 ::1:53 :::* 999 21581 1047/pihole-FTL
And after restarting DNS
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 21063 928/lighttpd
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 999 23766 1425/pihole-FTL
tcp 0 0 192.168.0.15:53 0.0.0.0:* LISTEN 999 23764 1425/pihole-FTL
tcp 0 0 127.0.0.1:4711 0.0.0.0:* LISTEN 999 23784 1425/pihole-FTL
tcp6 0 0 :::80 :::* LISTEN 0 21064 928/lighttpd
tcp6 0 0 ::1:53 :::* LISTEN 999 23770 1425/pihole-FTL
tcp6 0 0 fe80::e852:c420:4de::53 :::* LISTEN 999 23768 1425/pihole-FTL
tcp6 0 0 ::1:4711 :::* LISTEN 999 23786 1425/pihole-FTL
udp 0 0 0.0.0.0:65358 0.0.0.0:* 999 24138 1425/pihole-FTL
udp 0 0 127.0.0.1:53 0.0.0.0:* 999 23765 1425/pihole-FTL
udp 0 0 192.168.0.15:53 0.0.0.0:* 999 23763 1425/pihole-FTL
udp 0 0 0.0.0.0:68 0.0.0.0:* 0 21376 975/dhcpcd
udp 0 0 0.0.0.0:7765 0.0.0.0:* 999 24151 1425/pihole-FTL
udp 0 0 0.0.0.0:65125 0.0.0.0:* 999 24135 1425/pihole-FTL
udp 0 0 0.0.0.0:24197 0.0.0.0:* 999 24142 1425/pihole-FTL
udp6 0 0 ::1:53 :::* 999 23769 1425/pihole-FTL
udp6 0 0 fe80::e852:c420:4de::53 :::* 999 23767 1425/pihole-FTL
Mod Edit: formatted output
Mcat12
June 29, 2019, 1:08am
6
Try editing these lines in /etc/init.d/pihole-FTL
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
and replace them with these lines:
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
And then reboot your device.
1 Like
For a (silly) temporary fix, you could add
@reboot sleep 1m && pihole restartdns
To your crontab.
Disclaimer: this is just to automate the restartdns on boot and will not fix the root of your problem.
If @Mcat12 method dont work, below Ubuntu user had something similar.
Solution in that thread is more like a patch and not really a fix.
If have similar issue, you need to figure out why the interface comes up late (dmesg
etc).
Sounds a bit like the interface is reported a bit late.
Check dmesg.
Could be driver issue.
Not sure if works but for diagnosing, you could try delay pihole-FTL a bit by editing below file:
sudo nano /etc/init.d/pihole-FTL
And squeeze in a sleep command (30 seconds just to be sure ) somewhere here:
#!/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…
And your netstat
looks a bit fragmented.
Below how a clean netstat
could look like:
pi@noads:~ $ sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471[1-8] '
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 2957/pihole-FTL
tcp 0 0 127.0.0.1:4711 0.0.0.0:* LISTEN 2957/pihole-FTL
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 579/lighttpd
tcp6 0 0 :::53 :::* LISTEN 2957/pihole-FTL
tcp6 0 0 ::1:4711 :::* LISTEN 2957/pihole-FTL
tcp6 0 0 :::80 :::* LISTEN 579/lighttpd
udp 0 0 0.0.0.0:53 0.0.0.0:* 2957/pihole-FTL
udp 0 0 0.0.0.0:67 0.0.0.0:* 2957/pihole-FTL
udp6 0 0 :::53 :::* 2957/pihole-FTL
Check for alien config files not belonging to Pi-hole with below one:
sudo grep -v '^#\|^$' -R /etc/dnsmasq.* | sort
spud
June 29, 2019, 2:58am
9
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
Didn't work
spud
June 29, 2019, 3:13am
10
#!/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
sleep 30
FTLUSER=pihole
PIDFILE=/var/run/pihole-FTL.pid
[..]
That worked! Changed it to 20 seconds though
Mcat12
June 29, 2019, 3:17am
11
Note that this change will be overwritten by any future updates.
2 Likes
spud
June 29, 2019, 3:20am
12
No worries, I'll keep an eye on it after updating. Thanks for your help!
One last thing, the output of
sudo grep -v '^#\|^$' -R /etc/dnsmasq.* | sort
/etc/dnsmasq.conf:conf-dir=/etc/dnsmasq.d
/etc/dnsmasq.conf.old:conf-dir=/etc/dnsmasq.d
/etc/dnsmasq.d/01-pihole.conf~:addn-hosts=/etc/pihole/black.list
/etc/dnsmasq.d/01-pihole.conf:addn-hosts=/etc/pihole/black.list
/etc/dnsmasq.d/01-pihole.conf~:addn-hosts=/etc/pihole/gravity.list
/etc/dnsmasq.d/01-pihole.conf:addn-hosts=/etc/pihole/gravity.list
/etc/dnsmasq.d/01-pihole.conf~:addn-hosts=/etc/pihole/local.list
/etc/dnsmasq.d/01-pihole.conf:addn-hosts=/etc/pihole/local.list
/etc/dnsmasq.d/01-pihole.conf~:bogus-priv
/etc/dnsmasq.d/01-pihole.conf:bogus-priv
/etc/dnsmasq.d/01-pihole.conf~:cache-size=10000
/etc/dnsmasq.d/01-pihole.conf:cache-size=10000
/etc/dnsmasq.d/01-pihole.conf~:dhcp-ignore-names=tag:wpad-ignore
/etc/dnsmasq.d/01-pihole.conf:dhcp-ignore-names=tag:wpad-ignore
/etc/dnsmasq.d/01-pihole.conf~:dhcp-name-match=set:wpad-ignore,wpad
/etc/dnsmasq.d/01-pihole.conf:dhcp-name-match=set:wpad-ignore,wpad
/etc/dnsmasq.d/01-pihole.conf~:domain-needed
/etc/dnsmasq.d/01-pihole.conf:domain-needed
/etc/dnsmasq.d/01-pihole.conf:interface=enp0s4
/etc/dnsmasq.d/01-pihole.conf~:localise-queries
/etc/dnsmasq.d/01-pihole.conf:localise-queries
/etc/dnsmasq.d/01-pihole.conf~:local-ttl=2
/etc/dnsmasq.d/01-pihole.conf:local-ttl=2
/etc/dnsmasq.d/01-pihole.conf~:log-async
/etc/dnsmasq.d/01-pihole.conf:log-async
/etc/dnsmasq.d/01-pihole.conf~:log-facility=/var/log/pihole.log
/etc/dnsmasq.d/01-pihole.conf:log-facility=/var/log/pihole.log
/etc/dnsmasq.d/01-pihole.conf~:log-queries
/etc/dnsmasq.d/01-pihole.conf:log-queries
/etc/dnsmasq.d/01-pihole.conf~:no-resolv
/etc/dnsmasq.d/01-pihole.conf:no-resolv
/etc/dnsmasq.d/01-pihole.conf~:server=156.154.70.1#53
/etc/dnsmasq.d/01-pihole.conf:server=156.154.70.1#53
/etc/dnsmasq.d/01-pihole.conf~:server=8.8.8.8#53
/etc/dnsmasq.d/01-pihole.conf:server=8.8.8.8#53
/etc/dnsmasq.d-available/lxd:bind-interfaces
/etc/dnsmasq.d-available/lxd:except-interface=lxdbr0
/etc/dnsmasq.d/lxd:bind-interfaces
/etc/dnsmasq.d/lxd:except-interface=lxdbr0
Id there anything there that shouldn't be?
And thanks for all your help guys it was driving me crazy!
1 Like
Yes.
The config file /etc/dnsmasq.d/lxd
is not a Pi-hole one.
Try move it out of that folder to your home folder (for backup):
sudo mv /etc/dnsmasq.d/lxd ~
Restart pihole-FTL:
sudo service pihole-FTL restart
And check again:
sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471[1-8] '
1 Like
spud
June 29, 2019, 3:27am
14
Yeah dude I was logged into the wrong linux box when I posted that, I've now edited it sorry about that
spud
June 29, 2019, 3:30am
16
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 882/lighttpd
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 1973/pihole-FTL
tcp 0 0 127.0.0.1:4711 0.0.0.0:* LISTEN 1973/pihole-FTL
tcp6 0 0 :::80 :::* LISTEN 882/lighttpd
tcp6 0 0 :::53 :::* LISTEN 1973/pihole-FTL
tcp6 0 0 ::1:4711 :::* LISTEN 1973/pihole-FTL
udp 0 0 0.0.0.0:53 0.0.0.0:* 1973/pihole-FTL
udp6 0 0 :::53 :::* 1973/pihole-FTL
Looks better to me
1 Like
spud
June 29, 2019, 3:34am
18
Thanks again dude, ya worth more money!
DL6ER
June 29, 2019, 1:25pm
19
I have one further question for fixing it in upcoming releases if you don't mind: When you again remove the sleep 20
in your init script (so that the command fails), what is the output in /var/log/pihole.log
?
spud
June 30, 2019, 1:02am
20
No dramas
I removed the sleep 20
from /etc/init.d/pihole-FTL
and rebooted
System came back up with everything working. Strange so I rebooted again same thing, everythings working.
Changed this
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
Back to this
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
And it still came up working. So I then moved lxd
back to /etc/dnsmasq.d
and rebooted, it failed! So that was the problem all along.
I did a clean install of Ubuntu 18.04 Server as a VM and setup PiHole in that, I don't remember doing anything with DNS during that install so it might be a default thing I'm not sure.
Anyway, its now working and I now know it was this lxd symlink that was causing the problem all along and nothing to do with PiHole.
And if you hadn't asked me for the output of /var/log/pihole.log
and I'd looked into this more we might never have gotten to the true cause of the problem.
I take it you don't need to see the output of /var/log/pihole.log
anymore?
2 Likes