dhcpcd is called before interfaces have carrier causing a 29 seconds boot delay
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| initramfs-tools (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
| Noble |
Fix Released
|
Medium
|
Unassigned | ||
Bug Description
[ Impact ]
The boot time can be longer on system that configure their network in the initrd.
[ Test Plan ]
The affected systems show "Sleeping $time seconds before retrying getting a DHCP lease" in their boot log. Once applying the fix, this message should not be found any more and "dhcpcd-10.0.6 starting" should be only logged once (at most once for IPv4 and once for IPv6 depending on the boot parameters).
There are qemu-net and qemu-net-dnsmasq autopkgtests for this area of code.
[ Where problems could occur ]
The DHCP code in the initrd are touched. So the boot can be affected. Also updating initramfs-tools will regenerate the initrd and can cause issues there (like full disks, etc).
[ Original report ]
In automatically encrypted Clevis+Tang unlock of LUKS encrypted device (dmcrypt/
During this phase, dhcpcd is called before interfaces have carrier causing a 29 seconds boot delay.
Boot delay is currently 45 seconds, instead of the 15 seconds that it should.
BUG Initially reported in: https:/
Relevant Logs:
```
dhcpcd-10.0.6 starting
[...]
no interfaces have a carrier
exiting due to oneshot
dhcpcd exited
Sleeping 29 seconds before retrying getting a DHCP lease
dhcpcd-10.0.6 starting
```
A possible workaround would be to manually edit /usr/share/
Changing this:
`for ROUNDTTT in 30 60 90 120; do`
To this:
`for ROUNDTTT in 5 5 5 5; do`
But the proper solution would be to continuously "scan" the state of the Interface (every Second or so), and wait until the interface is UP, before deciding to call dhcpcd.
| affects: | dhcpcd (Ubuntu) → initramfs-tools (Ubuntu) |
| Changed in initramfs-tools (Ubuntu): | |
| importance: | Undecided → Medium |
| Changed in initramfs-tools (Ubuntu Noble): | |
| importance: | Undecided → Medium |
| Changed in initramfs-tools (Ubuntu): | |
| status: | New → Fix Committed |
| description: | updated |
| tags: | added: patch |
| tags: |
added: verification-done verification-done-noble removed: verification-needed verification-needed-noble |

Can you add following function to /usr/share/ initramfs- tools/scripts/ functions:
```
log_flags() {
for device in /sys/class/net/*; do
echo "*** flags for $device";
if [ -f "${device}/flags" ]; then
cat "${device}/flags";
fi;
done
}
```
Please call this function in configure_ networking at several places: networking
* at the beginning of configure_
* before the _update_ip_param call
* after the "wait_for_udev 10" call
* after "for ROUNDTTT in 30 60 90 120; do" (so at the beginning of the loop)