2

So what I did was, I installed dnsmasq using the command

apt-get install dnsmasq

Now, what happens is

root@kali:~# dnsmasq
bash: dnsmasq: command not found

root@kali:~# /etc/init.d/dnsmasq start
root@kali:~# 

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

So, I typed

root@kali:~# systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-10-30 01:59:14 IST; 52s ago
  Process: 6132 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=203/EXEC)

Oct 30 01:59:14 kali systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Oct 30 01:59:14 kali systemd[6132]: dnsmasq.service: Failed to execute command: No such file or directory
Oct 30 01:59:14 kali systemd[6132]: dnsmasq.service: Failed at step EXEC spawning /usr/sbin/dnsmasq: No such file or directory
Oct 30 01:59:14 kali systemd[1]: dnsmasq.service: Control process exited, code=exited, status=203/EXEC
Oct 30 01:59:14 kali systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Oct 30 01:59:14 kali systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.

Please help.

DeshBhakt
  • 707
  • 3
  • 8
  • 14
  • Does /usr/sbin/dnsmasq exist? If not, try to reinstall it, or erase it and install it again. Look for the binary in the usual places, and put in a symlink to make it work, and complain to the provider. – stolenmoment Oct 30 '19 at 01:16
  • No it doesn't exist. I tried apt-get purge dnsmasq and then, reinstall it.. Didn't help – DeshBhakt Nov 02 '19 at 21:09
  • So, the problem is that the systemd unit file has the wrong path for the executable. Do "find / -name dnsmasq\*". If that turns up the binary, edit the dnsmasq.service file (which that should also have found). Then try to start it again. – stolenmoment Nov 04 '19 at 13:36
  • 1
    If there's no binary, then the package is utterly broken, and you should switch to a different repo, set of repos, or distro to find it. – stolenmoment Nov 04 '19 at 13:37

1 Answers1

2

The solution is to apt install dnsmasq-base and not to apt install dnsmasq.

Tested on Ubuntu 20.04.

See other posts on the differences between dnsmasq-base and dnsmasq, for example:

  1. https://help.ubuntu.com/community/Dnsmasq (first section, "Note that...")
  2. https://unix.stackexchange.com/questions/304050/how-to-avoid-conflicts-between-dnsmasq-and-systemd-resolved
  3. Ubuntu 18.04: Disable dnsmasq-base and enable full dnsmasq