WPA2: (presharedkey = PSK)

a lot of guides out there are incomplete.

it is not easy – you will have to perform a combination of steps.

this was successfully tested on DELL Latitude E4310 with Debian 8.7 “Jessie”

su -  root; # become root and simulate a full login
apt update;
apt install wireless-tools wpasupplicant;
apt install net-tools; # optional but recommended legacy network config tools

# -1. what is your wifi adapter called?
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11abgn  ESSID:"FRITZ!Box 7490"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: 24:65:XX:XX:XX:XX
          Bit Rate=1 Mb/s   Tx-Power=15 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=51/70  Signal level=-59 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:8   Missed beacon:0

# wifi adapter is 'wlan0'

# if nic/wifi is down
# bring up like this
# (optional: when AccessPoint SSID and password is known
# (simply continue the tutorial and wpa_supplicant will bring up 
# (the interface automatically)
ip link set dev wlan0 up
# 0. scan for available wlan/wifi accesspoints
iwlist scan
lo        Interface doesn't support scanning.

eth0      Interface doesn't support scanning.

wlan1     Scan completed :
          Cell 01 - Address: 24:65:11:XX:XX:XX
                    ESSID:"FRITZ!Box 7490"
                    Protocol:IEEE 802.11bgn
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                              48 Mb/s; 54 Mb/s
                    IE: IEEE 802.11i/WPA2 Version 1

# you will see a list of reachable WIFI/WLAN networks, take note of the ESSID that you want to connect to (and have the password for)

# 1. checkout what drivers to use
wpa_supplicant; # run this without anything and you will get a little help

Successfully initialized wpa_supplicant
wpa_supplicant v2.3
Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi> and contributors

This software may be distributed under the terms of the BSD license. 
See README for more details.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)

  wpa_supplicant [-BddhKLqqstuvW] [-P] [-g] \
        [-G] \
        -i -c [-C] [-D] [-p] \
        [-b] [-e] [-f] \
        [-o] [-O] \
        [-N -i -c [-C] [-D] \
        [-m] \
        [-p] [-b] [-I] ...]

  nl80211 = Linux nl80211/cfg80211
  wext = Linux wireless extensions (generic)
  wired = Wired Ethernet driver
  none = no driver (RADIUS server/WPS ER)

# so the available drivers are: nl80211, wext, try both

# 2. generate config file
wpa_passphrase 'FRITZ!Box 7490' '466253308656XXXXXXXX' > /etc/wpa_supplicant/example.conf

# SSID = 'FRITZ!Box 7490'

# 3. try to connect with driver nl80211

wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant/example.conf

# if that does not result into:

tail -f /var/log/message; # might help to debug the problem or at least give some clue what is happening

May  2 23:15:28 debian kernel: [  339.004059] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled
May  2 23:15:28 debian kernel: [  339.010788] iwlwifi 0000:02:00.0: Radio type=0x1-0x3-0x1
May  2 23:15:28 debian kernel: [  339.223461] iwlwifi 0000:02:00.0: L1 Enabled - LTR Disabled
May  2 23:15:28 debian kernel: [  339.230173] iwlwifi 0000:02:00.0: Radio type=0x1-0x3-0x1
May  2 23:15:29 debian kernel: [  339.323003] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
May  2 23:15:32 debian kernel: [  342.661605] wlan0: authenticate with 24:65:XX:XX:XX:XX
May  2 23:15:32 debian kernel: [  342.693830] wlan0: send auth to 24:65:XX:XX:XX:XX (try 1/3)
May  2 23:15:32 debian kernel: [  342.696979] wlan0: authenticated <------ HURRAY!
May  2 23:15:32 debian kernel: [  342.697142] wlan0: waiting for beacon from 24:65:XX:XX:XX:XX
May  2 23:15:32 debian kernel: [  342.779710] wlan0: associate with 24:65:XX:XX:XX:XX (try 1/3)
May  2 23:15:32 debian kernel: [  342.785382] wlan0: RX AssocResp from 24:65:XX:XX:XX:XX (capab=0x431 status=0 aid=3)
May  2 23:15:32 debian kernel: [  342.793869] wlan0: associated
May  2 23:15:32 debian kernel: [  342.793914] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
May  2 23:15:32 debian kernel: [  342.793986] cfg80211: Calling CRDA to update world regulatory domain

# 4. try wext driver
wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant/example.conf

# 5. ifconfig might show an ip6 address now already, but one might also need an ipv4 address
dhclient wlan0; # try to get ipv4 address assigned from dhcp-wifi-router

ping yahoo.com; # should work now :)
PING yahoo.com ( 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com ( icmp_seq=1 ttl=49 time=162 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com ( icmp_seq=2 ttl=49 time=162 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com ( icmp_seq=3 ttl=49 time=163 ms

network manager problems:

GUI network manager problems are frequent on Linux.

If one decides to manage networks manually via terminal and /etc/ interfaces

one should disable/uninstall the network manager (because it will interfere otherwise and under Debian 10 disconnect via terminal established connections)

# remove network manager
# (will reset one's connection every x minutes = connection lost)
apt-get --purge remove network-manager;
apt-get --purge remove network-manager-gnome;
apt-get clean;

Packages involved:

wireless-tools – This package contains the Wireless tools, used to manipulate the Linux Wireless Extensions. The Wireless Extension is an interface allowing you to set Wireless LAN specific parameters and get the specific stats.

wpasupplicant – WPA and WPA2 are methods for securing wireless networks, the former using IEEE 802.1X, and the latter using IEEE 802.11i. This software provides key negotiation with the WPA Authenticator, and controls association with IEEE 802.11i networks.


1. become root by su or sudo bash

2. ifconfig wlan0 up

3. iwlist wlan0 scan

scans for available betworks

4. iwconfig wlan0 essid AccessPointName

if it is encrypted wifi
iwconfig wlan0 essid AccessPointName key s:YourWifiPassword


With this in mind it’s crucially important to point out that iwconfig does not support WPA/WPA2 negotiation & authentication when connecting to a wlan network. That is to say the only wifi networks you can connect to with iwconfig are open unencrypted networks and WEP enabled networks.

Now the reason you’re getting this strange error:

Error for wireless request "Set Encode" (8B2A) :
    SET failed on device wlan0 ; Invalid argument.

is because iwconfig is expecting a WEP-key for the key: parameter. Because of the way WEP works, this key has to meet one of these conditions:

  • ascii string that’s exactly 5 characters in length
  • ascii string that’s exactly 13 characters in length
  • hexidecimal string that’s exactly 10 characters in length
  • hexidecimal string that’s exactly 26 characters in length


wifi connection problems under Debian 10 Buster – SME Deauth request to the driver failed on Debian 10 MATE Gnome2 Desktop network-manager-gnome