I just put a freshly flashed card (with 2017-09-07-raspbian-stretch-lite) into a Raspberry Pi Zero W.

Then I added these lines:


to /etc/wpa_supplicant/wpa_supplicant.conf.

The data entered was 100% correct. I waited 10 minutes and checked: It did not connect automatically.

Then I went back to the official instructions and ran sudo wpa_cli reconfigure as suggested. Same result: It did not connect.

Then I tried to manually restart wlan0:

sudo ifconfig wlan0 down
sudo ifconfig wlan0 up

Still the same: Is does not connect.

Then I did a reboot and it instantly automatically connected.

It's soo frustrating. It feels like the official instructions aren't tested at all.

So what is missing here, how can this be done without a reboot?

  • 1
    I have also noticed this. Very frustrating! – Quintin Balsdon Oct 13 '17 at 13:49

I too saw this issue with my RaspberryPi Zero W using 2017-09-07-raspbian-stretch-lite.

Updating the wpa_supplicant.conf file, sudo wpa_cli reconfigure, and sudo systemctl restart wpa_supplicant did not work. My Pi would not get an IP on wlan0.

I noticed that wpa_supplicant is spawned as a child of the dhcpcd service.

$ sudo systemctl status

  ├─890 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0
  └─912 /sbin/dhcpcd -q -w

I found that using daemon-reload and restarting the dhcpcd.service unit worked for me.

sudo systemctl daemon-reload
sudo systemctl restart dhcpcd

It seems like you should first run sudo systemcl daemon-reload before restarting dhcpcd. I am not entirely sure why, but it seems that the daemon-reload will alert service units to config file changes.

If I restarted dhcpcd without running daemon-reload, I got this warning. Warning: dhcpcd.service changed on disk. Run 'systemctl daemon-reload' to reload units., but it restarted just fine with or without daemon-reload. So I do not think it's vital, but probably a good practice.


After adding a network in wpa_supplicant.conf:

Run the cli
(3 commands are used here: interface, reconfigure and quit)

root@raspberrypi:~# wpa_cli
wpa_cli v2.4
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

Selected interface 'p2p-dev-wlan0'

Interactive mode

> interface wlan0
Connected to interface 'wlan0.
> reconfigure
<3>Trying to associate with XX:Xa:aX:Xa:XX:Xa (SSID='wifissid' freq=2437 MHz)
<3>Associated with XX:Xa:aX:Xa:XX:Xa
<3>WPA: Key negotiation completed with XX:Xa:aX:Xa:XX:Xa [PTK=CCMP GTK=CCMP]
<3>CTRL-EVENT-CONNECTED - Connection to XX:Xa:aX:Xa:XX:Xa completed [id=0 id_str=]
> quit

Then verify that you have an IP address.

root@raspberrypi:~# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.XX.XXX  netmask  broadcast 10.10.XX.XXX
        inet6 fe80::aab2:d96e:d3ef:836d  prefixlen 64  scopeid 0x20<link>
        ether bX:XX:Xb:XX:Xe:aX  txqueuelen 1000  (Ethernet)
        RX packets 162  bytes 31128 (30.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 75  bytes 11385 (11.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

You should run this command line to restart the network

/etc/init.d/networking restart

  • 3
    Not in stretch! – MatsK Oct 14 '17 at 14:14
  • 5
    Ideally not in jessie either, since it is also systemd (not SysV) based; that command is anachronistic and at best supported for backward compatibility. – goldilocks Oct 14 '17 at 14:16

I'm using a Raspberry Pi 3 with 2018-03-13-raspbian-stretch and my issue is marginally different, but I found a solution, so I think this can help you too.

I boot the RPi with /etc/wpa_supplicant/wpa_supplicant.conf set up so that I have one SSID and password set and the RPi connects automatically to the configured SSID on boot. In addition, I wanted to change /etc/wpa_supplicant/wpa_supplicant.conf using some automated text processing script and then reload the wifi settings.

After searching around for a bit, I found this post on the official Raspberry Pi forums and found this set of commands inside that worked for me at least:

sudo dhclient -r wlan0
sudo ifdown wlan0
sudo ifup wlan0
sudo dhclient -v wlan0

I don't know how or why they work, so no guarantees...


As of 2018, the previous answers don't work anymore, you need to run the following command:

sudo wpa_cli -i wlan0 reconfigure

Source: https://www.raspberrypi.org/forums/viewtopic.php?t=198274#p1238023


You can use the NetworkManager tool, which uses nmcli commands to setup a connection profile.

Install it using apt:

sudo apt-get install network-manager

Comment out wlan and Ethernet interfaces in /etc/network/interfaces.

Reboot the device.

Then use:

sudo nmcli device wifi con "SSID" password "PSK" 

to connect to a Wi-Fi network.

  • Please don't advise to mix up another networking tool with the already three existing ones (dhcpcd, Debian networking ifupdown, systemd-networkd). Network manager isn't supported by Raspbian so you have to configure it all by hand. First it conflicts with dhcpcd and ifupdown. You do not respect it in your answer. Then in Raspbian Stretch there are no entries in /etc/network/interfaces so there is nothing to comment out. – Ingo Feb 10 at 13:28
  • Yeah you are right buddy, they conflict with network with other dhcpcd and ifupdown. But NetworkManager seems to be the only way to do this, after following above advices. Raspberry pi's raspbian lite versions have not other option than nmcli. I haven't tried it on Stretch but, during the installation Network manager itself will give the warning of conflict. If you have a solution I'm always ready to learn that method. – Rituraj Rautela Feb 11 at 8:53
  • Just with sudo systemctl stop wpa_supplicant@wlan0.service and sudo systemctl start wpa_supplicant@wlan0.service you can stop and start a WiFi connection just as you like. How to do it you can look at Setting up a Raspberry Pi as an access point - the easy way or Access point as WiFi repeater, optional with bridge or Switch between wifi client and access point without reboot or other similar solutions. – Ingo Feb 11 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.