# wpa_supplicant on cmdline works but not via /etc/conf.d/net

## vad3r

Hi,

i can use my wireless card perfectly if i start wpa_supplicant on the command line but if i use the start script for my device i can get it up and running. Here's my config:

/etc/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=1

ap_scan=1

fast_reauth=1

network={

        ssid="Freakshow"

        psk="xxxxxxxxxxxxxxx"

        scan_ssid=1

        priority=2

}

```

/etc/conf.d/net

```

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dwext -c/etc/wpa_supplicant.conf"

wpa_timeout_eth1=60

config_ESSID=( "dhcp" )

dhcpcd_ESSID="-t 5"

```

```
deathstar ~ # /etc/init.d/net.eth1 restart

 * Caching service dependencies ...

 *  Services 'hprunlevel' and 'local' have circular

 *  dependency of type 'iafter';  continuing...                                                       [ ok ]

 * Starting eth1

 *   Starting wpa_supplicant on eth1 ...                                                              [ ok ]

 *     timed out                 

```

Hopefully one of you guys know's whats wrong. Thanks

Daniel

----------

## UberLord

It may start ok on the commandline, but how do you know it has associated and authenticated?

----------

## vad3r

I think it works from the command line because i can get a ip-address. On my WLAN router i see that i'm connected and authenticated. So far this looks pretty good for me

----------

## UberLord

OK, could you try it with baselayout-1.12 as it has much better wpa_supplicant handling.

----------

## vad3r

Updating baselayout to 1.12 results in over 250 package updates or addon installs. I'm not sure if i want to do this on my working laptop. Is it the only way to get this working?

----------

## UberLord

Heh - did you just move entirely to ~ARCH? That would be bad.

Just add sys-apps/baselayout to your /etc/portage/package.keywords file. You may want to add any dhcp clients (like net-misc/dhcpcd) to that file too.

----------

## vad3r

After upgrading baselayout the error message has changed:

```
deathstar init.d # /etc/init.d/net.eth1 restart

 * Starting eth1

 *   Wireless radio has been killed for interface eth1                                                 

```

There's no corresponding output in syslog or dmesg.

----------

## UberLord

OK, this shows that your hardware radio button is currently "off". This probably means you an IPW based card.

cat /sys/class/net/eth1/device/rf_kill

If the value is 0 then we should be working, otherwise you will have to turn your wireless on using your laptop buttons. How you do this depends on your laptop. On my thinkpad z60m, there is a switch on the lower left corner front.

----------

## vad3r

You we're right. I forgott to enable the card   :Wink: 

It seems to work but i'll have to wait till i'm home to finally approve it. Thank you for your help

----------

## vad3r

Unfortunately it still isn't working. Her's the error message:

```
deathstar ~ # /etc/init.d/net.eth1 restart

 * Stopping eth1

 *   Bringing down eth1

 *     Shutting down eth1 ...                                             [ ok ]

 *     Stopping wpa_cli on eth1 ...                                       [ ok ]

 *     Stopping wpa_supplicant on eth1 ...                                [ ok ]

 * Starting eth1

 *   Starting wpa_supplicant on eth1 ...                                  [ ok ]

 *   Starting wpa_cli on eth1 ...                                         [ ok ]

 *     Failed to configure eth1 in the background                         [ !! ]

deathstar ~ # 

```

Nothing else to read in syslog etc.

----------

## UberLord

Wierd. What's the exact comandline you use that works?

----------

## vad3r

The working command line is:

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

Unfortunately there's no syslog output so i can give you no more hints. Is there a way to debug the init scripts??

----------

## UberLord

Yes. Although how easy depends on your technical skills. The file in question is /lib/rscripts/net/wpa_supplicant.sh

The line in question is 306. You could put set -x / set +x around it so that the startup commands are echoed to the screen.

I suggest trying wpa_supplicant-0.5.3 though before debugging.

Let me know of any patches!

----------

## psimsit

Ok I'll bite. I am running wpa_supplicant-0.5.3 and I still have that issue. Is line 306 still relevant and if so how do I wrap the -x / set +x around it? 

Edit  *** I forgot to mention baselayout-1.12.1

----------

## psimsit

Here are the relevant lines in my configs

wpa_supplicant.conf

```
cat /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=10

ap_scan=0

update_config=1

network={

        ssid="Closed"

        scan_ssid=1

        psk="SuperSecretKey"

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP

}

```

/etc/conf.d/net

```
cat /etc/conf.d/net

modules=( "wpa_supplicant" )

config_eth1=( "dhcp" )

wpa_supplicant_eth1="-Dwext -ieth1 -c/etc/wpa_supplicant.conf"

wpa_timeout_eth1=30

config_ESSID=( "Closed" )

dhcpcd_ESSID="-t 5"

```

----------

## psimsit

I fixed my problem I read the wpa_supplicant.conf.example and paid attention to the ap_scan part. Once I set it to 1 instead of zero my problem was fixed. I would mark this closed but I didn't start the thread.

----------

## UberLord

 *psimsit wrote:*   

> I fixed my problem I read the wpa_supplicant.conf.example and paid attention to the ap_scan part. Once I set it to 1 instead of zero my problem was fixed. I would mark this closed but I didn't start the thread.

 

Initial poster has ap_scan=1 in his config and it doesn't work for him ......

----------

## psimsit

thanks I noticed that's what turned me on to reading the example file.

----------

