NetworkConfiguration / dhcpcd

DHCP / IPv4LL / IPv6RA / DHCPv6 client.
https://roy.marples.name/projects/dhcpcd
BSD 2-Clause "Simplified" License
336 stars 108 forks source link

dhcpcd -U stops working on /dev/console loopback #259

Open jorknu opened 10 months ago

jorknu commented 10 months ago

Version: dhcpcd 10.0.1 Architecture: x86_64 (Intel Xeon 3rd generation Scalable processors)

Short problem description: dhcpcd -U function stops working in the minimalistic initramfs when a serial loopback is present on the console device.

Behavior: -> the regular dhcpcd call succeeds and gets a IP address from the DHCP server, the lease file in /var/db/dhcpcd is created and filled with correct information. -> dhcpcd -U complains that the family (-4 or -6) should be provided, this is different behavior when the serial loopback is not present -> If the family (-4) is provided and the debug flags is provided the following behavior is observed:

Boot sequence: -> PXE loads EFI linux kernel -> EFI linux kernel loads minimalistic initramfs (packaged into bzImage) -> init script in initramfs calls dhcpcd followed by dhcpcd -U to get the lease information for the last handed out lease -> problem point -> the lease information is used to get the full rootfs via http -> the full rootfs is mounted as fs overlay and init of the rootfs is kicked off

OS information: Buildroot: 2023.08 Linux: 6.4.9

Log of normal dhcpcd call with -d: Dhcpcd_-dorig.txt -> as received on serial terminal with loopback present Dhcpcd-d_filt.text -> Unscrambled the orig log and filtered on output of dhcpcd

Log of dhcpcd -d -U: Dhcpcd_-dorig.txt -> as received on serial terminal with loopback present Dhcpcd-d_filt.text -> Unscrambled the orig log and filtered on output of dhcpcd

Log of dhcpcd -d -U -4: Dhcpcd_-4orig.txt -> as received on serial terminal with loopback present Dhcpcd-4_filt.txt -> Unscrambled the orig log and filtered on output of dhcpcd

Questions:

If anything is unclear or information is lacking don't hesitate to contact me.

Attachments: Dhcpcd_-4_orig.txt Dhcpcd_-d_filt.txt Dhcpcd_-d_orig.txt Dhcpcd_-4_filt.txt

rsmarples commented 10 months ago
Call: dhcpcd -d -U

getpwnam: No such file or directory
Family not specified. Please use -4 or -6.

Family not specificed means dhcpcd is trying to read a lease from stdin. Maybe close stdin and call dhcpcd -U in a subshell if you have stdin open?