-hardware: Mid 2012 Macbook Pro (have used with PiHole before successfully)
Actual Behaviour:
Cannot access web interface - states Lost connection to API
PiHole FTL shows it is running:
$ sudo service pihole-FTL status
● pihole-FTL.service - LSB: pihole-FTL daemon
Loaded: loaded (/etc/init.d/pihole-FTL; generated)
Active: active (exited) since Tue 2020-07-14 21:40:27 UTC; 4min 25s ago
Docs: man:systemd-sysv-generator(8)
Process: 7409 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)
Jul 14 21:40:26 elder-mac-smash systemd[1]: Starting LSB: pihole-FTL daemon...
Jul 14 21:40:26 elder-mac-smash pihole-FTL[7409]: Not running
Jul 14 21:40:26 elder-mac-smash su[7433]: (to pihole) root on none
Jul 14 21:40:26 elder-mac-smash su[7433]: pam_unix(su:session): session opened for user pihole by (uid=0)
Jul 14 21:40:27 elder-mac-smash su[7433]: pam_unix(su:session): session closed for user pihole
Jul 14 21:40:27 elder-mac-smash systemd[1]: Started LSB: pihole-FTL daemon.
$ pihole status
[✗] DNS service is NOT running
$ pihole disable
[i] Disabling blocking
[✗] pihole-FTL: no process found
[✓] Pi-hole Disabled
$ pihole enable
[i] Enabling blocking
[✗] pihole-FTL: no process found
[✓] Pi-hole Enabled
$ tail pihole-FTL.log
[2020-07-14 21:40:27.087 7448] Imported 0 queries from the long-term database
[2020-07-14 21:40:27.087 7448] -> Total DNS queries: 0
[2020-07-14 21:40:27.087 7448] -> Cached DNS queries: 0
[2020-07-14 21:40:27.087 7448] -> Forwarded DNS queries: 0
[2020-07-14 21:40:27.087 7448] -> Blocked DNS queries: 0
[2020-07-14 21:40:27.087 7448] -> Unknown DNS queries: 0
[2020-07-14 21:40:27.087 7448] -> Unique domains: 0
[2020-07-14 21:40:27.087 7448] -> Unique clients: 0
[2020-07-14 21:40:27.087 7448] -> Known forward destinations: 0
[2020-07-14 21:40:27.087 7448] Successfully accessed setupVars.conf
jorg@elder-mac-smash:/var/log$
Debug Token:
Debug token fails to upload:
[i] Debug script running in automated mode
* Using curl for transmission.
[✗] There was an error uploading your debug log.
* Please try again or contact the Pi-hole team for assistance.
* A local copy of the debug log can be found at: /var/log/pihole_debug.log
[✓] Storing downloaded domains in new gravity database
[✓] Building tree
[✓] Swapping databases
[i] Number of gravity domains: 87052 (84625 unique domains)
[i] Number of exact blacklisted domains: 0
[i] Number of regex blacklist filters: 0
[i] Number of exact whitelisted domains: 0
[i] Number of regex whitelist filters: 0
[✗] pihole-FTL: no process found
[✓] Cleaning up stray matter
[✓] Restarting DNS server
[✗] DNS service is NOT running
[i] Web Interface password: 9VVraxZS
[i] This can be changed using 'pihole -a -p'
[i] You may now configure your devices to use the Pi-hole as their DNS server
[i] Pi-hole DNS (IPv4): 192.168.50.3
[i] If you set a new IP address, please restart the server running the Pi-hole
[i] The install log is located at: /etc/pihole/install.log
Installation Complete!
I found this question while trying to troubleshoot the same problem, and you might have already tried this, but after going through all the same stuff as you, I finally thought to run
/etc/init.d/pihole-FTL start
and it showed NOT RUNNING but then below that, finally, it showed me an error message that was not being logged ANYWHERE in any log file, which basically said I had a duplicate entry for IP address in /etc/dnsmasq.d/04-pihole-static-dhcp.conf
There was indeed a duplicate entry in the file, which is odd since I've only ever used the admin portal to add those static leases, but after removing the duplicate, everything was back up and running.
Your issue might not be a duplicate static lease, but perhaps running FTL from init.d will show you the actual error in the console since it's not showing up in the logs.
Update: after I solved it and knew the error, I grep'd the entire /var/log and found that the error was being logged in /var/log/daemon.log and nowhere else
I tried running this and it said that dnsmasq was not installed. So I installed it and it failed to start. Is dnsmasq needed for pihole-FTL to run? An earlier comment said to disable it I think.
$ sudo service dnsmasq status
[sudo] password for jorg:
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-07-16 16:31:43 UTC; 28s ago
Process: 821 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=3)
Jul 16 16:31:39 elder-mac-smash systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jul 16 16:31:41 elder-mac-smash dnsmasq[821]: dnsmasq: cannot access /etc/dnsmasq.d/lxd: No such file or directory
Jul 16 16:31:41 elder-mac-smash dnsmasq[821]: cannot access /etc/dnsmasq.d/lxd: No such file or directory
Jul 16 16:31:41 elder-mac-smash dnsmasq[821]: FAILED to start up
Jul 16 16:31:43 elder-mac-smash systemd[1]: dnsmasq.service: Control process exited, code=exited, status=3/NOTIMP>
Jul 16 16:31:43 elder-mac-smash systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Jul 16 16:31:43 elder-mac-smash systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
lines 1-12/12 (END)
Looking around the system I found this. Looks like some sort of symlink that may have been broken. Removing it did the trick!!!!!
jorg@elder-mac-smash:/etc/dnsmasq.d$ sudo systemctl restart dnsmasq.service
jorg@elder-mac-smash:/etc/dnsmasq.d$ sudo systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-07-16 16:42:09 UTC; 8s ago
Process: 1556 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
Process: 1568 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
Process: 1580 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
Main PID: 1579 (dnsmasq)
Tasks: 1 (limit: 4515)
Memory: 3.4M
CGroup: /system.slice/dnsmasq.service
└─1579 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/>
Jul 16 16:42:09 elder-mac-smash systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jul 16 16:42:09 elder-mac-smash dnsmasq[1556]: dnsmasq: syntax check OK.
Jul 16 16:42:09 elder-mac-smash systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
...skipping...
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-07-16 16:42:09 UTC; 8s ago
Process: 1556 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
Process: 1568 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
Process: 1580 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
Main PID: 1579 (dnsmasq)
Tasks: 1 (limit: 4515)
Memory: 3.4M
CGroup: /system.slice/dnsmasq.service
└─1579 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/>
Jul 16 16:42:09 elder-mac-smash systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jul 16 16:42:09 elder-mac-smash dnsmasq[1556]: dnsmasq: syntax check OK.
Jul 16 16:42:09 elder-mac-smash systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
jorg@elder-mac-smash:/etc/dnsmasq.d$ ls -la
total 24
drwxr-xr-x 2 root root 4096 Jul 16 16:41 .
drwxr-xr-x 125 root root 12288 Jul 16 16:29 ..
-rw-r--r-- 1 root root 1406 Jul 14 22:40 01-pihole.conf
-rw-r--r-- 1 root root 211 Feb 13 19:51 README
jorg@elder-mac-smash:/etc/dnsmasq.d$ pihole restartdns
[✓] Restarting DNS server
jorg@elder-mac-smash:/etc/dnsmasq.d$ pihole status
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled
jorg@elder-mac-smash:/etc/dnsmasq.d$
Thank you!!!! Looks like it's working now! Not even remotely sure how that happened I don't think I've ever fooled around with dnsmasq. I wonder if it happened because I upgraded from Ubuntu 18 to 20 and something may have created that link during the upgrade process.
(You can format your output for readability by using the </> Preformatted text menu option. I’ve just done that for you in your post above)
There is no need to install dnsmasq in addition to Pi-hole, on the contrary: Pi-hole comes with its own tailored dnsmasq version embedded, so any additional dnsmasq package on the same machine is likely to cause conflicts.
That's why yubiuser asked you to check whether such a version was running on your system (which it wasn't then).
You may now use his commands to disable dnsmasq on your machine, and you could then also decide to deinstall it completely.
It would seem the root cause of your problem was the extra lxd configuration file (likely provided by Ubuntu for container services) that conflicted with Pi-hole's own configuration in /etc/dnsmasq.d/.
Thank you. I did actually have to disable the dnsmasq I installed for it to work actually. It was still saying that it couldn't connect to the API until I disabled it.
Also, the command to disable it I think is supposed to be systemctl instead of service:
$ sudo service dnsmasq stop
[sudo] password for jorg:
jorg@elder-mac-smash:~$ sudo service dnsmasq disable
Usage: /etc/init.d/dnsmasq {start|stop|restart|force-reload|dump-stats|status}
jorg@elder-mac-smash:~$ sudo systemctl disable dnsmasq.service
Synchronizing state of dnsmasq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable dnsmasq
Removed /etc/systemd/system/multi-user.target.wants/dnsmasq.service.
jorg@elder-mac-smash:~$
Side question: what's the easiest way to transfer block lists from one Pihole to another? I have a second one running and want to transfer the lists over. Thanks!
Is this normal behavior? It seems like name resolution takes a very long time sometimes, and running the dig command, sometimes I will get no response, then I run it a second time a few minutes later and it works.
$ dig google.com
; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> google.com
;; global options: +cmd
;; connection timed out; no servers could be reached
jorg@hogwarts-backup-pi-hole-vm:~$ dig google.com
; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60399
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1220
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 2399 IN A 216.58.213.142
;; Query time: 5467 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 17 16:57:20 UTC 2020
;; MSG SIZE rcvd: 55