Hi ingopingo and anyone else,
I have looked closely at your perfectly valid bug report, and I have to say
thank you for reporting it and helping to improve Ubuntu.
It's true that the ExecStartPre directive is incomplete, as it is not using the
--conf-dir/-7 option and there isn't a folder hardcoded anywhere that the
daemon uses with the --test option without argument, as we can see
experimenting a bit directly with the command in that directive (root@focal:~#
grep ExecStartPre /lib/systemd/system/dnsmasq.service
ExecStartPre=/usr/sbin/dnsmasq --test ):
1- Let's put a bad configuration file under /etc/dnsmasq.d :
root@focal:~# cat /etc/dnsmasq.d/kk.conf
HELLO="I need coffee to say hello in the morning"
2- Running the command from the directive, we get:
root@focal:~# /usr/sbin/dnsmasq --test
dnsmasq: syntax check OK.
3- Running the command with the --conf-dir/-7 option:
root@focal:~# /usr/sbin/dnsmasq --test --conf-dir=/etc/dnsmasq.d
dnsmasq: bad option at line 1 of /etc/dnsmasq.d/kk.conf
So, as you pointed, the ExecStartPre is doing nothing in the service
unit file. But, if we look the failed status after trying a "systemctl
start dnsmasq" with the bad config, we get:
- Not testing well, but with SUCCESS status for the directive (so the
starting process continues):
Process: 34824 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited,
status=0/SUCCESS)
- and not starting the service, because the dnsmasq's init.d file check the
configuration on start:
Nov 25 10:16:43 focal dnsmasq[34824]: dnsmasq: syntax check OK.
Nov 25 10:16:43 focal dnsmasq[34825]: dnsmasq: bad option at line 1 of
/etc/dnsmasq.d/kk.conf
Nov 25 10:16:43 focal dnsmasq[34825]: bad option at line 1 of
/etc/dnsmasq.d/kk.conf
root@focal:~# systemctl start dnsmasq
Job for dnsmasq.service failed because the control process exited with
error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
root@focal:~# systemctl status 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 Thu 2021-11-25 10:16:43 UTC; 4s
ago
Process: 34824 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited,
status=0/SUCCESS)
Process: 34825 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited,
status=1/FAILURE)
Nov 25 10:16:43 focal systemd[1]: Starting dnsmasq - A lightweight DHCP and
caching DNS server...
Nov 25 10:16:43 focal dnsmasq[34824]: dnsmasq: syntax check OK.
Nov 25 10:16:43 focal dnsmasq[34825]: dnsmasq: bad option at line 1 of
/etc/dnsmasq.d/kk.conf
Nov 25 10:16:43 focal dnsmasq[34825]: bad option at line 1 of
/etc/dnsmasq.d/kk.conf
Nov 25 10:16:43 focal dnsmasq[34825]: FAILED to start up
Nov 25 10:16:43 focal systemd[1]: dnsmasq.service: Control process exited,
code=exited, status=1/FAILURE
Nov 25 10:16:43 focal systemd[1]: dnsmasq.service: Failed with result
'exit-code'.
Nov 25 10:16:43 focal systemd[1]: Failed to start dnsmasq - A lightweight
DHCP and caching DNS server.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1639452
Title:
systemd ExecStartPre test config
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1639452/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs