Wpa-supplicant is not clearing its settings when I disconnect, and is overriding iwconfig on my next connection. These settings are persisting even through reboot - the only way to get back online is to take wpa-supplicant out of the pipeline.

I disconnect using a script which includes everything I could think of:

sudo dhcpcd --release "$INTERFACE"
sudo iwconfig "$INTERFACE" essid off
sudo iwconfig "$INTERFACE" ap off
sudo ifconfig "$INTERFACE" down

This worked well until I tried to integrate wpa-supplicant in it.

My "connect" script includes these lines, which I thought would clear out any remaining settings:

sudo killall wpa_supplicant 2>/dev/null
sudo rm "/var/run/wpa_supplicant/$INTERFACE" 2>/dev/null
sudo killall dhcpcd 2>/dev/null
sudo rm "/var/lib/dhcpcd/$INTERFACE" 2>/dev/null

How do I "reset" wpa-supplicant?


I tried

wpa_cli -i "$INTERFACE" reconfigure

but that gave me

Failed to connect to non-global ctrl_ifname: wlp2s3  error: No such file or directory
  • Try wpa_action "$INTERFACE" reload
    – user.dz
    Commented Feb 7, 2014 at 0:23
  • I'm getting wpa_action: command not found.
    – operalala
    Commented Feb 7, 2014 at 0:40
  • What distribution is this? How come they don't handle this seamlessly today? Have you looked for relevant bugs, or reported it?
    – vonbrand
    Commented Feb 7, 2014 at 1:01
  • Archlinux. Their forums are actually filled with unanswered WiFi problems, but it seems there should be some way to simply reset wpa-supplicant.
    – operalala
    Commented Feb 7, 2014 at 1:05
  • A lot depends on what configuration options wpa_supplicant and dhcpcd are called with - e.g. dhcpcd -p will it not to de-configure the device on exit.
    – peterph
    Commented Feb 7, 2014 at 1:20

1 Answer 1


It seems that wpa-supplicant is not in fact retaining its settings, but instead is OVERRIDING iwconfig, and the SSID I pass to it.

When I pass a non-wpa SSID to iwconfig, dhcpcd by default invokes wpa-supplicant for all WiFi connections, then wpa-s goes down ITS list of the wpa networks I configured for it, and decides that I don't really want the open network I asked for.

Putting a "wildcard" network config into wpa-s's config file causes wpa-s to simply pick the closest open network, no matter what SSID I pass to it.

Removing the "wildcard" causes wpa-s to error out on the first (out-of-range) wpa network on the list, ignoring my SSID entirely.

This appears to be a violation of the Linux rule "do one thing and do it well" - wpa-s seems to be mission-creeping into network management, and doing the worst possible job of it imaginable!

I fixed this by adding nohook wpa_supplicant to my dhcpcd config file, and changing my "connect" script to only invoke wpa-supplicant for wpa networks.

sudo iwconfig "$INTERFACE" essid "$SSID" key "$PSK" 2>/dev/null
WPA=$(printf "$TABLE" | grep "$SSID" | cut -s -d $'\t' -f 2- | grep "WPA")
    if [[ $WPA ]]; then
        sudo wpa_supplicant -B -D wext -i "$INTERFACE" -c "$WPA_SUPPLICANT_CONFIGURATION_FILE"`
sudo dhcpcd "$INTERFACE"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .