Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    loopback doesn't come up correctly on boot


    EDIT: Moving this post to Ubuntu. Now I think it's distro-centric. Sorry.


    Running Ubuntu 6.06 Universe (I know, but this looks like a non-specific problem).

    When my machine reboots, the lo interface is not configured correctly. I can manually fix it easily, but do not understand why it would have this problem. I have already searched the Ubuntu forums and have not found any answer.

    After booting into runlevel 2 (default):

    #ifconfig:
    eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
    inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: xxxx:xxxxxxxxxxx/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:26448 errors:0 dropped:0 overruns:0 frame:0
    TX packets:28757 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:4561028 (4.3 MiB) TX bytes:15015965 (14.3 MiB)
    Interrupt:201 Base address:0xc000
    #ifconfig lo
    o Link encap:Local Loopback
    LOOPBACK MTU:16436 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
    Note: it's missing the 'inet addr' line.

    #ifup -v lo
    ifup: interface lo already configured
    Then I run 'ifdown lo', and run ifup again:
    #ifup -v lo
    Configuring interface lo=lo (inet)
    run-parts --verbose /etc/network/if-pre-up.d
    run-parts: executing /etc/network/if-pre-up.d/wireless-tools
    run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
    ifconfig lo 127.0.0.1 up
    run-parts --verbose /etc/network/if-up.d
    run-parts: executing /etc/network/if-up.d/mountnfs
    run-parts: executing /etc/network/if-up.d/ntpdate
    run-parts: executing /etc/network/if-up.d/postfix
    And after running that last command, I get this:
    #ifconfig lo
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
    At this point, things are working (although I have to restart some services for them to bind correctly to localhost).

    /etc/network/interfaces:
    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.254
    I also checked the /etc/network/*.d scripts- all of them exit when asked to operate on lo.


    Here's the startup scripts:
    /etc/rcS.d/S08loopback ->../init.d/loopback
    #!/bin/sh -e
    #
    # loopback - brings up the loopback (127.0.0.1) network device so that
    # DHCP and other such things will work
    #

    # Check the package is still installed
    [ -x /sbin/ifup ] || exit 0

    # Get LSB functions
    . /lib/lsb/init-functions
    . /etc/default/rcS

    case "$1" in
    start)
    [ -d /var/run/network ] || mkdir /var/run/network

    log_begin_msg "Starting basic networking..."
    if ifup -v --allow auto lo; then
    log_end_msg 0
    else
    log_end_msg $?
    fi
    ;;
    stop)
    log_begin_msg "Stopping basic networking..."
    if ifdown lo; then
    log_end_msg 0
    else
    log_end_msg $?
    fi
    ;;
    restart|force-reload)
    exit 0
    ;;
    *)
    echo "Usage: /etc/init.d/loopback {start|stop|restart|force-reload}"
    exit 1
    ;;
    esac

    exit 0
    /etc/rcS.d/S40networking -> ../init.d/networking
    #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides: networking
    # Required-Start: mountvirtfs ifupdown $local_fs
    # Default-Start: S
    # Default-Stop: 0 6
    ### END INIT INFO

    PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

    [ -x /sbin/ifup ] || exit 0

    . /lib/lsb/init-functions


    case "$1" in
    start)
    log_action_begin_msg "Configuring network interfaces"
    type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
    if [ "$VERBOSE" != no ]; then
    if ifup -a; then
    log_action_end_msg $?
    else
    log_action_end_msg $?
    fi
    else
    if ifup -a >/dev/null 2>&1; then
    log_action_end_msg $?
    else
    log_action_end_msg $?
    fi
    fi
    type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
    ;;

    stop)
    if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts |
    grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
    log_warning_msg "not deconfiguring network interfaces: network shares still mounted."
    exit 0
    fi

    log_action_begin_msg "Deconfiguring network interfaces"
    if [ "$VERBOSE" != no ]; then
    if ifdown -a --exclude=lo; then
    log_action_end_msg $?
    else
    log_action_end_msg $?
    fi
    else
    if ifdown -a --exclude=lo >/dev/null 2>/dev/null; then
    log_action_end_msg $?
    else
    log_action_end_msg $?
    fi
    fi
    ;;

    force-reload|restart)
    log_action_begin_msg "Reconfiguring network interfaces"
    ifdown -a --exclude=lo || true
    if ifup -a --exclude=lo; then
    log_action_end_msg $?
    else
    log_action_end_msg $?
    fi
    ;;

    *)
    echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
    exit 1
    ;;
    esac

    exit 0
    Any ideas? I have seen some posts that contain the following additional lines in their interfaces file:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    address 127.0.0.1
    netmask 255.0.0.0

    I have also been told to try addding:
    mapping hotplug
    script grep
    map lo
    but I think that would require installing a hotplug module/service, and I would rather figure out what's wrong now.

    Last question- is there a way, other than changing what's in rcS.d, to boot into single-user mode, run scripts manually, and check to see which one, if any, is screwing up the interface?

    Thanks!

  2. #2
    I had this same problem and have fixed it.

    In my situation, I noticed upon bootup that there was a message about '/var/run/network'. I cannot remember if it said it didn't exist or if it couldn't create it. Seems strange to me since /etc/init.d/networking runs as root and should be able to determine if the directory exists, and if not, create it.

    At any rate, I created it manually:
    sudo mkdir /var/run/network

    I noticed subsequent bootups were very slow when attempting to setup the network interfaces. After it finished bootup, a file called /var/run/network/ifstate now existed. Attempting to restart the network interfaces with "sudo /etc/init.d/network restart" did nothing to help the loopback device. However, strangely enough, after removing the file with "sudo rm /var/run/network/ifstate" and then restarting the network, all is well.

    Maybe this was an isolated issue on my workstation, but I thought I would pass it along in case others are having the same issue. It seems to me that it is a bug in the network interface script(s) and possibly the package needs to be updated in the debian sources.

  3. #3

    Thanks for the info...

    -->
    My system has the /var/run/network folder, and it does contain the ifstate file.

    But I am not sure that file is the problem:
    $ cat /var/run/network/ifstate
    lo=lo
    eth0=eth0
    eth0:0=eth0:0

    This looks right to me.

$spacer_open
$spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •