# wpa_supplicant help

## Zerodark

Ok, I am having a hell of a time trying to get my wifi connected. I have a Linksys AE1000 USB wifi dongle and have finally got it to show up as wlan0 but can't seem to connect to anything. Here is some info on what is going on:

```
Undercity xerodark # ifconfig

eth0      Link encap:Ethernet  HWaddr 6c:f0:49:5c:fb:bf  

          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::6ef0:49ff:fe5c:fbbf/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:4803 errors:0 dropped:0 overruns:0 frame:0

          TX packets:4604 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:2603986 (2.4 MiB)  TX bytes:744249 (726.8 KiB)

          Interrupt:43 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:59 errors:0 dropped:0 overruns:0 frame:0

          TX packets:59 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:4868 (4.7 KiB)  TX bytes:4868 (4.7 KiB)

wlan0     Link encap:Ethernet  HWaddr 68:7f:74:89:a8:48  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

```

```

Undercity xerodark # iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11abgn  ESSID:off/any  

          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   

          Retry  long limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:on

```

wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

update_config=1

network={

        ssid="<my_ssid>"

        psk="<my_psk>"

        proto=WPA

        key_mgmt=WPA-PSK

        pairwise=CCMP

        auth_alg=OPEN

        priority=2

}

```

and /etc/conf.d/net

```

modules=("dhcpcd wpa_supplicant")

config_wlan0=("dhcp")

wpa_supplicant_wlan0="-Dwext"

wpa_timeout_wlan0=15

dhcpcd_wlan0="-t 10"

dhcp_wlan0="nonis"

```

When I do wpa_cli status this is all I can get. I can't get it to do anything other than scan.

```

Undercity xerodark # wpa_cli status

Selected interface 'wlan0'

wpa_state=SCANNING

```

I have been messing around with this for a couple days and just can't seem to get it figured out. Any help would be greatly appreciated. If any other information is needed, I would be happy to provide that. Thank you.Last edited by Zerodark on Thu Dec 15, 2011 6:15 pm; edited 1 time in total

----------

## mikegpitt

There's a chance your proto line is off and that you need to add a group line for the encryption types... but I would recommend just running wpa_gui (assuming you have X running) and letting it automatically configure your device.

----------

## Zerodark

I have tried wpa_gui. The adapter and network boxes look fine, however in the current status box, the status never changes from scanning.

----------

## mikegpitt

If you are using baselayout-2, it looks like your /etc/conf.d/net syntax is a little off... try this instead:

```

config_wlan0="dhcp"

modules="wpa_supplicant" 

wpa_supplicant_wlan0="-Dwext" 

wpa_timeout_wlan0=15 
```

I removed the nonis line... you should be able to leave it in, but for now try with a more generic config.  I also removed the dhcpcd options for now.

When you are done making those edits run `/etc/init.d/net.wlan0 restart`.

If the status still only says scanning, try this:

```

wpa_cli SCAN

wpa_cli SCAN_RESULTS

wpa_cli LIST_NETWORKS           (lists all networks in config file)

wpa_cli SELECT_NETWORK <num>    (connect to network <num> in config file -- make sure to use the number here and not the essid)

```

----------

## Zerodark

I changed the syntax but that didn't help any. When I restarted net.wlan0 I get the same results as if I left the syntax errors:

```

Undercity xerodark # /etc/init.d/net.wlan0 restart

 * Bringing down interface wlan0

 *   Removing addresses

 *     Stopping wpa_cli on wlan0 ...                                      [ ok ]

 *     Stopping wpa_supplicant on wlan0 ...                               [ ok ]

 * 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

```

 I ran all the commands you mentioned, these were the results:

```

Undercity xerodark # wpa_cli scan

Selected interface 'wlan0'

OK

Undercity xerodark # wpa_cli scan_results

Selected interface 'wlan0'

bssid / frequency / signal level / flags / ssid

Undercity xerodark # wpa_cli list_networks

Selected interface 'wlan0'

network id / ssid / bssid / flags

0   Cutiechick   any   

Undercity xerodark # wpa_cli select_network 0

Selected interface 'wlan0'

OK

```

I also tried iwlist wlan0 scan and this was the result:

```

Undercity xerodark # iwlist wlan0 scan

wlan0     No scan results

```

----------

## mikegpitt

Stupid question, but are you sure the network is in range?  It can't connect if it can't find any scan results...  Both wpa_supplicant and iwscan aren't showing any networks within range.

EDIT:  A few other things...

1) I believe this driver requires firmware.  Have you installed it?

2) Can you post the output of `dmesg | grep wlan0`?

3) Make sure you installed the correct driver, etc.  Take a look at this thread:  https://forums.gentoo.org/viewtopic-t-890640-start-0.html

----------

## Zerodark

I'm in the same room as the network I'm trying to connect to. I have installed the firmware from the ralink website (also mentioned in the post you linked, however the link in the post is broken) and as far as I know I am using the correct driver. 

```

Undercity xerodark # dmesg | grep wlan0

ADDRCONF(NETDEV_UP): wlan0: link is not ready

ADDRCONF(NETDEV_UP): wlan0: link is not ready

```

I really appreciate all your help with this.

----------

## Gusar

Use pastebin to post the full dmesg and also your kernel config.

----------

## Zerodark

dmesg 

http://pastebin.com/09bFLMXp

Kernel config

http://pastebin.com/exGV3ePf

----------

## Gusar

Hmm, instead of downloading the firmware from Ralink, install the linux-firmware package. Then, load the rt2800usb module with nohwcrypt=1. And start wpa_supplicant manually, with debugging:

```
wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d
```

Pastebin the output of that. Also, are you using hidden ssid? Finally, the link mikegpitt porvided says there are issues with 5GHz networks, does your network by any chance use 5GHz?

----------

## mikegpitt

Definitely some strangeness...  first off it looks like there is a problem loading your firmware

```
r8169 0000:02:00.0: eth0: unable to load firmware patch rtl_nic/rtl8168d-2.fw (-2)
```

...but it is loading for eth0, and there is no mention of loading any firmware for wlan0.  Why this is loading for eth0 is a bit of a mystery...

I would recommend Gusar's suggesting of emerging linux-firmware.

Can you also post the full output of `lspci -nn`if the linux-firmware package doesn't work?  I want to understand why the firmware is loading for eth0.

----------

## Gusar

 *mikegpitt wrote:*   

> Definitely some strangeness...  first off it looks like there is a problem loading your firmware
> 
> ```
> r8169 0000:02:00.0: eth0: unable to load firmware patch rtl_nic/rtl8168d-2.fw (-2)
> ```
> ...

 

Not at all a mystery. The Realtek ethernet NIC can optionally take firmware. It's the same on my machine. The NIC will work without it, but if the firmware is there, it'll get loaded. I'm assuming the card already has firmware in it, but the driver can optionally load an updated one. The linux-firmware package contains that rtl8168d-2.fw file, among others.

----------

## Zerodark

Ok, I got the linux-firmware package. Here is the pastebins that were requested

wpa_supplicant 

http://pastebin.com/PzQQVrMV

lspci

http://pastebin.com/inWpyMF9

----------

## Gusar

```
ctrl_iface bind(PF_UNIX) failed: Address already in use

ctrl_iface exists and seems to be in use - cannot override it

Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore

Failed to initialize control interface '/var/run/wpa_supplicant'.

You may have another wpa_supplicant process already running or the file was

left by an unclean termination of wpa_supplicant in which case you will need

to manually remove this file before starting wpa_supplicant again.
```

Do that. And post the output again.

----------

## Zerodark

Still no luck. Here is the updated pastebin

http://pastebin.com/YGnMapxv

----------

## mikegpitt

1) Did you remove the old firmware you manually installed?

2) When you installed linux-firmware, did you reboot the machine after (or reload the module in question)?

Can you also post a pastebin of the latest dmesg (after you do the above) to see if it is loading the firmware now?

----------

