I could connect to my router using the network manager gui on my raspberry pi without any problems. But when I try to do this using nmcli the wifi connection is unavailable (before I connected using the gui and after that). also when I start nmtui there isn't a wifi connecction. when I run nmcli dev status the output is:

wlan0  wifi      unavailable  --     

What is wrong here? I think its easier to do this using the command line.

  • What distribution are you using? Raspbian? – oh.dae.su Jul 25 '18 at 17:26
  • yes raspbian stretch – fmeier Jul 27 '18 at 12:52
  • If you edited /etc/network/interfaces manually, NetworkManager stops to manage the interface – ingroxd Jul 27 '18 at 16:08

In Raspbian, the wireless connections are normally managed by wpa_supplicant (also the GUI). Simply installing network-manager to use it is not enough as layed out in this answer, which gives you directions how to make network-manager run on Raspbian.

If you don't insist on using network-manager, give the command line tool wpa_cli of wpa_supplicant a try.

Here is how you connect to a network with wpa_cli in interactive mode (replace wlan0 with the name of your wireless interface, AP_NAME with the name of your AP, passphrase with the passphrase of the AP and 0 with the number that is printed to stdout after ADD_NETWORK):

sudo wpa_cli -i wlan0

> SET_NETWORK 0 psk "passphrase"
> quit

If you don't want to use interactive mode, you simply need to state the command following the options. See a few examples, here:

If you want to disconnect, use

sudo wpa_cli -i wlan0 DISCONNECT

To list all networks, use

sudo wpa_cli -i wlan0 LIST_NETWORKS

To remove stored network with id=0, use

sudo wpa_cli -i wlan0 REMOVE_NETWORK 0

A list of commands that can be used with wpa_cli can be found e.g. here.

  • 1
    works. but when i connect to wlan using the pa_cli interactive mode i can't change anything using the "normal" wpa_cli command line options, right? how can i delete connection or disable it in a simple way? – fmeier Jul 29 '18 at 7:00
  • 1
    you can change pretty much everything even outside interactive mode. If you want to disconnect you could use sudo wpa_cli -i wlan0 DISCONNECT. If you read up on the documentation, you can find the different options. I will update my answer shortly. – oh.dae.su Jul 29 '18 at 7:26

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.