TL;DR. I need to get to the bottom of:

  1. why there are errors related to ioctl when using wext driver,
  2. why I'm not able to use nl80211 driver.

When running wpa_supplicant I get weird errors (note lines starting with ioctl below):

$ sudo wpa_supplicant -D wext -i wlan0 -c wpa_supplicant.conf
Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with 04:8d:38:59:2d:63 (SSID='netis' freq=2457 MHz)
wlan0: Association request to the driver failed
wlan0: Associated with 04:8d:38:59:2d:63
wlan0: WPA: Key negotiation completed with 04:8d:38:59:2d:63 [PTK=CCMP GTK=TKIP]
wlan0: CTRL-EVENT-CONNECTED - Connection to 04:8d:38:59:2d:63 completed [id=0 id_str=]

I need to get to the bottom of why there are ioctl errors.

A few notes:

  • my goal here is learning; I want to get rid of the errors, even if that means submitting a patch to wpa_supplicant, to Raspbian, or to linux kernel/driver itself,
  • there is no problem with WiFi; it's working; I do get the internet connection with the output above, there's no problem with that,
  • if it's impossible to get rid of errors in my case, I'd like to understand why is that exactly,
  • I haven't tried to test against most up-to-date stable & RC versions of linux kernel; looking for evidence (a commit in linux kernel repo?) that I'll help before diving into compiling my own kernel,
  • I have found the errors in the source code, here and here respectively. Not sure where to go from there.

What I've learned so far

  1. Running wpa_supplicant with nl80211 is not working at all:

    $ sudo wpa_supplicant -D nl80211 -i wlan0 -c wpa_supplicant.conf
    Successfully initialized wpa_supplicant
    nl80211: Driver does not support authentication/association or connect commands
    wlan0: Failed to initialize driver interface

    Why not? I thought nl80211 is superior to wext:

    Is WE being further developed? No it is not. Only bug fixes are being accepted for WE.

    What is Wireless-Extensions' replacement? New development should be focused on cfg80211 and nl80211.


  2. According to this list, my device RTL8188CUS is supported by driver 8192cu, which is loaded as a kernel module (see below),

  3. Compiling and running wpa_supplicant version 2.5 yields the same ioctl errors.

About my environment

Stock version of wpa_supplicant:

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

Contents of wpa_supplicant.conf:

$ cat wpa_supplicant.conf 

List of USB devices:

$ lsusb
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Distro version:

$ uname -a
Linux raspberrypi 4.1.18+ #846 Thu Feb 25 14:11:56 GMT 2016 armv6l GNU/Linux

Loaded kernel modules:

$ lsmod
Module                  Size  Used by
cfg80211              479279  0 
rfkill                 21508  1 cfg80211
8192cu                556175  0 
bcm2835_gpiomem         3703  0 
snd_bcm2835            22502  0 
bcm2835_rng             2207  0 
snd_pcm                92829  1 snd_bcm2835
snd_timer              22164  1 snd_pcm
snd                    67534  3 snd_bcm2835,snd_timer,snd_pcm
uio_pdrv_genirq         3526  0 
uio                    10078  1 uio_pdrv_genirq
ipv6                  358702  24

Contents of ifconfig:

$ ifconfig
eth0      (...omitted for brevity...)

lo        (...omitted for brevity...)

wlan0     Link encap:Ethernet  HWaddr 00:f1:40:41:03:a7  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::c085:fb91:3e68:a44d/64 Scope:Link
          RX packets:38 errors:0 dropped:61421 overruns:0 frame:0
          TX packets:62 errors:0 dropped:4 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19804518 (18.8 MiB)  TX bytes:1192972 (1.1 MiB)

Update 10/8/2016: Per suggestion from Rui F Ribero below, I tried using unofficial drivers. Results:

  1. This error: ioctl[SIOCSIWENCODEEXT]: Invalid argument is now gone! However ioctl[SIOCSIWAP]: Operation not permitted is still present.

  2. wpa_supplicant still won't work with now-unofficial nl80211 driver. Only this time output has a new message starting with deinit:

    $ sudo ./wpa_supplicant -D nl80211 -i wlan0 -c wpa_supplicant.conf
    Successfully initialized wpa_supplicant
    nl80211: Driver does not support authentication/association or connect commands
    nl80211: deinit ifname=wlan0 disabled_11b_rates=0
    wlan0: Failed to initialize driver interface
  • you compiled/installed a custom a kernel module/the wifi driver, right? – Rui F Ribeiro Mar 9 '16 at 17:39
  • @RuiFRibeiro, no, I used stock kernel / modules from latest raspbian distribution, from Feb 26th – raspberrypi.org/downloads/raspbian – gmile Mar 9 '16 at 17:43

The cheap Realtek wifi firmware, linux kernel drivers and the hardware itself are terribly buggy.

People in the ARM community have been working around the clock to try to mitigate some of the problems, back porting old versions of realtek kernel modules and old versions of hostapd, and often old versions of firmware too.

One of the drivers backported for your chip is at https://github.com/pvaret/rtl8192cu-fixes and this thread talks about installing it.

Please also read my related answer: Wi-Fi problems using ASUS USB-N13 adapter and the related thread in the armbian forum that I refer there. Lamobo-R1 wifi unstable in AP ("host") mode - better buy a good wifi dongle with proper linux support

I have a compatible raspberry machine and a realtek chip, too. Forget using your chip for AP services, it is a world of pain. As a wifi client, it will have its problems too.

I advise buying a ralink dual frequency 2.4GHz/5GHz for around 10USD at aliexpress, and be done with it. http://www.aliexpress.com/item/Dual-Band-5GHz-2-4GHz-300Mbps-USB-Wireless-WiFi-WLAN-Network-Card-Adapter-IEEE-802-11a/32455426779.html

| improve this answer | |
  • Hey @RuiFRibeiro, thanks for response! I tried installing github.com/pvaret/rtl8192cu-fixes. Here's what I got: I still can't use wpa_supplicant with nl80211 driver... As to the wext errors, I now see ioctl[SIOCSIWENCODEEXT] errors gone entirely, while ioctl[SIOCSIWAP] error is still there. – gmile Mar 10 '16 at 19:28
  • 1
    Have a look at the armbian thread. in my post I am downloading a file that are the wpa_supplicant source files from realtek. You may have to recompile it too. (in my case I am only going to a subdirectory to get the hostpad ) e.g. as you are downgrading the driver, you might have to downgrade the components above. – Rui F Ribeiro Mar 10 '16 at 19:31
  • Hey @RuiFRibero, thanks again for pointing to that thread. I just finished reading it, and got an impression it mostly concerns creating AP out of WiFi dongle? That's not what I'm aiming at. Nevertheless, I learned that there's a new Realtek driver in development, here: marc.info/?l=linux-wireless&m=144486995128902 So I hope in future we'll get a more cleaner / universal driver. Meanwhile, I'll try to upgrade my raspbian's 4.1 kernel to 4.4 and see if it help me in any way. I really enjoyed a discussion about drivers at lower level there, so thank you again! – gmile Mar 11 '16 at 12:30
  • Yes, for an AP, but if you notice the file I am getting is the wpa_supplicant source code from realtek, and I am just compiling a specific part, hostapd. Hence why I directed you to it. Thanks for the link; the driver seems very basic yet...let´s hope they get around to it. – Rui F Ribeiro Mar 11 '16 at 13:24
  • I compiled new kernel 4.4 with rewritten Realtek driver, and now can't connect to wlan0 at all. Any ideas? unix.stackexchange.com/questions/270469/loading-new-wlan-driver – gmile Mar 17 '16 at 15:32

Install dkms Download the fixed:

 git clone https://github.com/pvaret/rtl8192cu-fixes.git

Setup the DKMS module (as root):

dkms add ./rtl8192cu-fixes

Build and install it (as root):

 dkms install 8192cu/1.9

Update the modules list:

 depmod -a

Blacklist the kernel module and disable the power saving:

 echo "blacklist rtl8192cu" > /etc/modules.d/8192.conf 
 echo "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0" >> /etc/modules.d/8192cu

Unload the old driver and load the fixed driver:

 rmmod rtl8192cu rtl_usb rtlwifi rtl8192c_common 
 modprobe 8192cu
| improve this answer | |
  • hey @GAD3R, thanks for response! Before I do all of the above: are we on the same page regarding that I do have working internet through WiFi, and what I'm targeting here is specifically get rid of harmful errors as mentioned in my post? – gmile Mar 10 '16 at 19:44

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.