Slow boot waiting for eth0?

eblack black.eric at gmail.com
Wed Feb 23 16:25:33 UTC 2005


On Wed, 2005-02-23 at 10:30 -0500, Graham Fawcett wrote:
> When I boot Ubuntu Hoary on my Dell Inspiron 8200, and I'm not
> connected to the LAN, the boot is delayed for a few minutes as it
> tries to bring up the eth0 interface. Frequently, I *am* connected to
> our LAN when booting; but when I'm not, the very long delay is
> frustrating.
> 

Yes it's very frustrating, especially if you use a wireless with
different access points or an ethernet connection not always connected

> What's the correct way to reduce the time spent blocking for an eth0
> connection during boot?
> 

What I did is to shut off the autoconnect at boot time and run 'sudo
ifup eth0' from the shell after startup.

For multiple setups, I created a couple of files in /etc/network and
have a script that I run as root to copy the appropriate file
to /etc/network/interfaces:


#!/bin/bash

NODE=`uname -n`

if [ "${NODE}" = "ubuntu" ] ; then
    if [ "$1" = "cc" ] ; then
        echo "Restarting CC..."
        sudo su -c "ifdown ath0;
cp /etc/network/interfaces-cc /etc/network/interfaces; ifup ath0;
ifconfig ath0;"
        echo "Done."
    else
        if [ "$1" = "cc2" ] ; then
            echo "Restarting CC2..."
            sudo su -c "ifdown ath0;
cp /etc/network/interfaces-cc2 /etc/network/interfaces; ifup ath0;
ifconfig ath0;"
            echo "Done."
        else
            if [ "$1" = "smc" ] ; then
                echo "Restarting SMC..."
                sudo su -c "ifdown ath0;
cp /etc/network/interfaces-smc /etc/network/interfaces; ifup ath0;
ifconfig ath0;"
                echo "Done."
            else
                echo
                echo "Usage: renet [cc|cc2|smc] or ifup eth0"
                echo
            fi
        fi
    fi
else
    # This stuff is for Fedora    
    if [ "$1" = "cc" ] ; then
        echo "Restarting CC..."
        sudo su -c "ifdown ath0;
cp /etc/sysconfig/network-scripts/ifcfg-ath0-cc /etc/sysconfig/network-scripts/ifcfg-ath0; ifup ath0; ifconfig ath0;"
        echo "Done."
    else
        if [ "$1" = "cc2" ] ; then
            echo "Restarting CC2..."
            sudo su -c "ifdown ath0;
cp /etc/sysconfig/network-scripts/ifcfg-ath0-cc2 /etc/sysconfig/network-scripts/ifcfg-ath0; ifup ath0; ifconfig ath0;"
            echo "Done."
        else
            if [ "$1" = "smc" ] ; then
                echo "Restarting SMC..."
                sudo su -c "ifdown ath0;
cp /etc/sysconfig/network-scripts/ifcfg-ath0-smc /etc/sysconfig/network-scripts/ifcfg-ath0; ifup ath0; ifconfig ath0;"
                echo "Done."
            else
                echo
                echo "Usage: renet [cc|cc2|smc] or ifup eth0"
                echo
            fi
        fi
    fi
#    /etc/init.d/network restart
fi


You could add the ifup eth0 as the default when no arg is given. Also,
this is really unnecessary if you use the Computer>System
Configuration>Networking gui, but I found it is faster with my script
(that is also where you shut off the autoconnect at boot up).

Hope this helps,
Eric





More information about the ubuntu-users mailing list