# [solved][WPA_supplicant] Wireless at startup with OpenRC?

## Bluespear

Hello,

after searching for almost every related problems with google (site.gentoo.org), I am still stuck getting wireless to start automatically (or at least net.wlan0 manual start).

The error I get is:

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

net.wlan0       | * Bringing up interface wlan0

net.wlan0       | *   Configuring wireless network for wlan0

net.wlan0       | *   Scanning for access points

net.wlan0       | *     Found "Bluespear" at **:**:**:**:**:**, managed, encrypted

net.wlan0       | *   WEP key is not set for "Bluespear"

net.wlan0       | *   Couldn't associate with any access points on wlan0

net.wlan0       | *   Failed to configure wireless for wlan0

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

```

But setting the network manually is working:

```
#wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

Trying to associate with **:**:**:**:**:** (SSID='Bluespear' freq=2462 MHz)

Associated with **:**:**:**:**:**

WPA: Key negotiation completed with **:**:**:**:**:** [PTK=TKIP GTK=TKIP]

CTRL-EVENT-CONNECTED - Connection to **:**:**:**:**:** completed (auth) [id=0 id_str=]

```

(+ dhcpcd after that... i I am connected...)

My /etc/conf.d/net file:

```
modules_eth0=("dhcpcd ifplugd") 

modules_wlan0=( "wpa_supplicant" ) 

config_eth0=("dhcp") 

dhcpcd_eth0="-t 5" 

#WPA_SUPPLICANT  

wpa_supplicant_wlan0="-Dwext" 

config_wlan0=( "dhcp" )

sleep_scan_wlan0="10"

#preferred_aps="Bluespear"

```

and wpa_supplicant config file:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=1

ap_scan=1

#fast_reauth = 1

network={

        ssid="Bluespear"

        psk="***************************"

        proto=WPA

        key_mgmt=WPA-PSK 

        pairwise=CCMP TKIP

        group=TKIP

}

.... some other networks......

```

I cannot figure why using net script will force WEP key usage... moreover, I don't want to set a list of AP to connect to. I move a lot with my laptop

and have like ~10 networks to connect to automatically (at least when I start net.wlan0).

I am probably not used enough with openrc + wpa_supplicant, I had a custom script for my old laptop because os some troubles with the wireless drivers which needed reloading sometimes.

Any idea what to put in net config file so that wpa_supplicant start in the same manner as the manual one ?

----------

## Bluespear

Well,

I stopped fighting with wpa_supplicant integration. I switched to wicd and it is way clearer and simpler  :Smile: 

Marked as solver since I got what I wanted.

----------

## ojbyer

I'm having the same problem. It seems like my net.wlan0 script is using iwconfig even though I specified modules="wpa_supplicant"

----------

## cach0rr0

 *ojbyer wrote:*   

> I'm having the same problem. It seems like my net.wlan0 script is using iwconfig even though I specified modules="wpa_supplicant"

 

are you using baselayout-2/openrc? AFAIK the old net.* scripts aren't used any more with bl2/openrc

(possible I misunderstood what I read, though)

----------

## ojbyer

I am using baselayout-2 with openrc. I've been using the old the old net.* scripts for a while now, as per the migration guide: http://www.gentoo.org/doc/en/openrc-migration.xml

This is the first time I tried to make wireless work though, and that part is clearly broken. wpa_supplicant works perfectly if I invoke it manually from the command line but no matter what I do net.wlan0 insists on trying to setup the interface via iwconfig.

----------

## d2_racing

Indeed, on my Gentoo Testing box and on my Funtoo testing box, I used this little wiki that a wrote a while ago : http://www.gentoo-quebec.org/wiki/index.php/Gestion_du_r%C3%A9seau_avec_Funtoo

----------

## cach0rr0

ok yeah, i misunderstood

the syntax has changed, but the scripts are still to be used

one thing that I don't see covered in that migration page:

http://roy.marples.name/projects/openrc/wiki/OpenRCConfig

Namely, the  modules line:

```

modules_wlan0="!iwconfig !wpa_supplicant"

```

I would suspect yours needs to be:

```

modules_wlan0="!iwconfig wpa_supplicant"

```

Note the removal of the ! in front of wpa_supplicant. 

Can you post your /etc/conf.d/net actually? We should be able to tell if it's kosher or otherwise. I didn't have to mess with any of that nonsense admittedly - I have a nice simple Atheros card, and wicd, and I simply do not have any problems with virtually zero configuration/setup required.

----------

## ojbyer

I was using the wrong syntax for the modules line.

This fixed the problem:

/etc/conf.d/net:

modules_wlan0="!iwconfig wpa_supplicant" 

rc_need_wlan0="wpa_supplicant"

config_wlan0="dhcp"

/etc/conf.d/wpa_supplicant:

wpa_supplicant_args="-Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf"

----------

