Page 1 of 1

SOLVED: dnsmasq service failed

Posted: Wed Feb 23, 2022 4:56 am
by hemington1
Hello, I recently had a power failure and on restarting my HDA, it was unable to provide dhcp leases. I had to resort to router dhcp.
A dnsmasq status returned the following:
[******@localhost ~]$ systemctl status dnsmasq
● dnsmasq.service - DNS caching server.
Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-02-23 19:29:19 AWST; 20min ago
Process: 25637 ExecStart=/usr/sbin/dnsmasq -k (code=exited, status=2)
Main PID: 25637 (code=exited, status=2)

Feb 23 19:29:19 localhost.localdomain systemd[1]: Started DNS caching server..
Feb 23 19:29:19 localhost.localdomain dnsmasq[25637]: dnsmasq: failed to bind DHCP server socket: Addr
Feb 23 19:29:19 localhost.localdomain dnsmasq[25637]: failed to bind DHCP server socket: Address alrea
Feb 23 19:29:19 localhost.localdomain dnsmasq[25637]: FAILED to start up
Feb 23 19:29:19 localhost.localdomain systemd[1]: dnsmasq.service: Main process exited, code=exited, s
Feb 23 19:29:19 localhost.localdomain systemd[1]: dnsmasq.service: Unit entered failed state.
Feb 23 19:29:19 localhost.localdomain systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

Not sure how to fix......
Thanks in advance.

Re: dnsmasq service failed

Posted: Thu Feb 24, 2022 4:46 pm
by cpg
Interestingly, I have a Sagecom F@st 5655 device as a router.

I did notice dnsmasq not dishing out DHCP leases and it was because the router was not connected to the internet due to upstream failures. However, I am running Amahi 12 and a newer DHCP, not your case (and also, it could be my HDA's networking hardware or driver acting up.

In any case, when you mention this: failed to bind DHCP server socket: Address alrea[dy in use]

This is something that we have seen occasionally happen when people install a virtualization stack, or something (like some app) that installs the virtualization stack and this starts it's own dnsmasq, which binds to the address (often earlier than this case, for some reason).

Did you install the desktop or other software that may have pulled the virtualization stack as a dependence?

Re: dnsmasq service failed

Posted: Thu Feb 24, 2022 7:07 pm
by hemington1
Hi CPG, thanks for the reply.
Google searches were pointing in that direction, I came across an Amahi Wiki 'Virtualization Stack Breaks DNS/DHCP Server'.
Disabling libvirtd, and rebooting the server fixed the issue. Dnsmasq started and ran as intended.
I checked all dnsmasq config files and all addressed present and correct.
Pinging the router and Yahoo from the server worked.
I turned off the router DHCP and server is now issuing leases normally.
I have not installed a virtualization stack, but that's not to say my son hasn't at some point. He is always tinkering with his desktop and Raspberry Pi............
Now I know what to do if this happens again. :D
PS. Teenagers have a particular DNA strand (sometimes kept into adulthood) "Deny everything and admit to nothing".

Re: dnsmasq service failed

Posted: Fri Feb 25, 2022 1:31 am
by cpg
Aha. Glad you got it solved! :)

Unfortunately, a few things things (possibly desktop) pull in all the virt stuff and it's hard to prevent from our side.