Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
wpa_supplicant/dhcpcd won't get an IP when run during boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
amoe
n00b
n00b


Joined: 23 Apr 2006
Posts: 18

PostPosted: Mon Feb 09, 2009 9:52 pm    Post subject: wpa_supplicant/dhcpcd won't get an IP when run during boot Reply with quote

It's quite difficult to explain what's going on here. However, I'll have a go.

I use wpa_supplicant with an orinoco_pci card to connect to a network using 64-bit WEP.
I use dhcpcd to get an IP as per the Gentoo wireless guide.

When I boot my machine, wpa_supplicant starts from /etc/init.d/net.eth0. I can see because it spews a lot of errors to the screen:

Code:
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 7 value 0x1 - ioctl[SIOCSIWENCODEEXT]: Operation not supported
ioctl[SIOCSIWENCODEEXT]: Operation not supported
ioctl[SIOCSIWENCODE]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Operation not supported
ioctl[SIOCSIWENCODE]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Operation not supported
ioctl[SIOCSIWENCODE]: Invalid argument
ioctl[SIOCSIWAUTH]: Operation not supported
WEXT auth param 4 value 0x0 - ioctl[SIOCSIWAUTH]: Operation not supported


However, it starts fine, and goes to the background. Running wpa_cli after boot produces the following:

Code:
Selected interface 'eth0'

Interactive mode

> status
bssid=00:14:6c:d4:aa:12
ssid=konata-chan
id=0
pairwise_cipher=WEP-40
group_cipher=WEP-40
key_mgmt=NONE
wpa_state=COMPLETED


So as you can see it's associated, however, there's no IP address yet:

Code:
root@moaner # ping 192.168.1.1
connect: Network is unreachable


So I try to restart the interface:

Code:
root@moaner # /etc/init.d/net.eth0 restart


Exactly the same output as before, with the bizarre errors. But now, I open wpa_cli:

Code:
> status
bssid=00:14:6c:d4:aa:12
ssid=konata-chan
id=0
pairwise_cipher=WEP-40
group_cipher=WEP-40
key_mgmt=NONE
wpa_state=COMPLETED
ip_address=192.168.1.5

root@moaner # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=5.68ms


As you can see, it got an IP address fine. This is reproducible boot after boot. My question is: why am I having to do this? Why does the machine not just get an IP address when /etc/init.d/net.eth0 is first run, at boot time?

Thanks for any help.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Feb 09, 2009 10:59 pm    Post subject: Reply with quote

I have this problem too, I start manually my wireless too with /etc/init.d/net.wlan0 start.

Maybe with baselayout 2, this problem will be solve.
Back to top
View user's profile Send private message
hampel
n00b
n00b


Joined: 26 Jul 2007
Posts: 55

PostPosted: Mon Feb 09, 2009 11:31 pm    Post subject: Reply with quote

Since my network comes up just fine, heres my /etc/conf.d/net:

Code:
michael@pluto ~ $ cat /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 /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"
wpa_timeout_wlan0=5
iface_wlan0="dhcp"


I'm using an Intel 3945 though... you might have to change the driver line to your needs...
FYI: Using an "almost stable" system (all stable except some apps)
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Feb 09, 2009 11:34 pm    Post subject: Reply with quote

A timeout, didn't know that we can tweak that :P
Back to top
View user's profile Send private message
hampel
n00b
n00b


Joined: 26 Jul 2007
Posts: 55

PostPosted: Mon Feb 09, 2009 11:43 pm    Post subject: Reply with quote

its the most important part ;)
you know about "ifplugd"? Nice tool that checks first if a ethernet cable is pluged into your ethernetcard _before_ it tries to get a ip adress...
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2234

PostPosted: Tue Feb 10, 2009 12:34 am    Post subject: ntp-client seems to suffer this too - now - on baselayout2 Reply with quote

Interesting - sometime in the past month or two, ntp-client's not been getting the time on my system. It looks like the same issue - net.eth0 returned before the network was ready. I thought it was a DNS issue, put it down to me "optimising" my boot time by installing OpenRC and baselayout2, and enabling parallel init scripts. If you're hitting this with WPA supplicant, I wonder if something else has changed. I've no timeout in my conf.d/net script, and never needed one before.
_________________
Greybeard
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Tue Feb 10, 2009 10:26 pm    Post subject: Reply with quote

I think that networkmanager can handle these kind of thing.
Back to top
View user's profile Send private message
hampel
n00b
n00b


Joined: 26 Jul 2007
Posts: 55

PostPosted: Tue Feb 10, 2009 10:39 pm    Post subject: Reply with quote

if your are looking for a GUI, there's also
Quote:
enceladus michael # eix wicd
* net-misc/wicd
Available versions: 1.5.2 1.5.4 ~1.5.6 ~1.5.7-r1 ~1.5.8 ~1.5.9
Homepage: http://wicd.sourceforge.net/
Description: A lightweight wired and wireless network manager for Linux

which comes with an init-script
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Feb 11, 2009 8:23 am    Post subject: Re: wpa_supplicant/dhcpcd won't get an IP when run during bo Reply with quote

amoe wrote:
As you can see, it got an IP address fine. This is reproducible boot after boot. My question is: why am I having to do this? Why does the machine not just get an IP address when /etc/init.d/net.eth0 is first run, at boot time?


The main issue is this - the existing scripts are a kludge that sometimes don't work (disclaimer - they always worked for me).
The solution is this - launch wpa_supplicant and dhcpcd-4.99 as separate daemons. When wpa_supplicant assoicates, it will notify the kernel that the link is up and dhcpcd will then attempt to get an address. However, there are no init scripts for this yes, although I will be making them available soon.

This does NOT solve the problem of the network devices having a working IP address at boot. A possible solution would be to create /etc/dhcpcd.exit-hook to ensure that ntp-date is first run at boot. Something like this

Code:

start_ntp_date()
{
   [ -e /var/run/ntp-date.lock ] && return
   printf "">/var/run/ntpd-date.lock
   /etc/init.d/ntp-date --quiet start
}

case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)       start_ntp_date;;
esac


That hook also works for dhcpcd-4.x in portage.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
amoe
n00b
n00b


Joined: 23 Apr 2006
Posts: 18

PostPosted: Wed Feb 11, 2009 8:27 pm    Post subject: Reply with quote

I have now tried setting the timeout value, and it didn't make any difference. I enclose /etc/conf.d/net below:

Code:
config_eth0=( "dhcp" )
modules=( "wpa_supplicant" )
wpa_supplicant_eth0="-Dwext"


d2_racing: do you mean that NetworkManager is a possible solution to my original problem, or one of the follow-ups?

Thanks for your help, everyone.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Wed Feb 11, 2009 10:14 pm    Post subject: Reply with quote

I think that networkmanager can solve your problem.
Back to top
View user's profile Send private message
SlashBeast
Retired Dev
Retired Dev


Joined: 23 May 2006
Posts: 2922

PostPosted: Wed Feb 11, 2009 11:36 pm    Post subject: Reply with quote

Or wicd.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Thu Feb 12, 2009 1:57 am    Post subject: Reply with quote

In fact :P

The wifi connection is started when your WM is running, so you cannot have some weird wpa or driver timeout problem.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Feb 12, 2009 9:47 am    Post subject: Reply with quote

How does that ensure that ntp-date is run after wicd or NetworkManager brings up a connection AND ensure it only does it once?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Thu Feb 12, 2009 12:34 pm    Post subject: Reply with quote

Start manually the ntp service once you have a running Wifi.

I have no idea actually....
Back to top
View user's profile Send private message
SlashBeast
Retired Dev
Retired Dev


Joined: 23 May 2006
Posts: 2922

PostPosted: Thu Feb 12, 2009 2:35 pm    Post subject: Reply with quote

d2_racing wrote:
In fact :P

The wifi connection is started when your WM is running, so you cannot have some weird wpa or driver timeout problem.


If you use wicd, wifi is started at boot (when service wicd is started), I dont use dhcp for my home wifi and i have internet connection after 1-2s after starting wicd.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Thu Feb 12, 2009 3:06 pm    Post subject: Reply with quote

I think that networkmanager only start the Wifi when you are log in....
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum