How to disconnect wifi link, that was connected with wpa_supplicant

11,599

Solution 1

Before connecting a to a different AP you can stop the running instance of the wpa_supplicant service:

sudo killall wpa_supplicant

Configure your /etc/wpa_supplicant/connection.conf then connect through wpa_supplicant.

Solution 2

According to this you can use wpa_cli to disconnect properly by wpa_cli disconnect I used wpa_supplicant for a long time and I'm pretty sure killing the process will result in failure when you reconnect again.

Share:
11,599

Related videos on Youtube

igoryonya
Author by

igoryonya

Updated on September 18, 2022

Comments

  • igoryonya
    igoryonya over 1 year

    I connect with the following command:

    sudo wpa_supplicant -B -D nl80211 -i wlan_card -c /etc/wpa_supplicant/connection.conf
    

    It connects fine, and keeps persistent connection. If AP goes down, the connection tears, if AP gets back up, the connection comes back. If I power down the wifi interface:

    sudo ip link set wlan_card down
    

    It goes down. When I bring it up with:

    sudo ip link set wlan_card up
    

    The connection, that was launched in the very beginning with wpa_supplicant, reconnects again.

    Such stable, persistent connection is very good, but then it causes a problem, if I want to connect to a different AP.

    When I try to use wpa_cli with any command, it just gives me the following error:

    Failed to connect to non-global ctrl_ifname: (nil)  error: No such file or directory
    

    When I try to disconnect with:

    sudo iw dev wlan_card disconnect
    

    It disconnects, but reconnects right away, so, currently, I have to reserve to:

    ps -AlF|grep -i wpa
    sudo kill -KILL wpa_pid
    

    I wish to know the correct method to stop the connection, or killing is the only way?

    • GAD3R
      GAD3R almost 7 years
      can you add the output of ps -AlF|grep -i wpa ?