[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1069048: marked as done (live-boot fails to DHCP on all NICs with link up)



Your message dated Tue, 12 Nov 2024 12:06:24 +0000
with message-id <E1tApf6-0063H3-89@fasolo.debian.org>
and subject line Bug#1069048: fixed in live-boot 1:20240525.1
has caused the Debian Bug report #1069048,
regarding live-boot fails to DHCP on all NICs with link up
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1069048: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069048
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: live-boot
Version: 1:20230131
Severity: important
Tags: patch


Hi,

The current behavior of live-boot is to search 5 times for network
interfaces with the carrier link up. On each run, as soon as there
is one interface with link up, the script will exit, leaving no time
for other NICs to be up in any eventual subsequent run.

This only works if:
- one is lucky
- if only the interfaces with DHCP have an actual ethernet link.

For cases where there is more than one interface with the link up,
but only one is connected to a DHCPd server, it is possible that it
will fail (depending which card will have the link first).

The attached patch changes the behavior: it makes sure that all cards
with a link that is up are reported in /conf/param.conf before
exiting, so that live-boot will try to get an IP address from
all cards with link up. Each card continues to have a 15 seconds
timeout (by default) to get the IP address from DHCP.

We've tested this patch in production, with such a case where it
was failing (ie: our 25Gbits/s cards were detected first, but were not
connected to a DHCP server, while the 1Gbits/s cards that were supposed
to be holding the network boot were never tried by live-boot). And
this patch fixed things for us.

Please merge this patch if you feel like it's correct. I also would
like to have it fixed in Stable if possible (once I have the approval
from the team).

Cheers,

Thomas Goirand (zigo)

P.S: If one would like to test it, the easiest way is to build a
Debian live the normal way, then unpack the ramdisk with cpio with
something like this:
zstdcat <path-to-initrd> | | cpio -idmv

Then recompress like this:
find . | cpio --create --format='newc' | zstd > <path-to-initrd>

If running an older version of Debian, replacing zstdcat by zcat and
zstd by "gzip -9" also works.
>From 899aa9e8625570137fc57c4ed675bcb090119ace Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo@debian.org>
Date: Mon, 15 Apr 2024 15:40:46 +0200
Subject: [PATCH] Do DHCP on multiple interfaces

The current behavior of live-boot is to search 5 times for network
interfaces with the carrier link up. If there is more than one
interface, but only one is found during a run, then it currently
gives-up searching for other interfaces and exits.

This works if one is lucky, or if only the interfaces with DHCP
have an actual ethernet link. For cases where there is more than
one interface with the link up, but only one is connected to a
DHCPd server, it is possible that it will fail (depending which
card will have the link first).

This patch changes the behavior: it makes sure that all cards
with a link that is up are reported in /conf/param.conf before
exiting, so that live-boot will try to get an IP address from
all cards with link up. Each card continues to have a 15 seconds
timeout (by default) to get the IP address from DHCP.
---
 components/9990-select-eth-device.sh | 68 ++++++++++++++++------------
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/components/9990-select-eth-device.sh b/components/9990-select-eth-device.sh
index b660a3d..719a234 100755
--- a/components/9990-select-eth-device.sh
+++ b/components/9990-select-eth-device.sh
@@ -93,46 +93,56 @@ Select_eth_device ()
 	fi
 
 	found_eth_dev=""
-	while true
+	echo -n "Looking for a connected Ethernet interface."
+
+	for interface in $l_interfaces
 	do
-		echo -n "Looking for a connected Ethernet interface ..."
+		# ATTR{carrier} is not set if this is not done
+		echo -n " $interface ?"
+		ipconfig -c none -d $interface -t 1 >/dev/null 2>&1
+		sleep 1
+	done
+
+	echo ''
 
+	for step in 1 2 3 4 5
+	do
 		for interface in $l_interfaces
 		do
-			# ATTR{carrier} is not set if this is not done
-			echo -n " $interface ?"
-			ipconfig -c none -d $interface -t 1 >/dev/null 2>&1
-			sleep 1
-		done
-
-		echo ''
+			# Skip the interface if it's already found.
+			IN_IT=no
+			for DEV in $found_eth_dev ; do
+				if [ "${DEV}" = "$interface" ] ; then
+					IN_IT=yes
+				fi
+			done
 
-		for step in 1 2 3 4 5
-		do
-			for interface in $l_interfaces
-			do
+			if [ "${IN_IT}" = "no" ] ; then
 				ip link set $interface up
 				carrier=$(cat /sys/class/net/$interface/carrier \
 					2>/dev/null)
 				# link detected
-
-				case "${carrier}" in
-					1)
-						echo "Connected $interface found"
-						# inform initrd's init script :
+				if [ "${carrier}" = 1 ] ; then
+					echo "Connected $interface found"
+					# inform initrd's init script :
+					if [ -z "${found_eth_dev}" ] ; then
+						found_eth_dev="$interface"
+					else
 						found_eth_dev="$found_eth_dev $interface"
-						found_eth_dev="$(echo $found_eth_dev | sed -e "s/^[[:space:]]*//g")"
-						;;
-				esac
-			done
-			if [ -n "$found_eth_dev" ]
-			then
-				echo "DEVICE='$found_eth_dev'" >> /conf/param.conf
-				return
-			else
-				# wait a bit
-				sleep 1
+					fi
+				fi
 			fi
 		done
+		# wait a bit
+		sleep 1
 	done
+	if [ -n "$found_eth_dev" ]
+	then
+		echo "Done searching for connected Ethernet interface."
+		echo "Writing DEVICE='$found_eth_dev' in /conf/param.conf."
+		echo "DEVICE='$found_eth_dev'" >> /conf/param.conf
+	else
+		echo "Could not find an interface that is up: giving-up..."
+	fi
+	return
 }
-- 
2.39.2


--- End Message ---
--- Begin Message ---
Source: live-boot
Source-Version: 1:20240525.1
Done: Thomas Goirand <zigo@debian.org>

We believe that the bug you reported is fixed in the latest version of
live-boot, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1069048@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Thomas Goirand <zigo@debian.org> (supplier of updated live-boot package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 12 Nov 2024 12:42:59 +0100
Source: live-boot
Architecture: source
Version: 1:20240525.1
Distribution: unstable
Urgency: medium
Maintainer: Debian Live Maintainers <debian-live@lists.debian.org>
Changed-By: Thomas Goirand <zigo@debian.org>
Closes: 1069048
Changes:
 live-boot (1:20240525.1) unstable; urgency=medium
 .
   * Non-maintainer upload.
   * Add fix to get DHCP from all nics, not only the first one seen with link
     up (Closes: #1069048).
Checksums-Sha1:
 6a6ef947a36dfb3191999b51cd7db07e86b4633a 1847 live-boot_20240525.1.dsc
 65da6232f0197721d6c1019a12df66c08cf6536b 99468 live-boot_20240525.1.tar.xz
 b50a5bd0e962852078bac8828b85614393cbaf95 6950 live-boot_20240525.1_amd64.buildinfo
Checksums-Sha256:
 37bc9f3c4eacacc849fa6eaf532f40947077a0b1cb08253645e511c99ef014b5 1847 live-boot_20240525.1.dsc
 7df508aac65cf26d2191e28f876592ffb3aa23bd2d6015151812a45ae555f42e 99468 live-boot_20240525.1.tar.xz
 8ea67da99942aaeae5fb93299358d48db94a01584b282683239554929a614821 6950 live-boot_20240525.1_amd64.buildinfo
Files:
 82ecab980e73b2cc0fe156b0d06b4109 1847 misc optional live-boot_20240525.1.dsc
 19b85bb82c085267441b1a30192ebb9e 99468 misc optional live-boot_20240525.1.tar.xz
 265c98a0957af9c68e45df5e8c8daf29 6950 misc optional live-boot_20240525.1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoLGp81CJVhMOekJc1BatFaxrQ/4FAmczQAMACgkQ1BatFaxr
Q/4JXA//cd3pcK40wrpMfiBPz66r413dVwmFMcuqgogpy/ElkQrHvFKw435jQYsh
4ZQwlI/74tVDYzk1JDZSs6M1y5vPt61mRlvY6Iup1g3CFcNuLGD6M0Udk/iWBaKK
xjvk28EhG1MpT4AJEBCkyEaSI4ijiDx+a2lrJSfbxMbLc1Z4keXPXZADxMCWV0z+
jGWTC+5Hhj79CyUEKqPWNnbCu9HTUS86fqlERSfny9+s/IEq2MaD2+ICokRgCvXh
bGA+USFcIrH5mZVuKy5g0hl3RnCHRh1XObIYGm8RVIM2BXTzbXCYdO/MVIISSb/N
ezdDrFMtjVkHzB3eoGqXutYIItMUxP5KLt8GnMenRjvChroSP1yKvRdstglawBi9
/PAizreIw9iSgDPFrh2KW7Sv4kbE20fA6aR6XAS1UOoMnIvuM/0zlGWgo6WbtBnh
GoSnxdncfNl1wLtc0IRpUZ70O9gfa3V3xtFvbf1GnLMMIUFO0eW9KYcKl/IKtDj7
VQKctCu9IhYnW4UbbtsrX57BIay4xrmTyE1PvSYJSEysTakd1+GI5vAy/SsxisKc
7eSEJxxEUuLJwLkBkRPr35pStondwGdPyk0R5p44m9htPa3PWZUn1LSNs2c1gBsQ
MEPxlHlwrvSpPl4xBHcWHHSYqy4yJ3ULe/grRnIqygtC3zLaJ08=
=1pbM
-----END PGP SIGNATURE-----

Attachment: pgpJH6CPIpzHq.pgp
Description: PGP signature


--- End Message ---

Reply to: