On Tue, Sep 30, 2008 at 11:17:39AM +0200, Frédéric BOITEUX wrote: > Hello, > > I'm trying to boot a Debian Live system from network (with PXE) on a > PC with 2 ethernet interfaces. It doesn't work because the bootable > ethernet interface (only one of the two) is recognized as 'eth1' by > udev, the other one as 'eth0', so the Debian Live system send > its DHCP request (to configure it, then mounting its filesystem by NFS) > on the wrong interface (it isn't connected). > > How can I do to use always the same Ethernet interface during the > whole boot process ? > > Fred. > Hello, as I had the same problem, I wrote a script which tries to find the first NIC which has a cable plugged in and uses it to get an address via DHCP. For me it works (two NICs, one with cable, one without). If you want to use it, you have to put it in the initramfs under scripts/init-premount. But don't ask me how to do that if you don't build your chroot by copying your host system. Maybe this script could be included into the official Debian-Live, but as it actually is a very dirty hack right now (it rewrites other parts of the initramfs for example), I doubt this will happen soon. However I put it into the attachment. Maybe it will help you a bit. HTH, Andreas -- Key fingerprint = F547 AB7E 8BF2 1399 DE2A 96CA 4BC2 476A EFEB 8C52
#!/bin/sh PREREQ="blacklist ps3 udev" prereqs() { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac if grep -q "BOOT=nfs" /conf/initramfs.conf; then udevsettle modprobe -q af_packet DEVICE_FOUND=0 while true; do # search for interfaces for i in /sys/class/net/eth*; do # get interface-names from pathnames interface=$(echo $i | busybox sed -r 's/.*\/(.*)/\1/'); # ATTR{carrier} is not set if this is not done ipconfig -c none -d $interface -t 1 &> /dev/null; sleep 5; if [ $(udevinfo -a -p "/class/net/$interface" | grep "ATTR.*carrier.*1") ]; then echo "Detected link on $interface, probing dhcp"; ipconfig -d "$interface" -t 10; fi; if [ ! $(udevinfo -a -p "/class/net/$interface" | grep 'ATTR.*operstate.*down') ]; then DEVICE_FOUND=1 break; fi done if [ $DEVICE_FOUND = 1 ]; then break; fi done mv /scripts/live /scripts/live_old echo export DEVICE=$interface > /scripts/live cat /scripts/live_old >> /scripts/live rm /scripts/live_old fi exit 0
Attachment:
signature.asc
Description: Digital signature