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. – goldilocks Aug 18 '16 at 13:07sudo systemctl list-units | grep dnsto see if it is being run by systemd, in which case removing the links toinit.dwas not effective. I'm not sure why it would work out that way, but I believe it could. – goldilocks Aug 18 '16 at 13:25but it did not work
– tibi Aug 18 '16 at 15:07systemctl status dnsmasq. I think there can be services that it won't truly be disabled if other things start them for whatever reason. Usingsystemd-analyze critical-chain dnsmasq.servicemight help with that, but more likely it could confirm if something you suspect is starting dnsmasq actually does (such asdhcp.serviceor whatever it is called; you need to use the full name with suffix as shown insystemclt list-unitswithcritical-chain; with no argument it just shows the default target which is not the whole picture). – goldilocks Aug 18 '16 at 15:15systemd-analyze critical-chain foobarwill mentiondnsmasqiffoobarstartsdnsmasq, but unfortunatelysystemd-analyze critical-chain dnsmasqprobably won't tell you what started it, meaning you have to guess, or find a "critical chain" that includes both of them... – goldilocks Aug 18 '16 at 15:18