Just ran into this bug. The resolvconf hook is indeed run after
dnsmasq is up and running. When I run `sudo systemctl start dnsmasq`
from a terminal, it doesn't return, and running `systemctl` from
another terminal reveals
dnsmasq.service loaded activating start-post start dnsmasq - A
lightweight DHCP and caching DNS server
i.e. the ExecStartPost task of dnsmasq.service is running. In fact, at
this moment dnsmasq is already working. If I look at running
processes:
$ ps aux | grep -e dns -e resolv
root 2462 0.0 0.6 40540 3496 pts/1 S+ 19:50 0:00 sudo systemctl start dnsmasq
root 2463 0.0 0.4 22488 2512 pts/1 S+ 19:50 0:00 systemctl start dnsmasq
dnsmasq 2474 0.0 0.5 36744 2852 ? S 19:50 0:00 /usr/sbin/dnsmasq -x
/var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r
/var/run/dnsmasq/resolv.conf -7
/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
--trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
root 2475 0.0 0.3 4336 1640 ? Ss 19:50 0:00 /bin/sh
/etc/init.d/dnsmasq systemd-start-resolvconf
root 2481 0.0 0.1 4224 652 ? S 19:50 0:00 run-parts --arg=-a
--arg=lo.dnsmasq /etc/resolvconf/update.d
root 2497 0.0 0.1 4224 636 ? S 19:50 0:00 run-parts
/etc/resolvconf/update-libc.d
root 2539 0.0 0.1 4336 756 ? S 19:50 0:00 /bin/sh
/etc/resolvconf/update-libc.d/squid3
So it's /etc/resolvconf/update-libc.d/squid3 that's hanging. After a
few minutes, the status of dnsmasq.service changes to:
dnsmasq.service loaded deactivating stop start dnsmasq - A
lightweight DHCP and caching DNS server
And:
$ ps aux | grep -e dns -e resolv
root 2462 0.0 0.6 40540 3496 pts/1 S+ 19:50 0:00 sudo systemctl start dnsmasq
root 2463 0.0 0.4 22488 2512 pts/1 S+ 19:50 0:00 systemctl start dnsmasq
dnsmasq 2474 0.0 0.5 36744 2856 ? S 19:50 0:00 /usr/sbin/dnsmasq -x
/var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r
/var/run/dnsmasq/resolv.conf -7
/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
--trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
root 2475 0.0 0.3 4336 1640 ? Ss 19:50 0:00 /bin/sh
/etc/init.d/dnsmasq systemd-start-resolvconf
root 2481 0.0 0.1 4224 652 ? S 19:50 0:00 run-parts --arg=-a
--arg=lo.dnsmasq /etc/resolvconf/update.d
root 2497 0.0 0.1 4224 636 ? S 19:50 0:00 run-parts
/etc/resolvconf/update-libc.d
root 2539 0.0 0.1 4336 756 ? S 19:50 0:00 /bin/sh
/etc/resolvconf/update-libc.d/squid3
root 2581 0.0 0.3 4336 1668 ? Ss 19:51 0:00 /bin/sh
/etc/init.d/dnsmasq systemd-stop-resolvconf
root 2586 0.0 0.1 4224 660 ? S 19:51 0:00 run-parts --arg=-d
--arg=lo.dnsmasq /etc/resolvconf/update.d
root 2598 0.0 0.1 4224 652 ? S 19:51 0:00 run-parts
/etc/resolvconf/update-libc.d
root 2640 0.0 0.1 4336 792 ? S 19:51 0:00 /bin/sh
/etc/resolvconf/update-libc.d/squid3
So systemd decides that the starting of dnsmasq.service has failed
since its ExecStartPost task timed out, and tries to stop
dnsmasq.service. This triggers resolvconf again in dnsmasq.service's
ExecStop task, and another instance of
/etc/resolvconf/update-libc.d/squid3 is run, while the previous copy
hasn't even exited yet.
After a few more minutes, the ExecStop task also times out, and the
original terminal finally returns with
Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service'
and 'journalctl -xn' for details.