3

I'm using Raspberry Pi 2 installed with Raspbian (Debian Wheezy) ~ Release date: 2015-02-16.

Every now and then wpa_supplicant dies on me and usually when I'm remote and I cannot do anything other then physically either reboot the Pi or start the wpa_supplicant process through the Terminal.

root@raspberrypi:~# ps ax | grep '/sbin/wpa_supplicant' | grep -v grep
 1814 ?        Ss     0:29 /sbin/wpa_supplicant -s -B -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -W -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
root@raspberrypi:~# 

Is there a service that can be (re)started in order to get it going?

Darth Vader
  • 4,218
  • 24
  • 47
  • 70
alexus
  • 337
  • 2
  • 12
  • 25

4 Answers4

5

The command to restart networking entirely, including wpa_supplicant, is this:

sudo systemctl restart networking.service

As a side note, you should be able to hit the <tab> key after you start typing the name of a service and your shell will autocomplete the name of the service, assuming you've typed in enough to make it unique. That saves you from accidentally using the name network.service which is incorrect as of Jessie, and I assume so for Wheezy. If the <tab> key didn't autocomplete at all, hit it again to see a list. If no list appears, there is no service name that starts with what you typed.

Also, wpa_supplicant might not be crashing if your only symptom is that your Pi disconnects from Wifi and doesn't reconnect. Make sure your /etc/network/interfaces file includes a line allow-hotplug wlan0 right before the wlan0 interface. It's the default on Jessie, I'm not sure about Wheezy. Sometimes you'll lose your connection due to interference and the Pi won't reconnect if it isn't configured to.

This answer is intended to help anyone who might stumble across it in the future, since the original question is a few months old now and it's author might not need the answer now.

Jon Musselwhite
  • 794
  • 5
  • 17
3

2020 and buster =>

wpa_cli -i wlan0 reconfigure

... assuming it's using wifi on wlan0 as per iwconfig

1

systemd was included in Debian Wheezy, So you can use the following command to restart the network:

systemctl restart network.service

or

systemctl restart networking.service
GAD3R
  • 472
  • 3
  • 8
-1

You could use sudo ifdown wlan0 followed by sudo ifup wlan0 to bring the network back up.
Then use ifconfig wlan0 to check if you got an IP assigned.

thibmaek
  • 289
  • 6
  • 19