Bug 110164
Summary: | Long delay when initializing network card when cable is not connected | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Roel Gloudemans <roel> | ||||||
Component: | initscripts | Assignee: | Bill Nottingham <notting> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Brock Organ <borgan> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | 1 | CC: | dbaron, rvokal | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | i386 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2003-11-17 20:29:48 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Roel Gloudemans
2003-11-15 18:06:37 UTC
Created attachment 95994 [details]
Patch for /etc/sysconfig/network-scripts/network-functions
The patch changes the semantics of ethtool/mii-tool not being installed to mean 'immediately assume the link is up'. That's the wrong behavior. The result is the same in the old script. The return value of 2 also leads to the assumption the link is up. Anyway, wathever the solution may be, I think the current script is bugged. I don;'t wan't to wait for a minute (!) before the boot process resumes (especially since Fedora Core 1 is partially targeted at laptop users; laptop mode patch) OK, new solution Drop the modifications in check_ethtool and check_mii_tool. In the patch for check_link_down modify >while [ $timeout -le 10 ]; do > check_mii_tool $1 > m=$? > check_ethtool $1 > e=$? > if [ $m -eq 1 ] && [ $e -eq 1 ] ; then > return 1 > fi > if [ $m -eq 2 ] && [ $e -eq 2 ] ; then > return 1 > fi > usleep 500000 > timeout=$((timeout+1)) > done in >while [ $timeout -le 10 ]; do > check_mii_tool $1 > m=$? > check_ethtool $1 > e=$? > if [ $m -gt 0 ] && [ $e -gt 0 ] ; then > return 1 > fi > usleep 500000 > timeout=$((timeout+1)) > done Which does the same as the original patch and satisfies your comments on the original patch. Sorry, reading back at your original comments: if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP ; then # Forget the above if statement. Due to hotplug the network is # brought up when modprobing the networking card. Thus ifup is started # twice when starting /etc/init.d/network when no module is loaded # When one ifup is working, the second one will think the link is up Hotplug is *disabled* in /etc/init.d/network. # The above statement should use && instead of ||. No. That requires that any adapter support *both* methods, and that both methods reliably report the same data (in many cases, they don't.) If you've changed it as such, it *will* lead to longer startup times. sysctl -w kernel.hotplug="/bin/true" > /dev/null 2>&1 in /etc/init.d/network before ifup is executed. Also after modprobing the network module ifup is started. The second solution with the if statements is better than the original one. It does exactly the same with less statements. 'The second solution'? Which particular one are you referring to - all the solutions I've seen so far are based on the original false premises. I'm referring to the changes in comment #4, in which check_mii_tool en check_ethtool are unchanged. The if constructs in check_link_down are only based on a specific link down detection (first and second if construct in the while loop are mashed together). I don't know if you count that as a false premise. (OMG. Look at the time of your response; 02:32) I don't have the ability to reopen this bug, but I experienced the same regression when upgrading from RH9 to FC1, and it persisted in FC2 and FC3. The necessary patch seems to me to be moving a single line -- I'm not sure what all the other proposed changes by the bug reporter were for. (I previously blamed this issue on a change of network driver, since the machine in question has a Broadcom 4400, and that upgrade was when I switched from compiling the bcm4400 driver to using the provided b44 driver.) The problem seems to be that the test in check_link_down: if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP leads to most of the function being skipped. I'm not sure why the whole function gets skipped when the link is reported as "UP", or what the exact semantics of being "UP" are, but when doing "ifup eth0" with my b44, it's "UP" at this point in check_link_down (even though it wasn't before doing "ifup eth0"). I'll attach that patch shortly. Created attachment 106686 [details]
patch against Fedora Core 3 network-functions
This is the patch mentioned in the previous comment, with appropriate
reindenting (and fixes for a bit of the indentation in the function being
off-by-one).
As a |diff -U10 -b| it looks like this (much clearer):
check_link_down ()
{
if [ -x /sbin/mii-tool -o -x /sbin/ethtool ]; then
if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP ; then
ip link set dev $1 up >/dev/null 2>&1
+ fi
timeout=0
while [ $timeout -le 10 ]; do
check_mii_tool $1
m=$?
check_ethtool $1
e=$?
if [ $m -eq 1 ] || [ $e -eq 1 ] ; then
return 1
fi
if [ $m -eq 2 ] && [ $e -eq 2 ] ; then
return 1
fi
usleep 500000
timeout=$((timeout+1))
done
return 0
- fi
fi
return 1
}
Added, will be in 7.97-1 An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2005-123.html |