# [SOLVED] wpa_supplicant can't initialize control interface

## kewlness

I have searched Google and these forums for answers but all answers I have found do not seem to address this type of issue.  :Sad: 

```

# /etc/init.d/net.wlan0 start

 * Bringing up interface wlan0

 *   Starting wpa_supplicant on wlan0 ...

mkdir[ctrl_interface]: No such file or directory

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.

*    start-stop-daemon: failed to start  `/usr/sbin/wpa_suplicant'                  [ !! ]

* ERROR: net.wlan0 failed to start
```

Interestingly, /var/run/wpa_supplicant does actually exist. When I remove it, I still get the same error. I have checked ps aux | grep wpa_supplicant but it does not show any such processes running (which is not surprising since it can't even get started). When I reemerged wpa_supplicant again, /var/run/wpa_supplicant was automagically created. Any assistance on this one would be appreciated as I have no clue anymore (I've used all sorts of distros for years, Debian, Ubuntu, even CentOS but this is the first system I have ever put together myself so I still consider myself a noob)...  :Very Happy: 

dmesg:

```

# dmesg | tail

[ 5360.158116] ADDRCONF(NETDEV_UP): wlan0: link is not ready

[ 5486.727826] iwlwifi 0000:24:00.0: L1 Disabled; Enabling L0S

[ 5486.727963] iwlwifi 0000:24:00.0: Radio type=0x1-0x2-0x0

[ 5486.847223] ADDRCONF(NETDEV_UP): wlan0: link is not ready

[ 5555.323582] iwlwifi 0000:24:00.0: L1 Disabled; Enabling L0S

[ 5555.323725] iwlwifi 0000:24:00.0: Radio type=0x1-0x2-0x0

[ 5555.442881] ADDRCONF(NETDEV_UP): wlan0: link is not ready

[ 6910.401313] iwlwifi 0000:24:00.0: L1 Disabled; Enabling L0S

[ 6910.401449] iwlwifi 0000:24:00.0: Radio type=0x1-0x2-0x0

[ 6910.520956] ADDRCONF(NETDEV_UP): wlan0: link is not ready

```

/etc/conf.d/net:

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc*/net.example* and save your configuration

# in /etc/conf.d/net (this file :]!).

dns_domain_lo="<SUPER SECRET DOMAIN PROVIDED :D >"

config_eth0="dhcp"

# WIRELESS

## Prefer wpa_supplicant over wireless-tools

modules="wpa_supplicant"

## Driver for the wireless device

wpa_supplicant_wlan0="-Dwext"

## Configure Interface wlan0

config_wlan0="dhcp"

```

/etc/wpa_supplicant/wpa_supplicant.conf:

```

ctrl_interface="/var/run/wpa_supplicant/"

ctrl_interface_group="wheel"

ap_scan=1

# Home Network

network={

   ssid="<SUPER SECRET SSID PROVIDED :D >"

   scan_ssid=1

   key_mgmt=WPA-PSK

   proto=WPA2

   psk="<SUPER SECRET KEY PROVIDED :D >"

}

```

Last edited by kewlness on Wed Apr 25, 2012 8:45 pm; edited 1 time in total

----------

## BillWho

kewlness,

One thing I noticed that's incomplete in /etc/conf.d/net is the wpa_supplicant line. Change it to:

```
wpa_supplicant_wlan0="-Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf"
```

----------

## kewlness

 *BillWho wrote:*   

> kewlness,
> 
> One thing I noticed that's incomplete in /etc/conf.d/net is the wpa_supplicant line. Change it to:
> 
> ```
> ...

 

Ah. Very correct and this has been changed.

However, even starting from the command-line (and with the above changes restarting net.wlan0) I get the same error.

----------

## Ant P.

Messing with /etc/conf.d/net there won't have fixed it, no. All you've done there is repeating the default values in the initscript.

wpa_supplicant runs as root, so it can't be a permissions problem on the directory. Try running this and see if it prints out any new errors:

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

----------

## kewlness

 *Ant P. wrote:*   

> Messing with /etc/conf.d/net there won't have fixed it, no. All you've done there is repeating the default values in the initscript.
> 
> wpa_supplicant runs as root, so it can't be a permissions problem on the directory. Try running this and see if it prints out any new errors:
> 
> ```
> ...

 

Here the output (same error but you might see something I don't):

```

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

Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' 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='"wheel"'

ap_scan=1

Priority group 0

   id=0 ssid='EDITED'

WEXT: cfg80211-based driver detected

SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf flags 0x0

netlink: Operstate: linkmode=1, operstate=5

Own MAC address: 10:0b:a9:51:80:a0

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_countermeasures

RSN: flushing PMKID list in the driver

Setting scan request: 0 sec 100000 usec

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: Supplicant port status: Unauthorized

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: Supplicant port status: Unauthorized

EAPOL: Supplicant port status: Unauthorized

mkdir[ctrl_interface]: No such file or directory

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.

Failed to add interface wlan0

No keys have been configured - skip key clearing

State: DISCONNECTED -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

EAPOL: External notification - portEnabled=0

EAPOL: Supplicant port status: Unauthorized

EAPOL: External notification - portValid=0

EAPOL: Supplicant port status: Unauthorized

wpa_driver_wext_set_countermeasures

No keys have been configured - skip key clearing

Cancelling scan request

Cancelling authentication timeout

netlink: Operstate: linkmode=0, operstate=6

```

Also, I thought it might be a permissions error as well, but I have not idea what they should be since these permissions make sense:

```

# ls -la /var/run | grep wpa

drwxr-xr-x  2 root root 4096 Apr 25 14:01 wpa_supplicant

```

----------

## BillWho

kewlness,

My wpa_supplicant interface line is 

```
ctrl_interface=/var/run/wpa_supplicant
```

yours is

```
ctrl_interface="/var/run/wpa_supplicant/" 
```

Try dropping the quotes and '/' at the end.

Here's my entire file:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=1

network={

   ssid="wireless"

   psk="secret"

   proto=RSN

   key_mgmt=WPA-PSK

   pairwise=TKIP

   auth_alg=OPEN

   priority=5

   id_str="gentoo"

}

```

----------

## kewlness

 *BillWho wrote:*   

> kewlness,
> 
> My wpa_supplicant interface line is 
> 
> ```
> ...

 

Yep. That did it. Dropping the quotes around the ctrl_interface and the word "wheel" did the trick. Marking as solved.

Thanks!  :Smile: 

----------

