# NetworkManager fails on WPA2-PSK

## pekster

I installed net-misc/networkmanager and it works fine for wired and unencrypted wireless connections.  However, attempting to associate with a WPA2-PSK encrypted network fails.  I have attached the entire /var/log/messages output from the connection attempt.  Everything looks fine until it times out at the end.  I also know the key I'm entering is valid; however, it contains 63 ASCII characters including many symbols (such as backslash, dollar-sign, etc) and I don't know if it's possible one of them isn't getting escaped properly by networkmanager.

I don't know if this is a wpa_suplicant issue or networkmanager issue, and more importantly how to fix the problem.  A bit of web searching reveals that others have had this same issue, but I wasn't unable to find a solution.

Thanks for any help in tracking down this problem.

/var/log/messages output during WPA2-PSK connection attempt appears below:

```

Jan 31 17:10:31 josh-gentoo NetworkManager: <debug> [1201821031.300836] nm_device_802_11_wireless_get_activation_ap(): Forcing AP 'VSI'

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  User Switch: /org/freedesktop/NetworkManager/Devices/wlan0 / VSI

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Deactivating device wlan0.

Jan 31 17:10:31 josh-gentoo NetworkManager: <WARN>  nm_device_802_11_wireless_set_essid(): error setting ESSID to '' for device wlan0: Invalid argument

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Device wlan0 activation scheduled...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) started...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): access point 'VSI' is encrypted, but NO valid key exists.  New key needed.

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key requested for network 'VSI'.

Jan 31 17:10:31 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key for network 'VSI' received.

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Jan 31 17:10:46 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): access point 'VSI' is encrypted, and a key exists.  No new key needed.

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'INTERFACE_ADD wlan0           wext    /var/run/wpa_supplicant '

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'AP_SCAN 1'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'ADD_NETWORK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was '0'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 ssid 565349'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 proto WPA2'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 key_mgmt WPA-PSK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 psk <key>'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 pairwise CCMP'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 group CCMP'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: sending command 'ENABLE_NETWORK 0'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Jan 31 17:10:47 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Jan 31 17:11:07 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): association took too long (>20s), failing activation.

Jan 31 17:11:07 josh-gentoo NetworkManager: <info>  Activation (wlan0) failure scheduled...

Jan 31 17:11:07 josh-gentoo NetworkManager: <info>  Activation (wlan0) failed for access point (VSI)

Jan 31 17:11:07 josh-gentoo NetworkManager: <info>  Activation (wlan0) failed.

Jan 31 17:11:07 josh-gentoo NetworkManager: <info>  Deactivating device wlan0.

Jan 31 17:11:08 josh-gentoo NetworkManager: <WARN>  nm_device_802_11_wireless_set_essid(): error setting ESSID to '' for device wlan0: Invalid argument

```

----------

## pekster

This is an update because I now get a new error after rebooting, but it still fails to associate with the WPA2 access-point.  Last night I was successfully able to connect to a WPA-PSK AP, so it seems this problem is specifically related to WPA2.  To clarify, my hardware does have WPA2 support and when I installed wpa_supplicant it stated that WPA2 was a support encryption type.

The new logs from /var/log/messages during the connection attempt are included below.  The difference this time is that I get an error stating "Error opening supplicant global control interface" and then the activation aborts due to a lack of connection to the supplicant.  Since WPA-PSK works well I don't understand how there would be a problem communicating with the supplicant.

The new log output:

```

Feb  1 10:14:59 josh-gentoo NetworkManager: <debug> [1201882499.021736] nm_device_802_11_wireless_get_activation_ap(): Forcing AP 'VSI'

Feb  1 10:14:59 josh-gentoo NetworkManager: <info>  User Switch: /org/freedesktop/NetworkManager/Devices/wlan0 / VSI

Feb  1 10:14:59 josh-gentoo NetworkManager: <info>  Deactivating device wlan0.

Feb  1 10:14:59 josh-gentoo NetworkManager: <WARN>  nm_device_802_11_wireless_set_essid(): error setting ESSID to '' for device wlan0: Invalid argument

Feb  1 10:14:59 josh-gentoo NetworkManager: <info>  Device wlan0 activation scheduled...

Feb  1 10:14:59 josh-gentoo NetworkManager: <info>  Deactivating device eth0.

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) started...

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): access point 'VSI' is encrypted, but NO valid key exists.  New key needed.

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key requested for network 'VSI'.

Feb  1 10:15:00 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key for network 'VSI' received.

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Feb  1 10:15:05 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): access point 'VSI' is encrypted, and a key exists.  No new key needed.

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'INTERFACE_ADD wlan0           wext    /var/run/wpa_supplicant '

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'AP_SCAN 1'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'ADD_NETWORK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was '0'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 ssid 565349'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 proto WPA2'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 key_mgmt WPA-PSK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 psk <key>'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: sending command 'ENABLE_NETWORK 0'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  SUP: response was 'OK'

Feb  1 10:15:06 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Feb  1 10:15:26 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): disconnected during association, asking for new key.

Feb  1 10:15:26 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key requested for network 'VSI'.

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) New wireless user key for network 'VSI' received.

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Feb  1 10:15:35 josh-gentoo NetworkManager: <info>  Activation (wlan0/wireless): access point 'VSI' is encrypted, and a key exists.  No new key needed.

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Error opening supplicant global control interface.

Feb  1 10:15:38 josh-gentoo NetworkManager: <WARN>  real_act_stage2_config(): Activation (wlan0/wireless): couldn't connect to the supplicant.

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Activation (wlan0) failure scheduled...

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Activation (wlan0) failed for access point (VSI)

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Activation (wlan0) failed.

Feb  1 10:15:38 josh-gentoo NetworkManager: <info>  Deactivating device wlan0.

Feb  1 10:15:38 josh-gentoo NetworkManager: <WARN>  nm_device_802_11_wireless_set_essid(): error setting ESSID to '' for device wlan0: Invalid argument

```

----------

## mguede

I had a similar problem once: I was missing /var/run/NetworkManager on my system (I mount a ramdisk on /var/run). I fixed it permanently by hacking the initscript /etc/init.d/Networkmanager so the missing dir is created now every time NetworkManager starts.

----------

## pekster

 *mguede wrote:*   

> I had a similar problem once: I was missing /var/run/NetworkManager on my system (I mount a ramdisk on /var/run). I fixed it permanently by hacking the initscript /etc/init.d/Networkmanager so the missing dir is created now every time NetworkManager starts.

 

Thanks for the suggestion, but in my case that directory does exist and is on an actual partition.  NetworkManager starts and runs just fine, but my problem is specific to WPA2-PSK compared to other network types such as open wireless or Ethernet.

----------

## jdmulloy

What wifi card do you have? Which driver are you using. I was having this problem with my ipw3945 using the old ipw3945 driver but I just upgraded to gentoo-sources-2.6.24-r3 and iwl3945, and it the problem seems to have gone away. Of course if your not using an intel card then this won't help. The main thing with this driver is it switches to the new mac80211 stack in the kernel, so if you can get drivers for your card that use it you might have better luck.

----------

## jdmulloy

What kernel are you running? Which version of wpa_supplicant are you using? I have to use the 0.6.x branch to get it to work. It is hard masked however. Could you please post the output of emerge --info.

----------

