# [Solved] wpa_supplicant unable to connect to ap

## TotallyNotTom

Hi all,

for a background story: I've recently migrated from archlinux to gentoo, following both the official guide

as well as sakaki's guide about dualbooting gentoo and windows. 

At the end of the day I had a working setup with i3-wm and wireless connection via dhcpcd and wpa_supplicant as proposed in the wiki.

However since then I have done (possible bad) things to my kernel config and I crashed once, where I had to hard reset the laptop.

After said crash my wireless interface wasn't able to establish any connection.

Things I tried already, which did not work or lead to any additional clues:

Revert to an old kernel, where iirc the wireless connection was working.

Re-emerge both wpa_supplicant and dhcpcd.

Look for possible blocks of the interface with rfkill, there were none.

Check if the interface in general was operating, scanning for nearby APs works and displays correct results.

I followed the advice in https://wiki.gentoo.org/wiki/Wpa_supplicant#Troubleshooting however I have no clue about what

most of the things in the log mean, a full cycle of the stdout is located over at this pastebin because its too large for a code field here.

All I can read from it is that it apperantly fails at something called 4-way handshake. However I am afraid I have too little understanding to quickly get the grasp of what that means.

It looks like its even able to establish a connection to my AP but then fails because of some ?protocol mismatch?

Oddly enough this sounds to me like it could be related to kernel configuration again, however I don't know where to look for the error.

When searching for this error I get only found some forum posts where the error magically disappears or something related to other things like soft blocked devices etc.

In case it has anything of value in it, here is the lspci:

```
dadori ~ # lspci -nn

00:00.0 Host bridge [0600]: Intel Corporation Haswell-ULT DRAM Controller [8086:0a04] (rev 0b)

00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 0b)

00:03.0 Audio device [0403]: Intel Corporation Haswell-ULT HD Audio Controller [8086:0a0c] (rev 0b)

00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC [8086:9c31] (rev 04)

00:16.0 Communication controller [0780]: Intel Corporation 8 Series HECI #0 [8086:9c3a] (rev 04)

00:19.0 Ethernet controller [0200]: Intel Corporation Ethernet Connection I218-V [8086:1559] (rev 04)

00:1b.0 Audio device [0403]: Intel Corporation 8 Series HD Audio Controller [8086:9c20] (rev 04)

00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series PCI Express Root Port 6 [8086:9c1a] (rev e4)

00:1c.1 PCI bridge [0604]: Intel Corporation 8 Series PCI Express Root Port 3 [8086:9c14] (rev e4)

00:1d.0 USB controller [0c03]: Intel Corporation 8 Series USB EHCI #1 [8086:9c26] (rev 04)

00:1f.0 ISA bridge [0601]: Intel Corporation 8 Series LPC Controller [8086:9c43] (rev 04)

00:1f.2 SATA controller [0106]: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] [8086:9c03] (rev 04)

00:1f.3 SMBus [0c05]: Intel Corporation 8 Series SMBus Controller [8086:9c22] (rev 04)

03:00.0 Network controller [0280]: Intel Corporation Wireless 7260 [8086:08b2] (rev 83)
```

The according drivers are loaded if I read my lsmod correctly. I see iwlwifi iwlmvm,cfg80211,mac80211 loaded.

I double checked with the wiki page about my laptop model (Lenovo T440s) and everything in make menuconfig is the way it should be,

except for the webcam and microphone support as I have them disabled in the bios anyways.

I am severly out of ideas about where the error might be, apart from it sitting infront of the laptop of course   :Wink: 

Maybe one of you understands more of what wpa_supplicant gives me as output and has an idea where the problem might be located at.

My connection is fine in windows so its unlikely that it is hardware related in my opinion.

Thanks in advance for the help.Last edited by TotallyNotTom on Sat Aug 13, 2016 8:50 am; edited 1 time in total

----------

## Ant P.

90% of the time that error just means a password typo.

----------

## TotallyNotTom

Oh I am pretty sure its not a typo, ive tried to connect to various different networks using plain PSKs and hashed ones from wpa_passphrase none worked

And a typo wouldn't just sneak itself into a config that worked before, I think, or hope.

Nevertheless, yet another try, here I come!

----------

## TotallyNotTom

Alright, I don't know why this didn't occur to me before, but I just tried connecting to an unprotected AP

and it established a working connection like it should

However trying it with a WPA2 PSK setup on the same AP, I wasn't able to connect 

and I just used some generic test password to eliminate all possible typos with that one.

----------

## Ant P.

Just noticed this:

```
nl80211: set_key failed; err=-2 No such file or directory)

wlp3s0: WPA: Failed to set PTK to the driver (alg=3 keylen=16 bssid=c0:25:06:a8:3f:cd)

wlp3s0: Request to deauthenticate - bssid=c0:25:06:a8:3f:cd pending_bssid=00:00:00:00:00:00 reason=1 state=4WAY_HANDSHAKE
```

The mention of a driver error suggests it might be missing firmware.

----------

## mir3x

Check this maybe :

https://bbs.archlinux.org/viewtopic.php?id=170656

----------

## Logicien

According to  Linux WiFi: Deauthenticated Reason Codes Reason=1 is an unknown reason.

Your running kernel and your wpa_supplicant.conf configuration files are needed to help. Of course the iwlwifi need firmware files who must be always present in the root file system (/lib/firmware/iwlwifi*) and in the initramfs if you put iwlwifi module in it or the kernel image if you put the Intel support in the kernel image. iwlwifi need those firmware files when it probe the device, otherwise it may fail to do it.

The best in my opinion is to compile Intel wireless iwlwifi in module and not include it in an initramfs.

iwlwifi have a parameter 11n_disable that ever solve me a problem of connecting in the past. So, you can try to disable 80211 n support. Be sure that this file do not already exist and the option 11n_disable is not set to something else than 1 in a file in /etc/modprobe.d/.

```
echo "options iwlwifi 11n_disable=1" > /etc/modprobe.d/iwlwifi.conf
```

Unload and reload the iwlwifi module or reboot.

I have a Thinkpad T420. I do not need to disable 80211 n support for it to connect to my Gentoo local Access Point. Can you connect using a Linux live media?

----------

## TotallyNotTom

Hurray, it's solved I can connect again.

It actually was me being derpy or not looking closely enough at what sakaki did with his buildkernel script.

Somewhere in the config an option was enabled to include all modules into the initramfs. As my initramfs is on an external flashdrive that was kinda dumb

 *Quote:*   

> The best in my opinion is to compile Intel wireless iwlwifi in module and not include it in an initramfs. 

 

Good call there, I'd have never stumpled accross that if not for you

I still don't fully understand how this lead to such an error message, but I guess I have some background reading to do concerning kernel modules  :Wink: 

Thank you all for the assistance

----------

