1

After I try to kill a process (speaking of NetworkManager, wpa_supplicant, dhclient) like this kill -9 PID (also tried -1 and -15), it reruns automatically...

How can I kill it and prevent it from respawning?

Byte Commander
  • 107,489
Vladimir
  • 121
  • What process are you trying to kill exactly? This respawning behaviour is not what processes normally do when they receive the SIGKILL (9) signal, it's specific to only e.g. some very special services. – Byte Commander Jan 26 '17 at 22:22
  • I trying to kill NetworkManager, wpa_supplicant, dhclient – Vladimir Jan 26 '17 at 22:24
  • I guess you're trying to run airmon-ng? Note that it might work even with those processes running. It just always prints that warning that some process might possibly cause problems. Try without killing them, if it works, you can leave it like that. Anyway, those processes are somehow configured to automatically respawn on exit, but I unfortunately don't remember exactly why and how to stop that... – Byte Commander Jan 26 '17 at 22:40

1 Answers1

0

kill -9 is a bad idea in general, since it doesn't allow the program to clean up after itself and because, as you've seen, it can sometimes be taken by the system as an unexpected crash that should be fixed by restarting what you killed.

You can achieve what you want with the following:

sudo service NetworkManager stop
sudo service wpa_supplicant stop

Note that stopping NetworkManager also stops dhclient. To restart them, use the following:

sudo service wpa_supplicant start
sudo service NetworkManager start
Chai T. Rex
  • 5,193