[Bug 2065037] Re: dhcpcd is called before interfaces have carrier causing a 29 seconds boot delay
Stefano
2065037 at bugs.launchpad.net
Thu May 9 07:09:44 UTC 2024
Now I just tried with `dhclient` on my Main Workstation to check the
time it takes "from scratch" to bring up and get an IP from DHCP on
eno1.
Keep in mind that the "path" to the Router/Gateway (OPNSense Router:
192.168.1.7 master and 192.168.1.8 slave, or 192.168.1.1 Virtual IP) is
much longer (there are like 3 extra Switches in between).
```
root at HOST:/# ifconfig eno1 0.0.0.0
root at HOST:/# ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::ec4:7aff:fe79:2d9a prefixlen 64 scopeid 0x20<link>
ether 0c:c4:7a:79:2d:9a txqueuelen 1000 (Ethernet)
RX packets 56621 bytes 56090624 (56.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20888 bytes 2885632 (2.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7300000-f737ffff
root at HOST:/# ifconfig eno1 down
root at HOST:/# ls -l /var/lib/dhcp/dhclient.*
-rw-r--r-- 1 root root 894 May 9 08:47 /var/lib/dhcp/dhclient.eno1.leases
-rw-r--r-- 1 root root 1552 Feb 20 2022 /var/lib/dhcp/dhclient.eno2.leases
-rw-r--r-- 1 root root 5567 May 6 14:12 /var/lib/dhcp/dhclient.leases
-rw-r--r-- 1 root root 58 Mar 11 18:23 /var/lib/dhcp/dhclient.vmbr0.200.leases
-rw-r--r-- 1 root root 1022 Mar 11 18:23 /var/lib/dhcp/dhclient.vmbr0.leases
-rw-r--r-- 1 root root 641 Mar 9 2022 /var/lib/dhcp/dhclient.wlx00c0ca961be5.leases
root at HOST:/# rm /var/lib/dhcp/dhclient.*
root at HOST:/# date +"%Y%m%d-%H%M%S"; time dhclient -v; date +"%Y%m%d-%H%M%S";
20240509-085910
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
Listening on LPF/virbr0/52:54:00:a2:62:15
Sending on LPF/virbr0/52:54:00:a2:62:15
Listening on LPF/eno2/0c:c4:7a:79:2d:9b
Sending on LPF/eno2/0c:c4:7a:79:2d:9b
Listening on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on Socket/fallback
xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
xid: rand init seed (0x6643753e) built using gethostid
DHCPDISCOVER on virbr0 to 255.255.255.255 port 67 interval 3 (xid=0x375da74)
DHCPDISCOVER on eno2 to 255.255.255.255 port 67 interval 3 (xid=0xc0acb6b)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 3 (xid=0xc119e63d)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 7 (xid=0xc119e63d)
DHCPDISCOVER on virbr0 to 255.255.255.255 port 67 interval 6 (xid=0x375da74)
DHCPDISCOVER on eno2 to 255.255.255.255 port 67 interval 4 (xid=0xc0acb6b)
DHCPDISCOVER on eno2 to 255.255.255.255 port 67 interval 8 (xid=0xc0acb6b)
DHCPDISCOVER on virbr0 to 255.255.255.255 port 67 interval 7 (xid=0x375da74)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 8 (xid=0xc119e63d)
DHCPOFFER of 192.168.15.223 from 192.168.1.7
DHCPREQUEST for 192.168.15.223 on eno1 to 255.255.255.255 port 67 (xid=0x3de619c1)
DHCPACK of 192.168.15.223 from 192.168.1.7 (xid=0xc119e63d)
bound to 192.168.15.223 -- renewal in 249 seconds.
real 0m10,792s
user 0m0,000s
sys 0m0,002s
20240509-085921
```
Targeting the interface explicitly i.e. `dhclient -v eno1` didn't change the timing of the first attempt much, went only from ~10s to ~7-9s:
```
root at HOST:/# rm /var/lib/dhcp/dhclient.*
root at HOST:/# ifconfig eno1 0.0.0.0
root at HOST:/# ifconfig eno1 down
root at HOST:/# date +"%Y%m%d-%H%M%S"; time dhclient -v eno1; date +"%Y%m%d-%H%M%S";
20240509-091017
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on Socket/fallback
xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
xid: rand init seed (0x664377d9) built using gethostid
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 3 (xid=0x9fddd939)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 5 (xid=0x9fddd939)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 9 (xid=0x9fddd939)
DHCPOFFER of 192.168.13.107 from 192.168.1.8
DHCPREQUEST for 192.168.13.107 on eno1 to 255.255.255.255 port 67 (xid=0x39d9dd9f)
DHCPACK of 192.168.13.107 from 192.168.1.7 (xid=0x9fddd939)
Error: ipv4: Address already assigned.
bound to 192.168.13.107 -- renewal in 1651 seconds.
real 0m7,970s
user 0m0,001s
sys 0m0,000s
20240509-091025
```
If the Interface is already up but the lease file is removed (and the Interface got its IP Address unassigned):
```
root at HOST:/# rm /var/lib/dhcp/dhclient.*
root at HOST:/# ifconfig eno1 0.0.0.0
root at HOST:/# date +"%Y%m%d-%H%M%S"; time dhclient -v; date +"%Y%m%d-%H%M%S";
20240509-090345
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
Listening on LPF/virbr0/52:54:00:a2:62:15
Sending on LPF/virbr0/52:54:00:a2:62:15
Listening on LPF/eno2/0c:c4:7a:79:2d:9b
Sending on LPF/eno2/0c:c4:7a:79:2d:9b
Listening on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on LPF/eno1/0c:c4:7a:79:2d:9a
Sending on Socket/fallback
xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
xid: rand init seed (0x66437451) built using gethostid
DHCPDISCOVER on virbr0 to 255.255.255.255 port 67 interval 3 (xid=0x67a6fc7c)
DHCPDISCOVER on eno2 to 255.255.255.255 port 67 interval 3 (xid=0x95c50e)
DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 3 (xid=0xccdbf90e)
DHCPOFFER of 192.168.13.107 from 192.168.1.8
DHCPREQUEST for 192.168.13.107 on eno1 to 255.255.255.255 port 67 (xid=0xef9dbcc)
DHCPACK of 192.168.13.107 from 192.168.1.8 (xid=0xccdbf90e)
bound to 192.168.13.107 -- renewal in 291 seconds.
real 0m1,191s
user 0m0,000s
sys 0m0,001s
20240509-090346
```
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/2065037
Title:
dhcpcd is called before interfaces have carrier causing a 29 seconds
boot delay
Status in initramfs-tools package in Ubuntu:
Fix Committed
Status in initramfs-tools source package in Noble:
New
Bug description:
In automatically encrypted Clevis+Tang unlock of LUKS encrypted device
(dmcrypt/cryptsetup) - on top of which the ZFS Pool for / resides,
dhcpcd is used in order to obtain automatically an IP address during
initramfs boot.
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://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/2064926
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/initramfs-tools/scripts/functions
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/2065037/+subscriptions
More information about the foundations-bugs
mailing list