I have dnsmasq installed to make my Pi 3 with Raspbian GNU/Linux 8.0 (jessie) into an AP (accesspoint). I want to be able to switch between AP mode and client mode.
This all works fine, but when I boot my pi3 dsnmasq will startup, which I do not want (only for the AP mode).
I removed all links to /etc/init.d/dnsmasq
from /etc/rc*.d
but it still starts. I set ENEABLED=0
in /etc/default/dnsmasq
but it still starts.
I run systemctl disable dnsmasq.service but it still starts.
Only when I add exit 0 to the start of the /etc/init.d/dnsmasq it will not start, but than I can not start it myself.
So a work arround is changing the script removing the exit 0 start it and than adding the exit 0 to the script again. But this seems not the most elegant way of doing this.
is there a way to find out what is starting dnsmasq?
edit:
i have removed the dnsmasq.service from the service dir:
rm /etc/systemd/system/multi-user.target.wants/dnsmasq.service
but still dnsmasq is started:
ps aux | grep dnsmasq
/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
to answer the question in the comment:
systemctl list-units | grep dns
dnsmasq.service loaded active running dnsmasq - A lightweight DHCP and caching DNS server
after disable with systemctl:
root@raspberrypi:/home/pi# systemctl disable dnsmasq
Synchronizing state for dnsmasq.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d dnsmasq defaults
insserv: warning: current start runlevel(s) (empty) of script `dnsmasq' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `dnsmasq' overrides LSB defaults (0 1 6).
insserv: script dnsmasq_run: service dnsmasq already provided!
insserv: script dnsmasq_exit: service dnsmasq already provided!
Executing /usr/sbin/update-rc.d dnsmasq disable
insserv: warning: current start runlevel(s) (empty) of script `dnsmasq' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `dnsmasq' overrides LSB defaults (0 1 6).
insserv: script dnsmasq_run: service dnsmasq already provided!
insserv: script dnsmasq_exit: service dnsmasq already provided!
there has been a question alike this one (Disabling DHCP Server)
systemd-analyze critical-chain
.sudo systemctl list-units | grep dns
to see if it is being run by systemd, in which case removing the links toinit.d
was not effective. I'm not sure why it would work out that way, but I believe it could.