2

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)

tibi
  • 131
  • 1
  • 4
  • "is there a way to find out what is starting dsnmasq?" -> You should investigate systemd-analyze critical-chain. – goldilocks Aug 18 '16 at 13:07
  • i updated my question and will try systemd-analyze – tibi Aug 18 '16 at 13:17
  • You could also check sudo systemctl list-units | grep dns to see if it is being run by systemd, in which case removing the links to init.d was not effective. I'm not sure why it would work out that way, but I believe it could. – goldilocks Aug 18 '16 at 13:25
  • i added the os version (sorry for that). – tibi Aug 18 '16 at 15:06
  • i tried to remove the service like this: systemctl disable dnsmasq.service

    but it did not work

    – tibi Aug 18 '16 at 15:07
  • Since it evidently has a service file, have a look at systemctl status dnsmasq. I think there can be services that it won't truly be disabled if other things start them for whatever reason. Using systemd-analyze critical-chain dnsmasq.service might help with that, but more likely it could confirm if something you suspect is starting dnsmasq actually does (such as dhcp.service or whatever it is called; you need to use the full name with suffix as shown in systemclt list-units with critical-chain; with no argument it just shows the default target which is not the whole picture). – goldilocks Aug 18 '16 at 15:15
  • Lemme try that one again: systemd-analyze critical-chain foobar will mention dnsmasq if foobar starts dnsmasq, but unfortunately systemd-analyze critical-chain dnsmasq probably 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

1 Answers1

1

it seems to work now. not 100% what did the trick but i think there were 2 dnsmasq.service files. i removed one and again did the systemctl disable dnsmasq and now it does not start at startup.

tibi
  • 131
  • 1
  • 4
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Dec 16 '19 at 16:12