DNS service is not Running and does not start

Expected Behaviour:

Pi-Hole should just start

Actual Behaviour:

It says that the dns service was restarted, but if I check it afterwards with pihole status it says

Debug Token:

pzirt9s19i!

Summary

I know there have been a lot of topics with a similar problem, but none of them helped me fixing mine. I made a fresh install of Pi-Hole on a Debian 8 machine. I tried reinstalling multiple times. I tried repair too.

The output of

sudo systemctl status dnsmasq

is

dsnmasq.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

I don't know why. If i try

apt-get install dnsmasq

It says that the newest version is installed...
Another Problem is that in the installer and the repair bash I get this kind of warning:

/opt/pihole/updatecheck.sh: line 75: /usr/bin/pihole-FTL: Operation not permitted
/opt/pihole/updatecheck.sh: line 88: /usr/bin/pihole-FTL: Operation not permitted

And in other lines too.

The Output of

systemctl status pihole-FTL

is

● pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/init.d/pihole-FTL)
   Active: active (exited) since Fri 2019-04-26 11:12:33 EDT; 35s ago
  Process: 27728 ExecStop=/etc/init.d/pihole-FTL stop (code=exited, status=0/SUCCESS)
  Process: 27734 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)

Apr 26 11:12:33 benti pihole-FTL[27734]: Not running
Apr 26 11:12:33 benti su[27761]: Successful su for pihole by root
Apr 26 11:12:33 benti su[27761]: + ??? root:pihole
Apr 26 11:12:33 benti su[27761]: pam_unix(su:session): session opened for user pihole by (uid=0)
Apr 26 11:12:33 benti pihole-FTL[27734]: sh: 1: /usr/bin/pihole-FTL: Operation not permitted
Apr 26 11:12:33 benti su[27761]: pam_unix(su:session): session closed for user pihole
Apr 26 11:12:33 benti systemd[1]: Started LSB: pihole-FTL daemon.

Help is appreciated

In Pi-Hole V4.0 and later, dnsmasq is embedded in pihole-FTL, and dnsmasq no longer runs as a separate process. The debug log will show dnsmasq as either failed or inactive. Process pihole-FTL should be shown running on port 53.

Has Pi-Hole previously worked with this installation, or has it never worked?

To check for processes running on ports used by Pi-Hole, run this command and post the output.

sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471'

Thanks for the quick reply.

In Pi-Hole V4.0 and later, dnsmasq is embedded in pihole-FTL, and dnsmasq no longer runs as a separate process. The debug log will show dnsmasq as either failed or inactive. Process pihole-FTL should be shown running on port 53.

Well that explains why its not running.

sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471'

returns:

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      28131/lighttpd
tcp6       0      0 :::80                   :::*                    LISTEN      28131/lighttpd

Has Pi-Hole previously worked with this installation, or has it never worked?

It has never worked in this setup.

Btw I rechecked the dnsmasq service and I got another output than before, because of a typo.

 dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; disabled)
  Drop-In: /run/systemd/generator/dnsmasq.service.d
           └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
   Active: failed (Result: exit-code) since Fri 2019-04-26 10:51:03 EDT; 1h 21min ago

Apr 26 10:51:03 benti dnsmasq[10738]: dnsmasq: bad option at line 43 of /etc/dnsmasq.d/01-pihole.conf.save
Apr 26 10:51:03 benti systemd[1]: dnsmasq.service: control process exited, code=exited status=1
Apr 26 10:51:03 benti systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Apr 26 10:51:03 benti systemd[1]: Unit dnsmasq.service entered failed state.
Apr 26 10:53:51 benti systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.

Just in case anyone wonders.

Remove the existing dnsmasq installation and this may resolve the problem:

sudo apt-get remove dnsmasq-base

I removed dnsmasq-base but it didn't change anything

Run the repair option to see if it fixes dnsmasq left overs:

pihole -r

Reboot after and post results for below ones again:

sudo systemctl status pihole-FTL -l

journalctl -u pihole-FTL

sudo netstat -nltup | grep 'Proto\|:53 \|:67 \|:80 \|:471[1-8] '

I did what you said and these are the results:

sudo systemctl status pihole-FTL -l

returns

pihole-FTL.service - LSB: pihole-FTL daemon
   Loaded: loaded (/etc/init.d/pihole-FTL)
   Active: active (exited) since Fri 2019-04-26 14:39:34 EDT; 3min 54s ago
  Process: 238 ExecStart=/etc/init.d/pihole-FTL start (code=exited, status=0/SUCCESS)

Apr 26 14:39:34 benti systemd[1]: Starting LSB: pihole-FTL daemon...
Apr 26 14:39:34 benti pihole-FTL[238]: Not running
Apr 26 14:39:34 benti su[355]: Successful su for pihole by root
Apr 26 14:39:34 benti su[355]: + ??? root:pihole
Apr 26 14:39:34 benti su[355]: pam_unix(su:session): session opened for user pihole by (uid=0)
Apr 26 14:39:34 benti pihole-FTL[238]: sh: 1: /usr/bin/pihole-FTL: Operation not permitted
Apr 26 14:39:34 benti su[355]: pam_unix(su:session): session closed for user pihole
Apr 26 14:39:34 benti systemd[1]: Started LSB: pihole-FTL daemon.

journalctl -u pihole-FTL

returns

-- Logs begin at Fri 2019-04-26 14:39:34 EDT, end at Fri 2019-04-26 14:44:00 EDT. --
Apr 26 14:39:34 benti systemd[1]: Starting LSB: pihole-FTL daemon...
Apr 26 14:39:34 benti pihole-FTL[238]: Not running
Apr 26 14:39:34 benti su[355]: Successful su for pihole by root
Apr 26 14:39:34 benti su[355]: + ??? root:pihole
Apr 26 14:39:34 benti su[355]: pam_unix(su:session): session opened for user pihole by (uid=0)
Apr 26 14:39:34 benti pihole-FTL[238]: sh: 1: /usr/bin/pihole-FTL: Operation not permitted
Apr 26 14:39:34 benti su[355]: pam_unix(su:session): session closed for user pihole
Apr 26 14:39:34 benti systemd[1]: Started LSB: pihole-FTL daemon.

And

sudo netstat -nltup | grep 'Proto|:53 |:67 |:80 |:471[1-8] '

returns

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      340/lighttpd
tcp6       0      0 :::80                   :::*                    LISTEN      340/lighttpd

sudo setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"

???

What does that do?

Its part of the init.d script:

less /etc/init.d/pihole-FTL

EDIT: Sets capabilities:

https://docs.pi-hole.net/ftldns/in-depth/#linux-capabilities

I tried it. I get no output from that.
I reran the repair thing and nothing changes, sadly.

I still get some warnings/errors like that:

/usr/bin/pihole-FTL: Operation not permitted

Below, from the init.d script, is suppose to starts pihole-FTL as the "pihole" user (as designed):

su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"

And below one will force it to run as the "root" user:

sudo su -s /bin/sh -c "/usr/bin/pihole-FTL" "root"

You could try run the latter one manually but be warned that the database file will probably change ownership to root !

pi@noads:~ $ stat /etc/pihole/pihole-FTL.db
Access: (0644/-rw-r--r--)  Uid: (  999/  pihole)   Gid: (  996/  pihole)

So I should try to run this:

sudo su -s /bin/sh -c "/usr/bin/pihole-FTL" "root"

?

EDIT:
Nvm. cant read :smiley:

Yeah, see if she starts without permission limitation's

sh: 1: /usr/bin/pihole-FTL: Operation not permitted

It doesn't :confused:

arch

dpkg --print-architecture

dpkg --print-foreign-architectures

file /usr/bin/pihole-FTL

???

root@benti:~# arch
x86_64
root@benti:~# dpkg --print-architecture
amd64
root@benti:~# dpkg --print-foreign-architectures
root@benti:~# file
-bash: file: command not found
/usr/bin/pihole-FTL: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=6bb2ee239d8e2558c54dcd10a3272a42038fcce8, not stripped

Looks all good.
Not sure.
Wait for a dev :roll_eyes: