diff -Nru initramfs-tools-0.142ubuntu14/debian/changelog initramfs-tools-0.142ubuntu15/debian/changelog --- initramfs-tools-0.142ubuntu14/debian/changelog 2023-09-25 22:49:57.000000000 +0000 +++ initramfs-tools-0.142ubuntu15/debian/changelog 2023-10-03 23:02:13.000000000 +0000 @@ -1,3 +1,11 @@ +initramfs-tools (0.142ubuntu15) mantic; urgency=medium + + * scripts/functions: do not fail to configure networking too quickly. In + particular make sure an unsuccessful attempt to run DHCP takes at least + $ROUNDTTT seconds. (LP: #2037202) + + -- Michael Hudson-Doyle Wed, 04 Oct 2023 12:02:13 +1300 + initramfs-tools (0.142ubuntu14) mantic; urgency=medium * mkinitramfs: Skip compression support check if /boot/config-${version} diff -Nru initramfs-tools-0.142ubuntu14/scripts/functions initramfs-tools-0.142ubuntu15/scripts/functions --- initramfs-tools-0.142ubuntu14/scripts/functions 2023-09-25 19:47:50.000000000 +0000 +++ initramfs-tools-0.142ubuntu15/scripts/functions 2023-10-02 20:13:19.000000000 +0000 @@ -422,29 +422,9 @@ # Documentation/frv/booting.txt for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do + local iter_entry_time iter_exit_time - # The NIC is to be configured if this file does not exist. - # Ip-Config tries to create this file and when it succeds - # creating the file, ipconfig is not run again. - for x in /run/net-"${DEVICE}".conf /run/net-*.conf ; do - if [ -e "$x" ]; then - IP="done" - break - fi - done - - for x in /run/net6-"${DEVICE}".conf /run/net6-*.conf ; do - if [ -e "$x" ]; then - IP6="done" - break - fi - done - - # if we've reached a point where both IP and IP6 are "done", - # then we're finished with network configuration. - if [ "$IP" = "done" ] && [ "$IP6" = "done" ]; then - break - fi + iter_entry_time=$(time_elapsed) if [ -z "${DEVICE}" ]; then _set_available_devices_to_up @@ -482,6 +462,35 @@ dhcpcd -1 -t $ROUNDTTT -6 ${DEVICE6:+"${DEVICE6}"} ;; esac + + # The NIC is to be configured if this file does not exist. + # Ip-Config tries to create this file and when it succeds + # creating the file, ipconfig is not run again. + for x in /run/net-"${DEVICE}".conf /run/net-*.conf ; do + if [ -e "$x" ]; then + IP="done" + break + fi + done + + for x in /run/net6-"${DEVICE}".conf /run/net6-*.conf ; do + if [ -e "$x" ]; then + IP6="done" + break + fi + done + + # if we've reached a point where both IP and IP6 are "done", + # then we're finished with network configuration. + if [ "$IP" = "done" ] && [ "$IP6" = "done" ]; then + break + fi + + iter_exit_time=$(time_elapsed) + + if [ $((iter_exit_time - iter_entry_time)) -le $ROUNDTTT ]; then + sleep $((ROUNDTTT - iter_exit_time + iter_entry_time)) + fi done # source ipconfig output for either $DEVICE or the first one.