DHCP race with interface configuration during automated installation

Jul 2, 2024
3
1
1
Hello,

I'm trying to set up an automated installation of VE with the answer file coming from HTTP. My main problem right now is that the installer is not having a lot of success getting an address from DHCP to download the answer file; in at least eight out of ten attempts it times out before getting an offer.

My switch tells me that is because the link goes down right before the installer starts sending DHCPDISCOVERs. The installer is very impatient; it only waits a total of ten seconds or so to get a response. That is not always (in fact, only rarely) long enough because the link is never up for the first round of DHCPDISCOVERs, and dhclient appears to send them in random order, so even if it sends another one on the correct interface (sometimes it does not) that has to happen late enough for the link to have come up.

According to the switch, the port is up and forwarding from POST until _just_ before the DHCP client gets to work, so this is not a switch/network problem but the installer's startup procedure reinitializing (or whatever) the interface at the worst possible moment. STP is also not part of the problem.

Is there a way to convince the installer (i.e. dhclient) to wait longer, or leave the interfaces alone? This machine used to have ten network interfaces, and then it worked perhaps a quarter of the time. Now it has six and the success rate seems to have gone down, probably because dhclient spends even less total time on fewer interfaces.

Thanks for any hints.
 
Even when Proxmox gets a DHCP assigned address, it will not use DHCP (out of the box) after installation. I think you're better off assigning it a static IP address. Or do you setup DHCP refresh yourself after installation?

EDIT: I misunderstood, sorry.
 
Last edited:
This is not about using DHCP to get an address for production use of the installed VE. The automated installer itself needs an IP address so it can get the answer file, and it uses DHCP for that.
 
Found it, but cannot fix it.

I have no idea how to keep the booting installer from briefly shutting down the interface, but my estimate of ten seconds wait time in dhclient was spot on. That value is configured in /etc/dhcp/dhclient.conf, wrapped in pve-installer.squashfs, in the ISO image. So I extracted the squashfs, increased the timeout, regenerated the squashfs, and updated it inside the ISO in the same way that proxmox-auto-install-assistant injects the configuration.

The resulting ISO, alas, does not boot, and I don't know what I did wrong; I'm not really a Linux person.

Proxmox bug: https://bugzilla.proxmox.com/show_bug.cgi?id=5583
 
  • Like
Reactions: leesteken
I was able to fix this by updating the ISO. Here are the steps I followed:
Massive shoutouts to @Remi-DM and @ValerioBob from this thread: https://forum.proxmox.com/threads/create-custom-pve-iso-from-original-pve-iso.123606/

Once the ISO is downloaded perform the following steps:
Bash:
sudo apt install mkisofs squashfs-tools 
sudo su - 

#location where the original iso of proxmox is
cd /root/pxmx

#copy into proxmox.mbr the mbr from original iso (first 512byte)
dd if=proxmox-ve_8.2-1.iso bs=512 count=1 of=proxmox.mbr

mkdir /tmp/prox
cd /tmp/prox
mount -t iso9660 -o loop /root/pxmx/proxmox-ve_8.2-1.iso /mnt/
cd /mnt
tar cf - -C /mnt . | tar xfp - -C /tmp/prox

# Until here everything is fine but when I edit pve-installer.squashfs the modification are not saved and when I boot I don't see them
# To fix that I edited pve-base.squashfs instead of pve-installer.squashfs:

cd /tmp/prox
unsquashfs pve-installer.squashfs

#Here I edited the files
vi squashfs-root/etc/dhcp/dhclient.conf

# Update the timeout to 60, save the file and quit

#Then I squashed it back

rm pve-installer.squashfs
mksquashfs squashfs-root/ pve-installer.squashfs
# Don't forget to remove squashfs-root
rm -rf squashfs-root/

cd /root/pxmx

xorriso -as mkisofs \
-o repacked.iso \
-r -V 'PVE' \
--modification-date=2024042411311000 \
-isohybrid-mbr /root/pxmx/proxmox.mbr \
-partition_offset 16 \
--protective-msdos-label \
-appended_part_as_gpt \
-efi-boot-part --efi-boot-image \
-c '/boot/boot.cat' \
-b '/boot/grub/i386-pc/eltorito.img' \
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
-eltorito-alt-boot \
-e '/efi.img' -no-emul-boot \
/tmp/prox

# clear up your files
rm -rf /tmp/prox

# The new iso is repacked.iso
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!