# [SOLVED] wpa_supplicant: Failed to initiate AP scan

## yufw

I tried to set up wireless connection with wpa_supplicant. I have this minimal configuration in /etc/wpa_supplicant/wpa_supplicant.conf,

```
ctrl_interface=/var/run/wpa_supplicant

update_config=1

```

Following the Arch Wiki, I run

```
# wpa_supplicant -B -i wlo1 -c /etc/wpa_supplicant/wpa_supplicant.conf
```

The output,

```
Successfully initialized wpa_supplicant

ioctl[SIOCSIWPMKSA]: Invalid argument

ioctl[SIOCSIWMODE]: Invalid argument

ioctl[SIOCGIWRANGE]: Invalid argument

ioctl[SIOCGIWMODE]: Invalid argument

ioctl[SIOCSIWAP]: Invalid argument

ioctl[SIOCSIWESSID]: Invalid argument

ioctl[SIOCSIWENCODEEXT]: Invalid argument

ioctl[SIOCSIWENCODEEXT]: Invalid argument

ioctl[SIOCSIWENCODEEXT]: Invalid argument

ioctl[SIOCSIWENCODEEXT]: Invalid argument

ioctl[SIOCSIWPMKSA]: Invalid argument
```

Then

```
# wpa_cli

> scan
```

It won't stop outputting the "Failed to initiate AP scan message"

```
OK

<4>Failed to initiate AP scan

<4>Failed to initiate AP scan

<4>Failed to initiate AP scan

```

I have an Atheros wireless card, the driver is ath9k. I really have no idea where I did wrong. Any help is appreciated.Last edited by yufw on Fri Jun 13, 2014 3:16 pm; edited 1 time in total

----------

## Logicien

Can you see some access points when you do

```
ip link set wlo1 up

iwlist wlo1 scan | less
```

You can try a more complex command. You can try alternatively -D wext if -D nl80211 fail. You can have a look at wpa_supplicant log in the file /var/log/wpa.log.

```
wpa_supplicant -B -c /etc/wpa_supplicant/wpa_supplicant.conf -D nl80211 -dd -f /var/log/wpa.log -i wlo1 -t
```

If nothing work, the problem can come from the wireless interface itself. Atheros wireless network cards are, from my experience, reliable when drive by the ath9k Linux module.

----------

## yufw

The "-D nl80211" driver option solves my problem.

Thanks, Logicien. Could you please tell me the difference between wext and nl80211?

----------

## khayyam

 *yufw wrote:*   

> Could you please tell me the difference between wext and nl80211?

 

yufw ... WEXT (wireless extensions) has been replaced by NL80211/CFG80211/MAC80211 (netlink). The former is slated for removal but as there are tools which don't use the new layer (and use WEXT exclusively ...  ie, wireless-tools, wicd, and others) there is a compatibility layer which allows these to work. In your case this compatibility layer, CFG80211_WEXT, is not enabled, so anything expecting WEXT will fail. The wpa_supplicant package on gentoo is built with support for both WEXT and NL80211, you just need to provide '-D <driver>' ... but obviously if your current setup doesn't have CFG80211_WEXT then you can only use NL80211 (which of course would be native netlink, rather than the compatibility layer).

best ... khay

----------

## yufw

 *khayyam wrote:*   

> yufw ... WEXT (wireless extensions) has been replaced by NL80211/CFG80211/MAC80211 (netlink). The former is slated for removal but as there are tools which don't use the new layer (and use WEXT exclusively ...  ie, wireless-tools, wicd, and others) there is a compatibility layer which allows these to work. In your case this compatibility layer, CFG80211_WEXT, is not enabled, so anything expecting WEXT will fail. The wpa_supplicant package on gentoo is built with support for both WEXT and NL80211, you just need to provide '-D <driver>' ... but obviously if your current setup doesn't have CFG80211_WEXT then you can only use NL80211 (which of course would be native netlink, rather than the compatibility layer).

 

khay, thanks for the explanation.

But I don't think there is a USE flag related to this compatibility layer, is it controlled by something else other than the USE flag?

----------

## khayyam

 *yufw wrote:*   

> khay, thanks for the explanation. But I don't think there is a USE flag related to this compatibility layer, is it controlled by something else other than the USE flag?

 

yufw ... you're welcome. The wext compatibility layer (CFG80211_WEXT) is in the kernel.

best ... khay

----------

## yufw

 *khayyam wrote:*   

> 
> 
> yufw ... you're welcome. The wext compatibility layer (CFG80211_WEXT) is in the kernel.

 

```
$ grep CFG80211_WEXT /usr/src/linux/.config

# CONFIG_CFG80211_WEXT is not set
```

Indeed, thank you.

----------

## doublehp

"-D nl80211" did it for me too (Orange Pi Zero, H2+, ARMBIAN 5.38 stable Ubuntu 16.04.3 LTS 4.14.18-sunxi )

----------

