Merge ~mwhudson/ubuntu/+source/initramfs-tools:ubuntu/mantic-proposed into ubuntu/+source/initramfs-tools:ubuntu/devel

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 41d78e9f57c233b89e0a8dd8bb3dcc58747b4aa4
Proposed branch: ~mwhudson/ubuntu/+source/initramfs-tools:ubuntu/mantic-proposed
Merge into: ubuntu/+source/initramfs-tools:ubuntu/devel
Diff against target: 88 lines (+39/-22)
2 files modified
debian/changelog (+8/-0)
scripts/functions (+31/-22)
Reviewer Review Type Date Requested Status
Steve Langasek (community) Approve
git-ubuntu import Pending
Review via email: mp+452586@code.launchpad.net

Commit message

initramfs-tools (0.142ubuntu15) UNRELEASED; 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)

Description of the change

untested!

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

Had to think a fair bit about the "why" here but I agree this looks correct. I also do not think we should consider it a dhcpcd-base bug that it exits before the timeout if it can't find a device to listen on, so we should regard this as an appropriate fix rather than a workaround.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7568a03..79f7b09 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+initramfs-tools (0.142ubuntu15) mantic; urgency=medium
7+
8+ * scripts/functions: do not fail to configure networking too quickly. In
9+ particular make sure an unsuccessful attempt to run DHCP takes at least
10+ $ROUNDTTT seconds. (LP: #2037202)
11+
12+ -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 04 Oct 2023 12:02:13 +1300
13+
14 initramfs-tools (0.142ubuntu14) mantic; urgency=medium
15
16 * mkinitramfs: Skip compression support check if /boot/config-${version}
17diff --git a/scripts/functions b/scripts/functions
18index 1ddb235..e27a799 100644
19--- a/scripts/functions
20+++ b/scripts/functions
21@@ -422,29 +422,9 @@ configure_networking()
22 # Documentation/frv/booting.txt
23
24 for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
25+ local iter_entry_time iter_exit_time
26
27- # The NIC is to be configured if this file does not exist.
28- # Ip-Config tries to create this file and when it succeds
29- # creating the file, ipconfig is not run again.
30- for x in /run/net-"${DEVICE}".conf /run/net-*.conf ; do
31- if [ -e "$x" ]; then
32- IP="done"
33- break
34- fi
35- done
36-
37- for x in /run/net6-"${DEVICE}".conf /run/net6-*.conf ; do
38- if [ -e "$x" ]; then
39- IP6="done"
40- break
41- fi
42- done
43-
44- # if we've reached a point where both IP and IP6 are "done",
45- # then we're finished with network configuration.
46- if [ "$IP" = "done" ] && [ "$IP6" = "done" ]; then
47- break
48- fi
49+ iter_entry_time=$(time_elapsed)
50
51 if [ -z "${DEVICE}" ]; then
52 _set_available_devices_to_up
53@@ -482,6 +462,35 @@ configure_networking()
54 dhcpcd -1 -t $ROUNDTTT -6 ${DEVICE6:+"${DEVICE6}"}
55 ;;
56 esac
57+
58+ # The NIC is to be configured if this file does not exist.
59+ # Ip-Config tries to create this file and when it succeds
60+ # creating the file, ipconfig is not run again.
61+ for x in /run/net-"${DEVICE}".conf /run/net-*.conf ; do
62+ if [ -e "$x" ]; then
63+ IP="done"
64+ break
65+ fi
66+ done
67+
68+ for x in /run/net6-"${DEVICE}".conf /run/net6-*.conf ; do
69+ if [ -e "$x" ]; then
70+ IP6="done"
71+ break
72+ fi
73+ done
74+
75+ # if we've reached a point where both IP and IP6 are "done",
76+ # then we're finished with network configuration.
77+ if [ "$IP" = "done" ] && [ "$IP6" = "done" ]; then
78+ break
79+ fi
80+
81+ iter_exit_time=$(time_elapsed)
82+
83+ if [ $((iter_exit_time - iter_entry_time)) -le $ROUNDTTT ]; then
84+ sleep $((ROUNDTTT - iter_exit_time + iter_entry_time))
85+ fi
86 done
87
88 # source ipconfig output for either $DEVICE or the first one.

Subscribers

People subscribed via source and target branches