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 B
    Commented Oct 13, 2017 at 13:49

8 Answers 8


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

  • 4
    work like magic on Pi4 ! Thanks!
    – Mike Yan
    Commented Apr 2, 2020 at 3:19
  • 2
    works perfectly on Pi3 with wifi-to-wifi-bridge (on Raspbian GNU/Linux 10 (buster))
    – Wumms
    Commented Jun 26, 2020 at 8:54
  • 2
    works also for Pi0w (buster)!
    – Rougher
    Commented Jan 8, 2021 at 5:16

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.

  • 1
    This works and is the correct solution. But, for anyone who wants to do dual mode wifi (i.e. Raspberry pi hosting a hotspot as well as acting as a base station) please note that this will not work. If you are setting up dual mode wifi, follow this guide here: raspberrypi.stackexchange.com/questions/89803/…. Assuming that you have done the configuration as per this guide, and want to get things running without reboot; just run sudo systemctl restart [email protected] followed by sudo systemctl daemon-reload Commented Feb 24, 2020 at 5:34
  • 1
    daemon-reload may not be needed, as no systemd unit files were modified. If someone tries this procedure without a daemon reload please post your results
    – Brad Hein
    Commented Aug 14, 2020 at 15:21
  • 1
    It doesn't work for me on RaspberryPi Zero W (buster)
    – Rougher
    Commented Jan 8, 2021 at 5:17
  • 1
    systemctl restart wpa_supplicant.service and systemctl restart dhcpcd.service did the trick for me on Buster
    – MLu
    Commented Feb 3, 2021 at 21:49
  • this worked sudo systemctl daemon-reload sudo systemctl restart dhcpcd
    – VextoR
    Commented Mar 26, 2023 at 2:02

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...

  • This is the only answer that worked for me, also on Pi3 with raspian stretch - thanks!
    – smörkex
    Commented May 29, 2019 at 5:20
  • this worked for me too, except that I had to use sudo ifconfig wlan0 up/down instead of ifdown wlan0, because that gave some errors
    – Ahmed
    Commented Dec 24, 2021 at 15:22

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 <[email protected]> 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
  • this got it for me. tyvm
    – catbadger
    Commented Nov 24, 2021 at 10:32

You should run this command line to restart the network

/etc/init.d/networking restart

  • 3
    Not in stretch!
    – MatsK
    Commented Oct 14, 2017 at 14:14
  • 6
    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
    Commented Oct 14, 2017 at 14:16
  • No, it doesn't work. You must reconfigure wpa supplicant and restart dhcpcd Commented Sep 30, 2019 at 17:48

I had similar problem with Raspbian GNU/Linux 10 (buster). I made changes in wpa_supplicant.conf and run

# wpa_cli -i wlan0 reconfigure

But it did not work all the way.

# dhclient -v

made it work.

I found info at https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhclient

Output from

$ sudo dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/a0:f3:c1:26:04:9c
Sending on   LPF/wlan0/a0:f3:c1:26:04:9c
Listening on LPF/eth0/b8:27:eb:1f:ab:6e
Sending on   LPF/eth0/b8:27:eb:1f:ab:6e
Sending on   Socket/fallback
DHCPREQUEST for on wlan0 to port 67
DHCPDISCOVER on eth0 to port 67 interval 4
DHCPACK of from
RTNETLINK answers: File exists
bound to -- renewal in 1717 seconds.

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
    Commented Feb 10, 2019 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. Commented Feb 11, 2019 at 8:53
  • Just with sudo systemctl stop [email protected] and sudo systemctl start [email protected] 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
    Commented Feb 11, 2019 at 18:44
  • 1
    A very valid point by @Ingo. Just to add - if you are using Node.js, and want to do things using npm packages, check the documentation thoroughly. Most of the npm packages use nmcli in the background which does not work on Raspberry pi. It is not even installed. So, please proceed with caution. Commented Feb 24, 2020 at 7:08
  • It's indeed possible to use network-manager (or wicd or any other networking tool for that matter) on Raspbian. It would be useful however if you described how to set them up. Commented Feb 24, 2020 at 7:28


I landed up on this answer with my Raspberry pi Zero W configured as a dual mode wifi and I wanted to change the wifi credentials (wifi router that wlan0 must connect to) by sharing them over the ap0 interface (which had a REST API hosted on it) with a mobile app.

The thing is I assumed that the accepted answer or any other answers will work in my case. But that was not the case.

So, for anyone who has landed here just like me, please follow the setup steps mentioned here.

Then, for a change in wifi connection without reboot, I am currently testing with 2 ways:

  1. wpa_cli -i wlan0 reconfigure
  2. sudo systemctl restart [email protected]

Once the tests are done, I will be updating it here.

  • I am currently in the process of testing things. Will keep this updated. Commented Feb 24, 2020 at 7:09
  • i'm in the same situation (dhcpcd has started wpa_supplicant via hook)... whatever i try i always end up with "Association requets to driver failed" or "failed to enable fw supplicant" with "wap_cli" after restarting dhcpcd "wpa_cli" works but the AP is inaccessible. I teste new and old wifi firmware so i assume wpa_supplicant is somehow broken (and not it only runs one wpa service).
    – delijati
    Commented Mar 4, 2021 at 14:00
  • Ok i switched the solution [systemd] (raspberrypi.stackexchange.com/questions/89803/…) solution. Only calling wap_cli -i wlan0 reconfigure works. But sometimes the AP hangs after changing wlan0. But so far it is the best solution on 2021-01-11-raspios-buster-armhf-lite
    – delijati
    Commented Mar 4, 2021 at 16:08
  • The hangs of AP were unbearable. I think AP+Client via hostap and /sbin/iw dev wlan0 interface add ap@wlan0 type __ap is simply not working. I hope someone can prove me wrong. I ended up using a cheap 2€ wifi dongle systemd-networkd + 2x wpa_supplicant -> wlan0 (client) and wlan1 (AP). That makes also wpa_cli ... reconfigure work like a charm
    – delijati
    Commented Mar 9, 2021 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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