# wpa_supplicant fails at startup[SOLVED]

## nadi

Hei gentooers!

I am starting this thread, as a desperate attempt to get my wireless network to go up at startup. I tried wireless_tools, but with no success (https://forums.gentoo.org/viewtopic-t-446968.html ).

I cannot get my wpa_supplicant with madwifi to start at boot. I CAN get it to work manually, using the following command: 

```
nadi linux # wpa_supplicant -iath0 -c /etc/wpa_supplicant.conf -Dmadwifi -d -B

```

which is fine, and then doing 

```
 dhcpcd ath0 
```

and everyhting fine, I have network. But at boot time, or using /etc/init.d/net.ath0 restart, 

I get the next (TERRIBLE) message  

```

nadi etc # init.d/net.ath0 start

 * Caching service dependencies ...

 *  Cannot add provide 'authdaemond', as a service with the same name exists!                                                                    [ ok ]

 * Starting ath0

 *   Starting wpa_supplicant on ath0 ...                                                                                                         [ ok ]

 *     timed out                                                                                                                                            [ !! ]

```

my /etc/wpa_supplicant.conf is 

```
ctrl_interface_group=0

#eapol_version=1

ap_scan=2

#fast_reauth=1

# Static WEP keys

ctrl_interface=/var/run/wpa_supplicant

network={

        ssid="felix"

        key_mgmt=NONE

        wep_key0="xxxxxxxxxx"

        wep_tx_keyidx=0

        priority=5

}

```

my /etc/conf.d/net is 

```

modules=( "!iwconfig" )

#------------------------------------------

# for use of wpa_supplicant

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-B -Dmadwifi"

config_felix=( "dhcp" )

dhcpcd_felix="-t 25 -D -N"

```

Any ideas why it does not start using the init.d/net.ath0 start? 

Nadi

EDIT: 

kernel 2.6.15, 

wpa_supplicant 0.4.8

madwifi-tools-0.1485.20060325

madwifi-driver 0.1485.20060325Last edited by nadi on Thu May 25, 2006 7:34 am; edited 1 time in total

----------

## msalerno

Check out

https://forums.gentoo.org/viewtopic-t-437101-highlight-wpasupplicant.html

In short: set wpa_timeout_ath0=90 in /etc/conf.d/net

----------

## nadi

thanks msalerno, but alas, i does not work. I tried 90 sec, it still time out.

I dont understand why it times out when using init.t/net.ath0 restart, but not if I do it manually, 

```
wpa_supplicant -iath0 -c /etc/wpa_supplicant.conf -Dmadwifi -d -B

dhcpcd ath0

```

then it takes only 10 seconds to get the wireless functioning. I guess wpa_supplicant config is ok, since it is working manually, but something is wrong with the dhcpcd, my config files seems ok! It is the same problem you had at https://forums.gentoo.org/viewtopic-t-437101.html , but 90 sec in conf.d/net did not work for me. 

Other ideas?

Anyone? Uberlord???

----------

## opopanax

From what I've heard, and look on some posts 'round here, later versions of wpa_supplicant and madwifi don't play.  I had a card that worked with madwifi just fine, but wpa was out of the question.  However, I was able to use ndiswrapper--that may be a (less elegant) solution for you as well.

----------

## nadi

thanks.

Again, I dont see any reason why wpa_suplpicant will work from the command line, and NOT from boot. wpa_supplicant is working, but DHCP does not bring up the network regardless of the timeout value. 

dhcp DOES bting up the network if, after giving the command 

```
wpa_supplicant -iath0 -c /etc/wpa_supplicant.conf -Dmadwifi -d -B 

```

I am then writing 

```

dhcpcd ath0 

```

Is something wrong with net.lo? because this stuff does not work automatically, when writing /etc/init.d/net.ath0 restart. 

aarrrgrgrgrgrgrgggggg   :Evil or Very Mad: 

----------

## braindead0

Just chiming in here with the same problem.

My guess is that for some reason the init script isn't seeing that the interface is 'up' so it doesn't continue with dhcp and the like.  When I turned on debugging of wpa_supplicant, the last line that came out was 'Daemon' (or something similar).  From there the script simply times out.

That of course doesn't answer why it will start from as console prompt, but pretty much nowhere else.

I tried starting it in local.start, no luck there.  I tried starting when I login to bash, no luck there.  I even put it in my icewm startup script, again that didn't work.

This is very very odd methinks.

----------

## nadi

I have a small irritating solution: put the two lines above (wpa_supplicant and dhcpcd) in local.start. Then by doing init.d/local restart, you get the network, and at boot, it will start anyway local, so you get a network. 

But this is really only a painkiller to a bad desease, not a cure....

Nadi

----------

## braindead0

After reading your post earlier, I thought about that.. then I thought I'd try something else... I changed the settings on ath0 to a static IP address.  

Not sure if it worked or not yet as this system is at home... although it does seem to be dead at this point (ssh'd into another box).. I may have messed up the configuration in net.

If that doesn't work, I'll go your suggested route just to get the darned thing to startup.

Now if I can figure out why it goes down.. I've got safetynet monitoring it and it appears that wpa_supplicant crashes at least on occassion.  I'll know more of course when I can see how often it happens..

----------

## braindead0

Just a follow up, I tried setting my IP to static just to see if it's an issue with DHCP.  That didn't help.

I worked around this with the irritating solution noted by nadi  :Wink: 

----------

## Bombs14

I have the same problem, and it seems to not only connect to the access point if the access point needs an authentication key. If I remove the key needed to connect to the access point, the wireless card will connect to the access point on startup.

----------

## braindead0

I'm going to try and debug this problem, as best I can tell the likely problem is in /lib/rcscripts/net.modules.d/wpa_supplicant.

The 'wpa_supplicant_pre_start()' function in that file might be what's timing out.  Why it works from command line I'm not sure.  If I find the problem I'll report back here of course.

----------

## WackyDoo

 *nadi wrote:*   

> thanks.
> 
> Again, I dont see any reason why wpa_suplpicant will work from the command line, and NOT from boot. wpa_supplicant is working, but DHCP does not bring up the network regardless of the timeout value. 
> 
> dhcp DOES bting up the network if, after giving the command 
> ...

 

It think it is some weird timing problem.  I am using wpa-psk (not wpa2) on my dlink di-624 with recent wpa_supplicant and madwifi from portage.  On my machine with a dlink pci wireless card, DHCP from the di-624 works fine under windows but times out under linux.  If I manually configure an IP address all is fine.

Last night I disabled DHCP on the router and enabled dnsmasq from portage on another wired gentoo box.  Now my wireless works using DHCP under linux! [ Edit: WPA2 also works now, and has a much faster association.  Maybe my timeout problems have gone away?]

My biggest frustration is that after a period of inactivity, the wireless machine (192.168.2.3)  seems to drop out of the router's (192.168.2.1) routing tables.  When I ping it from the the wired machine (192.168.2.2) I get no reply:

```

junior ~ # ping 192.168.2.3

PING 192.168.2.3 (192.168.2.3) 56(84) bytes of data.

--- 192.168.2.3 ping statistics ---

3 packets transmitted, 0 received, 100% packet loss, time 2009ms

junior ~ # ip route

192.168.2.0/24 dev br0  proto kernel  scope link  src 192.168.2.2 

127.0.0.0/8 dev lo  scope link 

default via 192.168.2.1 dev br0 

```

Last edited by WackyDoo on Sat Apr 15, 2006 8:27 pm; edited 1 time in total

----------

## salivian

I recently encounter a similar problem ...

are you using bash 3.1 or 3.0 ?

----------

## John-Boy

 *salivian wrote:*   

> I recently encounter a similar problem ...
> 
> are you using bash 3.1 or 3.0 ?

 

I'm using ndiswrapper,  just upgraded bash and wpa_supplicant is playing up for me, funny you should mention it.

----------

## Rüpel

I just wanted to say "Hello, here's another one with the same problem."   :Confused: 

I'm using ndiswrapper ( :Twisted Evil: ) and I tried both, dhcp and fixed setup. set up manually everything works. set up via conf.d/net and started via init.d/net.wlan0 I also get the unfriendly "timed out !!" message.   :Sad: 

Did someone already file a bug on that issue?

----------

## salivian

if you are running bash 3.1 and have a similar problem with wpa_supplicant.

please take a look at my answer at ... 

https://forums.gentoo.org/viewtopic-p-3259998.html#3259998

I think someone can fix it better than my adhoc solution

----------

## braindead0

I tried the solution from that thread, still failed.  The interesting this was after adding net.ath0 back to default, and shutting down my local startup of the nic.. running rc started up net.ath0 (which is better than I had before).

After rebooting though, it still times out...arg...

Now if I can just figure out why my card drops connection every now and again...hopefully I can fix that by moving my wap around or something (link quality runs around 35/94.. probably not good)

----------

## nadi

Hei, braindead0, I have the same thing here. we have problably the same bug AND my connection drops every now and then, I did not find any consistency.

I actually gave up and when back to my good stable 2.6.12, everyhting is working fine, though I dont have suspend2 there.

Nadi

----------

## fennex

Just a quick note:

Working fine here with: 

```
sys-kernel/gentoo-sources-2.6.12-r9

net-wireless/wpa_supplicant-0.4.8

net-wireless/madwifi-ng-0.1502.20060414

net-wireless/madwifi-ng-tools-0.1502.20060414
```

Fennex

----------

## braindead0

 *fennex wrote:*   

> Just a quick note:
> 
> Working fine here with: 
> 
> ```
> ...

 

Thanks for the details on that, I think I'll back my kernel down to 2.6.12.  This is just a MythTV box and fully protected, so I probably don't need to keep worry too much about kernel upgrades.

I'll get all my versions matching that and should have results back soon.

ack, question.. how do I get 2.6.12?  It doesn't appear to be in portage anymore, and silly me.. I clean out my sources on a fairly regular basis.  I do have 2.6.12-r10 on a box at home....

----------

## nadi

well, it always worked for me at kernel 2.6.12-r6, both wpa_supplicant and iwconfig methods. BUT, I am using suspend2 patches to kernel 2.6.15-r8 and I did not find patches for 2.6.12 kernels. I really need this suspend2 staff, it is SO much easier with laptop to just close the lid or suspend to disk and then re-initiate in no-time. It is just that the wireless network is broken for 2.6.15. 

Oh well, let us hope it will be fixed in 2.6.16. If I could contribute in a way, but I am not a programmer...

N

----------

## braindead0

I'm about to try out 2.6.16-r3, I'll not know the results until I get home tonight, and of course I'll not know for sure if the wireless dropping out is fixed for a while.  But I should be able to try out the startup problem.

----------

## braindead0

Well that idea failed miserably...  Well, nvidia kernel driver wouldn't load on that kernel (something about the license tainting the kernel) and I couldn't get the wifi to startup at all.

The really weird thing now is that I went back to the old kernel, rebuilt madwifi/wpa/nvidia/alsa..etc..etc....

And now the wifi doesn't work at all, running wpa_supplicant with -dd gives me lots of info, it starts and then stop for a bit at:

<EDIT>

Found what broke there, in an attempt to get madwifi to work with the later kernel, I used ~x86 keyword, took that out of package.keywords and badabing, back where I was before.. at least it appears to work..

----------

## braindead0

Okay, figured what the heck and added ~x86 to baselayout.. now it appears that starting up ath0 via the normal rc_scripts it working fine.

I'll have to monitor it to see if the dropouts go away.. I have a feeling that this particular NIC may not be so good.  My link quality now is Link Quality=49/94, I'd expect better with the WAP sitting about 8' away in the same room..  I know the WAP is good as my laptop and pocket PC both show really high signal strength.. or perhaps the 'link quality' isn't the same measurement...

----------

## braindead0

Still dropping the interface, but at least now I can simply restart net.ath0.

One caveat, baselayout 1.12 forks the init of interfaces off into the background so in this case it doesn't finish starting up when ntp-client starts for example, I'm sure this could cause other problems but that's the only one I'm having at this time.

edit: turns out that dhcpcd runs for a short bit and seems to die when booting up.. I don't get an addy at that point.. restart of net.ath0 gets an addy and everything is fine.. perhaps now I need to tweak the timeout (I think I've got it set to 10 or something)....

arg...

 :Wink: 

----------

## SvenFischer

Hey people,

the connection always works if i start wpa_supplicant manually, but not the init script.

I tried adding in/etc/conf.d/net one line above wlanconfig

```

/sbin/wlanconfig ath0 destroy

/sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta

```

This brings the the ath0 up, but dhcp is not working...

If you guys find a solution, please post your conf.d/net

----------

## nadi

IT IS WORKING; F I N A L L Y !

look at the post https://forums.gentoo.org/viewtopic-p-3337701.html#3337701

The developers of baselayout/madwifi ( I guess it is madwifi) got it fixed finally. install the latest (unstable) baselayout, madwifi-ng-tools, madwifi-ng and ifplugd (important, I got kernel panic without it.)

good luck.

Nadi

----------

## braindead0

Were you using netplug when you got the kernel panic (as noted in the other thread you mentioned)?  I'm just wondering if I need to install ifplugd even though I'm not using any network hotplug services.

----------

## nadi

Hei,

sorry for ht elate reply. I did not need to install ifplugd at all, I think it did it automagically while installing the new wpa_supplicant and madwifi (I have no time to check the ebuilds). 

Nadi

----------

