[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Configuring Wireless With wpa_cli

This article is for folks who are choosing not to use NetworkManager for their wireless.
If you are running FluxBox or some other lightweight window manager, you may find it useful to configure wireless in the manner described below.
If you are interested in having wireless internet without having to run X at all, this article may also be of interest.

  • Make sure that NetworkManager is turned off.
    Open your favorite terminal emulator, and make yourself root.
    Then try this command in bash:
    chmod 644 /etc/rc.d/rc.networkmanager
  • rc.wireless should also be turned off.
    Run these commands:
    chmod 644 /etc/rc.d/rc.wireless
    chmod 600 /etc/rc.d/rc.wireless.conf
  • You might want to restart your machine at this point.
    (Before doing so, you should ideally have another machine like a laptop or a tablet available so you can keep reading this documentation.)
  • After booting, log back in as a regular user and make yourself root again.
  • Check to ensure that wpa_supplicant is not currently running:
    ps aux | grep wpa

You may get back something like:

root      1337  0.0  0.0  28268  1468 ?        Ss   14:23   0:00 wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf
root      4146  0.0  0.0   7136   968 pts/1    S+   16:53   0:00 grep wpa
  • In this case the process id or pid for wpa_supplicant is 1337.
  • This means you need to terminate the wpa_supplicant process:
    wpa_cli terminate
  • Edit wpa_supplicant.conf with your text editor. The command with vim is:
    vim /etc/wpa_supplicant.conf

It needs to look like:


Change it to that, removing all other lines and save it.

  • Start wpa_supplicant from the command line:
    wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf

This will work for most people. There are other driver options like nl80211, but I have not had good luck with them.

wpa_supplicant should start up successfully. If you get a message about an RFKILL error you can probably ignore it.

  • Run wpa_cli from the command line:

It should start up and report that wpa_supplicant is running.

  • Now configure your wireless setup, waiting a little between each command:

scan should return OK and scan_results should list your wireless router after a short wait.

  • If all is well, then continue.
    set_network 0 ssid "Your_Wireless_SSID_Here"
    set_network psk "Your_Password_Here"

add_network should return 0. If it returns some other number you may want to run “remove_network” on the numbers below the returned value and start over.

If you only have one wireless network, it really should be network zero.

  • store your new setup to the wpa_suppilcant.conf file:

The last command should save your config and return OK. If it says FAIL you may have a driver issue or have mistyped something in your wpa_supplicant startup command.
You can now quit wpa_cli by typing “quit” and hitting enter.

  • Remove the update_config line from wpa_supplicant.conf:
    vim /etc/wpa_supplicant.conf

Just remove “update_config=1” from the file.
Your SSID and the password should now be written into the config file.

  • Run dhcpcd:
    dhcpcd wlan0

That should get you online.

  • To automate this so it happens each time your system boots up:
  • Open your text editor:
    vim /etc/rc.d/rc.local
  • add these two lines:
    wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf
  • Save your changes.
  • Log out of your superuser session using Ctrl-D or exit.
  • Enjoy having wireless outside of X and in your window manager of choice.


 howtos:misc:wireless_with_wpa_cli ()