Dnsmasq not working after last FTL update

After new update pi-hole not work> I've tried remove and reinstall pi-hole but no success.

Your debug token is : a4tfxxr7yx

::: Update option selected.
::: Verifying free disk space...
:::
::: Updating local cache of available packages... done!
:::
::: Checking apt-get for upgraded packages.... done!
:::
::: Your system is up to date! Continuing with Pi-hole installation...
::: Checking for apt-utils... installed!
::: Checking for dialog... installed!
::: Checking for debconf... installed!
::: Checking for dhcpcd5... installed!
::: Checking for git... installed!
::: Checking for iproute2... installed!
::: Checking for whiptail... installed!
:::
::: Checking for existing repository...
::: Updating repo in /etc/.pihole... done!
done!
:::
::: Checking for existing repository...
::: Updating repo in /var/www/html/admin... done!
done!
::: Checking for bc... installed!
::: Checking for cron... installed!
::: Checking for curl... installed!
::: Checking for dnsmasq... installed!
::: Checking for dnsutils... installed!
::: Checking for iputils-ping... installed!
::: Checking for lsof... installed!
::: Checking for netcat... installed!
::: Checking for sudo... installed!
::: Checking for unzip... installed!
::: Checking for wget... installed!
::: Checking for lighttpd... installed!
::: Checking for php-common... installed!
::: Checking for php-cgi... installed!
:::
::: Installing scripts from /etc/.pihole... done.
:::
::: Installing configs from /etc/.pihole...
::: Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf... done.
:::
::: Creating log file and changing owner to dnsmasq... already exists!
:::
::: Installing pihole custom index page...
::: Existing index.php detected, not overwriting
::: Existing index.js detected, not overwriting
::: Existing blockingpage.css detected, not overwriting
:::
::: Installing sudoer file... done!
:::
::: Installing latest Cron script... done!
:::
::: Installing latest logrotate script... done!
:::
::: Downloading latest version of FTL...
::: Detected ARM-aarch64 architecture
::: Installing FTL... transferred... done.
::: Restarting services...
:::
::: Starting dnsmasq service...root@rpi3:~#

systemctl status -l dnsmasq
● 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 Mon 2017-06-05 10:51:45 UTC; 1min 32s ago
Process: 8776 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=1/FAILURE)
Process: 8774 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Jun 05 10:51:45 rpi3 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jun 05 10:51:45 rpi3 dnsmasq[8774]: dnsmasq: syntax check OK.
Jun 05 10:51:45 rpi3 dnsmasq[8776]: dnsmasq: junk found in command line
Jun 05 10:51:45 rpi3 dnsmasq[8776]: junk found in command line
Jun 05 10:51:45 rpi3 dnsmasq[8776]: FAILED to start up
Jun 05 10:51:45 rpi3 systemd[1]: dnsmasq.service: Control process exited, code=exited status=1
Jun 05 10:51:45 rpi3 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jun 05 10:51:45 rpi3 systemd[1]: dnsmasq.service: Unit entered failed state.
Jun 05 10:51:45 rpi3 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
root@rpi3:~#

What happens if you try:

pihole restartdns

I'm concerned because of this:

Maybe you should try reinstalling dnsmasq as follows:

sudo apt-get install --reinstall dnsmasq

I tried

root@rpi3:~# pihole restartdns
Job for dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.

root@rpi3:~# journalctl -xe
Jun 05 20:04:43 rpi3 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
-- Subject: Unit dnsmasq.service has begun start-up
-- Defined-By: systemd
-- Support: Debian -- Support

-- Unit dnsmasq.service has begun starting up.
Jun 05 20:04:43 rpi3 dnsmasq[10940]: dnsmasq: syntax check OK.
Jun 05 20:04:43 rpi3 dnsmasq[10943]: dnsmasq: junk found in command line
Jun 05 20:04:43 rpi3 dnsmasq[10943]: junk found in command line
Jun 05 20:04:43 rpi3 dnsmasq[10943]: FAILED to start up
Jun 05 20:04:43 rpi3 systemd[1]: dnsmasq.service: Control process exited, code=exited status=1
Jun 05 20:04:43 rpi3 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
-- Subject: Unit dnsmasq.service has failed
-- Defined-By: systemd
-- Support: Debian -- Support

-- Unit dnsmasq.service has failed.

-- The result is failed.

root@rpi3:~# apt-get install --reinstall dnsmasq
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 4 not upgraded.
Need to get 0 B/15.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 39093 files and directories currently installed.)
Preparing to unpack .../dnsmasq_2.76-5_all.deb ...
Unpacking dnsmasq (2.76-5) over (2.76-5) ...
Setting up dnsmasq (2.76-5) ...
Job for dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
invoke-rc.d: initscript dnsmasq, action "start" failed.
● 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 Mon 2017-06-05 20:09:52 UTC; 45ms ago
Process: 11068 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=1/FAILURE)
Process: 11065 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Jun 05 20:09:52 rpi3 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jun 05 20:09:52 rpi3 dnsmasq[11065]: dnsmasq: syntax check OK.
Jun 05 20:09:52 rpi3 dnsmasq[11068]: dnsmasq: junk found in command line
Jun 05 20:09:52 rpi3 systemd[1]: dnsmasq.service: Control process exited, code=exited status=1
Jun 05 20:09:52 rpi3 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jun 05 20:09:52 rpi3 systemd[1]: dnsmasq.service: Unit entered failed state.
Jun 05 20:09:52 rpi3 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Processing triggers for systemd (232-24) ...

What do these commands show:

systemctl status dnsmasq.service
journalctl -xe

root@rpi3:~# 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: failed (Result: exit-code) since Mon 2017-06-05 20:20:25 UTC; 2min 11s ago

Jun 05 20:20:25 rpi3 systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jun 05 20:20:25 rpi3 dnsmasq[12153]: dnsmasq: syntax check OK.
Jun 05 20:20:25 rpi3 dnsmasq[12156]: dnsmasq: junk found in command line
Jun 05 20:20:25 rpi3 systemd[1]: dnsmasq.service: Control process exited, code=exited status=1
Jun 05 20:20:25 rpi3 systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jun 05 20:20:25 rpi3 systemd[1]: dnsmasq.service: Unit entered failed state.
Jun 05 20:20:25 rpi3 systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
root@rpi3:~#

I see that you are running Debian Stretch on your Raspberry Pi v3, which is a combination we do not support (yet), so we need more information. Please provide:

dnsmasq -v

cat /etc/init.d/dnsmasq | nc tricorder.pi-hole.net 9999
systemctl show dnsmasq | nc tricorder.pi-hole.net 9999

root@rpi3:~# dnsmasq -v
Dnsmasq version 2.76 Copyright (c) 2000-2016 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
root@rpi3:~#
root@rpi3:~# cat /etc/init.d/dnsmasq | nc tricorder.pi-hole.net 9999
txq9evwodg
root@rpi3:~# systemctl show dnsmasq | nc tricorder.pi-hole.net 9999
qj6s5ur7mn
root@rpi3:~#

For comparison with another working Stretch RasPi.
Its an Upstart system so the last systemctl command failed.

xbian@monmc ~ $ cat /etc/debian_version
9.0

xbian@monmc ~ $ uname -r -m
4.9.30+ armv6l

xbian@monmc ~ $ sudo dnsmasq -v
Dnsmasq version 2.76  Copyright (c) 2000-2016 Simon Kelley

xbian@monmc ~ $ cat /etc/init.d/dnsmasq | nc tricorder.pi-hole.net 9999
zw6563dotk

xbian@monmc ~ $ sudo systemctl show dnsmasq
Failed to get properties: No such interface ''

Everything was working perfectly since dnsmasq was updated. Maybe I should downgrade dnsmasq?
Version before 2.76 was confirmed to working.

Okay, from what I can see now, the init.d files of @deHakkelaar and @lukaszl are identical.

Hmm, let's wait a few iterations so we may be able to identify what is causing the problems if you are willing to do this :slight_smile:

ok. better solution is to identify what causes “my” problem

Yes, especially since others might be facing the same issue if they want to play with Debian Stretch on their Raspberries (and possibly other devices). I'm currently comparing dnsmasq's code versions 2.76 and 2.75 hoping to find a significant difference that may lead to this.

Does she start manually ?

sudo /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service

ps -e | grep dnsmasq

root@rpi3:~# sudo /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service

dnsmasq: failed to create listening socket for port 53: Address already in use
root@rpi3:~# ps -e | grep dnsmasq
13014 ? 00:00:00 dnsmasq
root@rpi3:~#

Okay ... try

sudo killall -9 dnsmasq

before trying to start it.

root@rpi3:~# sudo killall -9 dnsmasq
root@rpi3:~# sudo /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
root@rpi3:~# ps -e | grep dnsmasq
13409 ? 00:00:00 dnsmasq
root@rpi3:~#

Okay, so you can start it with this command, but not with the systemd service rules...

Update: systemctl will call a /etc/init.d/dnsmasq systemd-exec which in turn will do

        exec $DAEMON -x /run/dnsmasq/$NAME.pid \
            ${MAILHOSTNAME:+ -m $MAILHOSTNAME} \
            ${MAILTARGET:+ -t $MAILTARGET} \
            ${DNSMASQ_USER:+ -u $DNSMASQ_USER} \
            ${DNSMASQ_INTERFACES:+ $DNSMASQ_INTERFACES} \
            ${DHCP_LEASE:+ -l $DHCP_LEASE} \
            ${DOMAIN_SUFFIX:+ -s $DOMAIN_SUFFIX} \
            ${RESOLV_CONF:+ -r $RESOLV_CONF} \
            ${CACHESIZE:+ -c $CACHESIZE} \
            ${CONFIG_DIR:+ -7 $CONFIG_DIR} \
            ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}

with a bunch of variables that cannot be checked straightforwardly.

BUT what we can do is going into the file /etc/init.d/dnsmasq and looking for the part of the code I have posted above (should be line 296 in your case). Please put in before this line the following code (it is exactly the same, but echo instead of exec):

        echo $DAEMON -x /run/dnsmasq/$NAME.pid \
            ${MAILHOSTNAME:+ -m $MAILHOSTNAME} \
            ${MAILTARGET:+ -t $MAILTARGET} \
            ${DNSMASQ_USER:+ -u $DNSMASQ_USER} \
            ${DNSMASQ_INTERFACES:+ $DNSMASQ_INTERFACES} \
            ${DHCP_LEASE:+ -l $DHCP_LEASE} \
            ${DOMAIN_SUFFIX:+ -s $DOMAIN_SUFFIX} \
            ${RESOLV_CONF:+ -r $RESOLV_CONF} \
            ${CACHESIZE:+ -c $CACHESIZE} \
            ${CONFIG_DIR:+ -7 $CONFIG_DIR} \
            ${DNSMASQ_OPTS:+ $DNSMASQ_OPTS}

and try again with:

sudo killall -9 dnsmasq
pihole restartdns
systemctl status dnsmasq.service