Enjoy Slackware 15.0!

Welcome to the Slackware Documentation Project

This is an old revision of the document!

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 you 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. Try running 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, but before doing so,
you should ideally have another machine like a laptop or a tablet available so you can keep reading this documentation or other sources online while troubleshooting.

After booting, log back in as a regular user and make yourself root again.

Next, you need to ensure that wpa_supplicant is not currently running. Try this command:

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

This means you need to kill the wpa_supplicant process. Try this:

kill (process id number)

In this case the process id or pid for wpa_supplicant is 1337. So you would do:

kill 1337

Next, you will be editing 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.

Now you start wpa_supplicant from the command line. Try:

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.

Next run wpa_cli from the command line:


It should start up and report that wpa_supplicant is running.

Now you are going to go through a series of wpa_cli commands in order to configure your wireless setup. Wait 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. Finally, you should remove the update_config line from wpa_supplicant.conf
Open the file with your text editor:

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.

The last step is to run dhcpcd. Run this command:

dhcpcd wlan0

That should get you online. Now you if you want to automate this so it happens automatically each time your system boots up,
just open your text editor add the wpa_supplicant line to /etc/rc.d/rc.local:

vim /etc/rc.d/rc.local

in your editor add:

wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf

Save your changes. Logout of your superuser session using Ctrl-D or exit.
You should be all set. Enjoy having wireless outside of X and in your window manager of choice.


* Original source for some content: https://wiki.archlinux.org/index.php/WPA_supplicant * Originally written by User slackwood

In Other Languages
Translations of this page?:
QR Code
QR Code howtos:misc:wireless_with_wpa_cli (generated for current page)