# Can't get WLAN to work (Edimax EW-7811Un)

## muhr

Hello

I've got an Edimax EW-7811Un WLAN dongle that I'm trying to get to work with the native kernel driver (rtl8192cu). I had it working on an earlier 32bit machine using Realtek's drivers, but now I'm on 64bit with kernel 3.0.6 and trying to use the native driver.

I get the following error when trying to start net.wlan0:

```
 * Bringing up interface wlan0

 *   Starting wpa_supplicant on wlan0 ...                                 [ ok ]

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *   Backgrounding ... ...

 * WARNING: net.wlan0 has started, but is inactive

```

My /etc/conf.d/net configuration:

```
modules_wlan0=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dnl80211"

config_wlan0=( "192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255" )

```

And /etc/wpa_supplicant/wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

update_config=1

ap_scan=1

# IBSS/ad-hoc network with WPA-None/TKIP

network={

  ssid="..."

  mode=1

  frequency=2412

  proto=WPA

  key_mgmt=WPA-NONE

  pairwise=NONE

  group=TKIP

  psk="..."

}

```

In dmesg I see the following:

```
...

rtl8192cu: MAC auto ON okay!

rtl8192cu: Tx queue select: 0x05

rtl8192c: Loading firmware file rtlwifi/rtl8192cufw.bin

ADDRCONF(NETDEV_UP): wlan0: link is not ready

...

```

In particular, all other network interfaces have at some point a line like 

```
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
```

 which is suspiciously missing for wlan0.

And finally syslog (/var/log/everything/current) gives:

```
...

Oct 07 22:37:19 [kernel] rtl8192cu: MAC auto ON okay!

Oct 07 22:37:19 [kernel] rtl8192cu: Tx queue select: 0x05

Oct 07 22:37:19 [kernel] rtl8192c: Loading firmware file rtlwifi/rtl8192cufw.bin

Oct 07 22:37:20 [wpa_cli] interface wlan0 CONNECTED

                - Last output repeated twice -

Oct 07 22:37:28 [wpa_cli] executing '/etc/init.d/net.wlan0 --quiet start' failed

...

```

Also, scanning for SSIDs does not return any results, even though other machines can find ~4 nets from the same room.

I don't know what I'm doing wrong.   :Sad: 

----------

## chithanh

Does it work if you launch wpa_supplicant manually from the command line?

```
# ifconfig wlan0 up

# iw dev wlan0 scan

# wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf
```

Wait for CTRL_EVENT_CONNECTED, then run in another terminal

```
# dhcpcd wlan0
```

If iw gives you no scan results, then maybe there is an rfkill related problem.

----------

## muhr

Thanks for the quick reply. Trying to do it manually as you suggested gives the following:

```
$ sudo ifconfig wlan0 up

SIOCSIFFLAGS: Operation not possible due to RF-kill

$ sudo rfkill unblock 0

$ sudo ifconfig wlan0 up

$ sudo iw dev wlan0 scan

$ sudo wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf   

Trying to associate with SSID '...'

CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (auth) [id=-1 id_str=]

l2_packet_receive - recvfrom: Network is down

Associated with ee:c1:b1:80:59:f0

CTRL-EVENT-CONNECTED - Connection to ee:c1:b1:80:59:f0 completed (reauth) [id=0 id_str=]

```

A few comments to that:

 When rfkill blocks the device, I cannot bring it up. I first have to unblock it using rfkill. Does rfkill have other potential influence on a net device that I don't know?

 Scanning shows no results even though there are some visible networks around.

 wpa_supplicant shows CTRL-EVENT-CONNECTED. But note that my wpa config is for an ad-hoc network. After this event, I still cannot see the new ad-hoc network from other devices and neither can I connect to it.

Unfortunately, since I'm not connected to an AP, I couldn't try out dhcpcd.

Any other ideas?

----------

## chithanh

Ad-hoc mode is usually not tested well and some drivers don't support it at all. See first if you can connect to an access point to determine whether it is a general problem or ad-hoc specific.

----------

## muhr

Ok I tried to connect to a test network using my android phone as AP. The phone can neither be seen nor connected to. Here's what I've changed

The config of wpa_suppliant:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

update_config=1

#ap_scan=1

eapol_version=1

# cell-phone AP (test)

network={

  ssid="SK17i"

  scan_ssid=1

  proto=RSN

  pairwise=CCMP TKIP

  key_mgmt=WPA-PSK

  psk="..."

}

```

Running wpa_supplicant from the console doesn't produce any output. Thus, I ran it in debug mode (switch -d):

```
$ sudo wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -d

Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'

Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group='0'

update_config=1

eapol_version=1

Priority group 0

   id=0 ssid='SK17i'

netlink: Operstate: linkmode=1, operstate=5

Own MAC address: xx:xx:xx:x:xx:x

wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=0x465333 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=0x465333 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=0x465333 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=0x465333 key_idx=3 set_tx=0 seq_len=0 key_len=0

RSN: flushing PMKID list in the driver

Setting scan request: 0 sec 100000 usec

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: Supplicant port status: Unauthorized

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: Supplicant port status: Unauthorized

EAPOL: Supplicant port status: Unauthorized

ctrl_interface_group=0

Added interface wlan0

State: DISCONNECTED -> SCANNING

Scan SSID - hexdump_ascii(len=5):

     53 4b 31 37 69                                    SK17i           

Starting AP scan for wildcard SSID

Scan requested (ret=0) - scan timeout 10 seconds

nl80211: Event message available

nl80211: Scan trigger

nl80211: Event message available

nl80211: New scan results available

Received scan results (0 BSSes)

BSS: Start scan result update 1

New scan results available

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable network found

Setting scan request: 5 sec 0 usec

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

EAPOL: disable timer tick

EAPOL: Supplicant port status: Unauthorized

Scan SSID - hexdump_ascii(len=5):

     53 4b 31 37 69                                    SK17i           

Starting AP scan for wildcard SSID

Scan requested (ret=0) - scan timeout 30 seconds

nl80211: Event message available

nl80211: Scan trigger

nl80211: Event message available

nl80211: New scan results available

Received scan results (0 BSSes)

BSS: Start scan result update 2

New scan results available

Selecting BSS from priority group 0

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable network found

Setting scan request: 5 sec 0 usec

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

```

After that, it keeps rescanning in 5sec intervals indefinitely.

Btw, the phone can be seen and connected to by my other machines.

----------

