# Cannot connect with wpa_supplicant [solved]

## alienjon

I have wireless tools running on my computer and I can connect to the internet just fine.  I would like to switch over to wpa_supplicant so that I may use WPA encryption (I currently use WEP).  The problem is that now matter what I seem to do, I cannot connect.

```
modules=( "wpa_supplicant" )

wpa_supplicant_eth0="-Datmel"
```

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

update_config=1

network={

        ssid="Trust_Network"

        scan_ssid=1

        key_mgmt=NONE

        wep_key0={hidden wep key}

        priority=5

}
```

Now, if I try using the init script, I get:

```
 * Caching service dependencies ...                                                                                     [ ok ]

 * Starting eth0

 *   Loading networking modules for eth0

 *     modules: apipa arping ccwgroup macchanger macnet rename wpa_supplicant essidnet iptunnel iproute2 system dhcpcd ip6to4

 *       wpa_supplicant provides wireless

 *       iproute2 provides interface

 *       dhcpcd provides dhcp

 *   Configuring eth0 for MAC address 00:09:5B:54:B1:9E ...                                                             [ ok ]

 *   Starting wpa_supplicant on eth0 ...

wpa_driver_atmel_set_wpa eth0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_countermeasures - not yet implemented

wpa_driver_atmel_set_drop_unencrypted - not yet implemented                                                             [ ok ]

 *   Starting wpa_cli on eth0 ...                                                                                       [ ok ]

 *     Waiting for association                                                                                          [ ok ]

 *     Backgrounding ...
```

If I use command-line, I get:

```
Initializing interface 'eth0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'atmel' 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='users' (DEPRECATED)

update_config=1

Priority group 5

   id=0 ssid='Trust_Network'

Initializing interface (2) 'eth0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=22 WE(source)=22 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: 00:09:5b:54:b1:9e

wpa_driver_atmel_set_wpa eth0

wpa_driver_atmel_set_wpa: enabled=1

wpa_driver_atmel_set_key: alg=none key_idx=0 set_tx=0 seq_len=0 key_len=0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_key: alg=none key_idx=1 set_tx=0 seq_len=0 key_len=0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_key: alg=none key_idx=2 set_tx=0 seq_len=0 key_len=0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_countermeasures - not yet implemented

wpa_driver_atmel_set_drop_unencrypted - not yet implemented

Setting scan request: 0 sec 100000 usec

ctrl_interface_group=100 (from group name 'users')

Added interface eth0

RTM_NEWLINK: operstate=0 ifi_flags=0x2 ()

Wireless event: cmd=0x8b06 len=12

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

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

State: DISCONNECTED -> SCANNING

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=13):

     54 72 75 73 74 5f 4e 65 74 77 6f 72 6b            Trust_Network

Trying to get current scan results first without requesting a new scan to speed up initial association

ioctl[SIOCGIWSCAN]: Resource temporarily unavailable

Scan results: -1

Failed to get scan results

Failed to get scan results - try scanning again

Setting scan request: 0 sec 0 usec

Starting AP scan (broadcast SSID)

CTRL_IFACE monitor attached - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

RX ctrl_iface - hexdump_ascii(len=10):

     49 4e 54 45 52 46 41 43 45 53                     INTERFACES

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=13):

     4c 49 53 54 5f 4e 45 54 57 4f 52 4b 53            LIST_NETWORKS

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

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

Wireless event: cmd=0x8b19 len=16

Received 532 bytes of scan results (3 BSSes)

Scan results: 3

Selecting BSS from priority group 5

0: 00:1e:c7:c5:2e:41 ssid='2WIRE238' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

1: 00:01:95:6a:3d:c7 ssid='Trust_Network' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

2: 00:14:bf:37:af:8d ssid='meganet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1

   skip - no WPA/RSN IE

   selected non-WPA AP 00:01:95:6a:3d:c7 ssid='Trust_Network'

Trying to associate with 00:01:95:6a:3d:c7 (SSID='Trust_Network' freq=2462 MHz)

CTRL_IFACE monitor send - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: clearing own WPA/RSN IE

No keys have been configured - skip key clearing

wpa_driver_atmel_set_key: alg=WEP key_idx=0 set_tx=1 seq_len=0 key_len=5

ioctl[ATMEL_WPA_IOCTL]: Argument list too long

Failed to set encryption.

wpa_driver_atmel_set_drop_unencrypted - not yet implemented

State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

WEXT: Operstate: linkmode=-1, operstate=5

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - portControl=ForceAuthorized

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

Wireless event: cmd=0x8b1a len=29

RTM_NEWLINK: operstate=0 ifi_flags=0x10003 ([UP][LOWER_UP])

Wireless event: cmd=0x8b15 len=24

Wireless event: new AP: 00:01:95:6a:3d:c7

State: ASSOCIATING -> ASSOCIATED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

WEXT: Operstate: linkmode=-1, operstate=5

Associated to a new BSS: BSSID=00:01:95:6a:3d:c7

Associated with 00:01:95:6a:3d:c7

CTRL_IFACE monitor send - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

WPA: Association event - clear replay counter

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

EAPOL: External notification - portEnabled=1

EAPOL: SUPP_PAE entering state S_FORCE_AUTH

EAPOL: SUPP_BE entering state IDLE

Cancelling authentication timeout

State: ASSOCIATED -> COMPLETED

CTRL-EVENT-CONNECTED - Connection to 00:01:95:6a:3d:c7 completed (auth) [id=0 id_str=]

CTRL_IFACE monitor send - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

wpa_driver_wext_set_operstate: operstate 0->1 (UP)

WEXT: Operstate: linkmode=-1, operstate=6

Cancelling scan request

RTM_NEWLINK: operstate=1 ifi_flags=0x10003 ([UP][LOWER_UP])

WEXT: Operstate: linkmode=-1, operstate=6

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RTM_NEWLINK: operstate=1 ifi_flags=0x10043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=13):

     4c 49 53 54 5f 4e 45 54 57 4f 52 4b 53            LIST_NETWORKS

RTM_NEWLINK: operstate=1 ifi_flags=0x3 ([UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RTM_NEWLINK: operstate=1 ifi_flags=0x3 ([UP])

Wireless event: cmd=0x8b19 len=16

Received 532 bytes of scan results (3 BSSes)

Scan results: 3

Selecting BSS from priority group 5

0: 00:1e:c7:c5:2e:41 ssid='2WIRE238' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

1: 00:01:95:6a:3d:c7 ssid='Trust_Network' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

2: 00:14:bf:37:af:8d ssid='meganet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1

   skip - no WPA/RSN IE

   selected non-WPA AP 00:01:95:6a:3d:c7 ssid='Trust_Network'

Already associated with the selected AP.

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RTM_NEWLINK: operstate=1 ifi_flags=0x3 ([UP])

Wireless event: cmd=0x8b19 len=16

Received 532 bytes of scan results (3 BSSes)

Scan results: 3

Selecting BSS from priority group 5

0: 00:1e:c7:c5:2e:41 ssid='2WIRE238' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

1: 00:01:95:6a:3d:c7 ssid='Trust_Network' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

2: 00:14:bf:37:af:8d ssid='meganet' wpa_ie_len=0 rsn_ie_len=0 caps=0x1

   skip - no WPA/RSN IE

   selected non-WPA AP 00:01:95:6a:3d:c7 ssid='Trust_Network'

Already associated with the selected AP.

RTM_NEWLINK: operstate=1 ifi_flags=0x10003 ([UP][LOWER_UP])

WEXT: Operstate: linkmode=-1, operstate=6

Wireless event: cmd=0x8b15 len=24

Wireless event: new AP: 00:01:95:6a:3d:c7

State: COMPLETED -> ASSOCIATED

wpa_driver_wext_set_operstate: operstate 1->0 (DORMANT)

WEXT: Operstate: linkmode=-1, operstate=5

Associated with 00:01:95:6a:3d:c7

CTRL_IFACE monitor send - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

WPA: Association event - clear replay counter

EAPOL: External notification - portEnabled=0

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: SUPP_BE entering state INITIALIZE

EAPOL: External notification - portValid=0

EAPOL: External notification - portEnabled=1

EAPOL: SUPP_PAE entering state S_FORCE_AUTH

EAPOL: SUPP_BE entering state IDLE

Cancelling authentication timeout

State: ASSOCIATED -> COMPLETED

CTRL-EVENT-CONNECTED - Connection to 00:01:95:6a:3d:c7 completed (reauth) [id=0 id_str=]

CTRL_IFACE monitor send - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 34 36 38 35 2d 35 35 33 00

wpa_driver_wext_set_operstate: operstate 0->1 (UP)

WEXT: Operstate: linkmode=-1, operstate=6

Cancelling scan request

RTM_NEWLINK: operstate=1 ifi_flags=0x10003 ([UP][LOWER_UP])

WEXT: Operstate: linkmode=-1, operstate=6

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RTM_NEWLINK: operstate=1 ifi_flags=0x10043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RTM_NEWLINK: operstate=1 ifi_flags=0x10003 ([UP][LOWER_UP])

WEXT: Operstate: linkmode=-1, operstate=6

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RTM_NEWLINK: operstate=1 ifi_flags=0x10043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'eth0' added

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=13):

     4c 49 53 54 5f 4e 45 54 57 4f 52 4b 53            LIST_NETWORKS

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

ioctl[SIOCGIFADDR]: Cannot assign requested address
```

It continues that pinging at the end until I exit out of it, but during that time I am not connected to the internet and pinging the router (192.168.0.1) outputs a: "Network is Unreachable"  I've tried the gui (while the console command and the init script have been run and it displays the following:

 *Quote:*   

> Status: COMPLETED
> 
> Last message:
> 
> Authentication: NONE
> ...

 

If I hit 'Connect' again, the only thing that changes is that the 'Last message:' is set to 'Connection to 00:01:95:6a:3d:c7 comple' (I'm assuming it means 'Complete', but it gets cut off)

Now, as a bit of a random guess, I think the crux of the problem lies in this message, the first line of which is generated when I run wpa_supplicant via command line and the second line of which displays both when I run it at the command line and with the init script:

```
wpa_driver_atmel_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0

ioctl[ATMEL_WPA_IOCTL]: Argument list too long
```

As a last note, and to address it before someone else mentions it, I know that WEP about as useful as a cat in a dog race (Leave my metaphor's alone! I just woke up!) and the entire reason I'm changing to wpa_supplicant is so I may also change to WPA, but I want to make sure that my computer is initialized first and that wpa_supplicant likes my adapter (which it says it supports and works fine with wireless tools, so I know the adapters ok) and once I can get it working with WEP, I'll change over to WPA.  Just figured that was worth mentioning  :Smile: Last edited by alienjon on Fri Sep 12, 2008 5:39 pm; edited 1 time in total

----------

## mamac

Hi,

 *alienjon wrote:*   

> 
> 
> ```
> ctrl_interface=/var/run/wpa_supplicant
> 
> ...

 

Are you sure this is right?

I have for some wep networks:

```

network={

        ssid="RITZ-BCN-ROGER"

        key_mgmt=NONE

        wep_key0=123abc1234

        wep_tx_keyidx=0

        priority=10

}

network={

        ssid="arobase"

        scan_ssid=1

        key_mgmt=NONE

        wep_key0="arobasearobas"

        wep_tx_keyidx=0

#       auth_alg=SHARED

        priority=20

}

network={

        ssid="palace"

        key_mgmt=NONE

        wep_key0=DDD19A4694557AB1E70978C162

        wep_tx_keyidx=0

        priority=10

}

```

----------

## alienjon

I just tried the first of your configurations and I noticed that if I had wireless tools connect my computer to the router, then stop the service, switch to wpa_supplicant and restart the service, I can connect.  But I just restarted and wpa_supplicant cannot, by itself, connect.

----------

## overkll

I'm not at my gentoo box, so I can't check out stuff.  I'm going from memory here...

You may want to try using "-Dwext" (kernel wireless extensions) instead of "-Datmel", that is of course if atmel is a ie80211 stack kernel driver.  It is, isn't it?

Also try "!iwconfig" (=don't use iwconfig) in /etc/conf.d/net i.e:

```
modules=( "!iwconfig" "wpa_supplicant" )

wpa_supplicant_eth0="-Dwext"
```

Should that be eth0, or eth1 or wlan0?  I don't since I can't check and never have used atmel wifi.

Then in wpa_supplicant.conf, add "ap_scan=1".  You can also fiddle with 0 or 2.  See /usr/share/doc/wpa_supplicant/wpa_supplicant.conf for more clues.  Basically ap_scan=1 is default (IIRC), but force it anyway.  It lets wpa_supplicant take care of the scanning.  0 lets the driver do the scanning.  2 is like 0, but has additional features.

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

update_config=1

ap_scan=1

network={

        ssid="Trust_Network"

        scan_ssid=1

        key_mgmt=WPA-PSK

        psk="yoursupersecretpassphrasegoeshere"

}
```

I'd have to check my gentoo lappy for WEP config.  I'll go check and return.

----------

## overkll

For WEP, same config but I have this for a simple WEP network (not my own)

/etc/wpa_supplicant/wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=users

update_config=1

ap_scan=1

network={

        ssid="Trust_Network"

        scan_ssid=1

        key_mgmt=WPA-PSK

        psk="yoursupersecretpassphrasegoeshere"

}

network={

       ssid="Trust_Network"

       key_mgmt=NONE

       wep_key0=yourwepkeyunquoted

}
```

----------

## alienjon

I've had ap_scan=1 in my wpa_supplicant.conf file before, but it looks like either adding !iwconfig (less likely) or changing to wext (more likely) is what actually did the trick  :Smile:   I wasn't aware the wext was the kernel framestack, but it looks like their atmel support is still in a 'working' phase (or, at least that's my guess)

I changed the settings and restarted (as I had mentioned in my last post) and this time it worked right off the bat!  I'll keep an eye on it for now, but I'm hoping that means this is now solved  :Smile: 

Thanks all!

----------

## overkll

Glad you got it sorted.  !iwconfig makes a HUGE difference, as well as -Dwext.  It's the combination that did the trick.

----------

## mamac

alienjon,

Glad to see you're making progress.

As a comment to your previous post, I'd say each time I make a change in my network conf (e.g. add a new wireless network), instead of restarting the computer I stop the interface, unload the module, load it again and wait few seconds with something like : #/etc/init.d/net.wlan0 stop && modprobe -r iwl3945 && modprobe iwl3945.

That works like a charm.

----------

