FS#13334 - [netcfg] PRE_UP not working properly with ifconfig
Attached to Project:
Arch Linux
Opened by Fabio Zanini (iosonofabio) - Tuesday, 17 February 2009, 10:29 GMT
Last edited by James Rayner (iphitus) - Saturday, 27 June 2009, 01:49 GMT
Opened by Fabio Zanini (iosonofabio) - Tuesday, 17 February 2009, 10:29 GMT
Last edited by James Rayner (iphitus) - Saturday, 27 June 2009, 01:49 GMT
|
Details
Description:
After I boot my system and log in (TTY or X-server), I have to execute netcfg TWICE to get my ethernet connection to work: $ sudo netcfg eth Password: :: eth up - No connection available [FAIL] $ sudo netcfg eth :: eth up [DONE] $ I put an 'ifconfig eth0 up' command into PRE_UP (see below). After this, every other attempt to load the profile works. The bug is seen only in the first attempt after boot. Additional info: * package version(s) core/netcfg 2.1.2-1 * config and/or log files etc. My ethernet profile is /etc/network.d/eth and look like this: CONNECTION="ethernet" DESCRIPTION="using dhcp" INTERFACE=eth0 IP="dhcp" DHCP_TIMEOUT=10 PRE_UP='sudo ifconfig eth0 up' POST_DOWN='sudo ifconfig eth0 down' I also tried with double quotes "" instead of single quotes ''. Same problem. Also tried with POST_UP instead of PRE_UP. Same problem. Steps to reproduce: I'm using netcfg to manage both ethernet and wireless. network daemon is not started at boot (see wiki). Neither net-profiles nor net-auto are started at boot. |
This task depends upon
Also, it could be that your networkcard is a bit slow in getting the link up, could you try to change the PRE_UP to "ifconfig eth0 up && sleep 1"?
The sudo before ifconfig is not necessary, I just put it for oversecurity. I tried the suggestion you say, but it doesn't change. Moreover, if I take the ethernet interface down after it has worked once, and then reput it up, it works as supposed to.
That is, if the eth card is slow, it is slow just the first time after booting, every other time is just quick enough. Strange, isn't it?
PRE_UP='ifconfig eth0 up && sleep 3'
now it works. It needs in total 10 seconds to connect, but it works. I tick the bug as solved, even if that is not completely true.
Thanks
Fabio: Would you be able to blacklist your ethernet driver, and then run this for me after boot. Run it as a script, not individual commands as I want the output of ip at each time.
modprobe drivername
ip link
sleep 1
ip link
sleep 20
ip link
I'm just curious if ip shows any indication that the driver is not ready. In the meantime you could also push networking back in your startup.
From what I can understand, everything looks ok. Anyway, now the netcfg is working with 2 second sleep instead of 3; this is 33% better :-) (this is indipendent from loading the module at boot time or later).
ethcheck2.log (3.1 KiB)
It's possible other hardware might have similar issues, like wireless hardware loading firmware.
while ip link show $INTERFACE|grep -q "state UNKNOWN";
do
sleep 0.5
done
(except without infinite loop chance)
while !(ip link show $INTERFACE|grep -q "state UP")
do
sleep 0.5
done
Another option could be to add a line similar to the IWCONFIG for wireless.
I don't think that adding a sleep by default is a good idea; network cards are generally quick, they would be delayed.
I'm not sure whether this could affect more drivers than just e1000e, or whether drivers are legitimately allowed to take this time.
I seem to have a similar problem : "netcfg eth" has to be run twice to work with my ethernet connection.
- I use netcfg 2.1.3-2
- my driver is sky2
- I tried to add PRE_UP as stated above (even with sleep 5)
- I run the ethcheck2 script, and link is UP 2 seconds after ifconfig.
May I suggest a simple (yet unelegant) workaround : if first attempt fails, re-run everything from beggining.
Otherwise netcfg rocks !
IMHO, an elegant solution would be to add a grep UP to the netcfg script, but I do not know whether it is a feasible solution for the programmer (Iphitus?)
Some more changes for this in -b3.
[1] http://bbs.archlinux.org/viewtopic.php?pid=563710#p563710