[TUTORIAL] Automated Installation + PXE boot

someITguy

Member
Jan 29, 2021
5
0
21
35
Hi,

>> For the solution, see below third post of this thread <<

I'm currently trying to setup a pipeline for a fully automated proxmox deployment; eg boot with PXE and run an unattended install.

I noticed the unattended install has been available recently, according to this wiki page : https://pve.proxmox.com/wiki/Automated_Installation

What I did is the following :
- prepare the ISO with the proxmox-auto-install-assistant, so the installer will fetch the answer file on a specific URL
- I booted from the ISO to see how it works, and which are the parameters given in the menuentry
- I noticed the "proxmox-start-auto-installer" parameter is passed here.
- I extracted the initrd.img and linux26 files from the ISO to use it in my PXE boot through TFTP.
- I have a grub entry running the same parameters as I previously saw in the ISO boot for my PXE boot.

Code:
menuentry "Proxmox VE Automated Install" {
    linux /proxmox/vmlinuz ro ramdisk_size=16777216 rw quiet splash=silent proxmox-start-auto-installer
    initrd /proxmox/initrd.img
}


Everything seems fine, until the actual start of the automated install part.

It seems like the fetch method is not available when we run the installer this way... (the auto install works well when booting directly from the ISO, and the http fetch is fine)

1753807966489.png


Looking for more info, I found ppl ending to the same conclusion as me : https://www.reddit.com/r/homelab/comments/nd5ldl/comment/mo5zdnf/

Is there a way to still force the fetch method using a PXE boot like that ?
is there a hidden workaround I didn't find yet ?


Regards,
 
Last edited:
For people looking for the answer, I still didn't find a way to do it.

Alternatives solutions I thought about :
- boot full iso with ipxe => impossible when in UEFI mode
- boot full ISO through the redfish API of my IPMI : my hardware doesn't let me force the boot on the virtual CD

Seems like my only way out is installing a standard preseed debian 12 , and then install proxmox on top of it...
 
UPDATE !

Seems like I did it ! It's quite easy to do finally. After digging in the init file inside the initrd.img file, I noticed the script was looking for a /proxmox.iso file.

So, I put my ISO generated with the assistant inside the initrd.img file, and it works.

So, basically :

- First, generate your iso with answer file (example here with iso, but can be http or whatever) :
proxmox-auto-install-assistant prepare-iso proxmox-ve_8.4-1.iso --fetch-from iso --answer-file myanswerfile.toml

- Then, mount temporary the iso generated to access the initrd and copy it over :
Code:
mkdir /mnt/iso
fuseiso -p proxmox-ve_8.4-1-auto-from-iso.iso /mnt/iso
mkdir ~/proxmox-initrd/
cp /mnt/iso/boot/initrd.img ~/proxmox-initrd/

- Extract the content of the initrd file :
Code:
zstd -d ~/proxmox-initrd/initrd.img -o ~/proxmox-initrd/initrd.img.cpio
mkdir ~/proxmox-initrd/extracted/ && cd ~/proxmox-initrd/extracted/
cpio -idv < ../initrd.img.cpio

- From there, just copy over the iso inside the folder, and repack the initrd :
Code:
cp proxmox-ve_8.4-1-auto-from-iso.iso ~/proxmox-initrd/extracted/proxmox.iso
cd ~/proxmox-initrd/extracted/
find . | cpio --quiet -o -H newc > ../custom.initrd.img.cpio
zstd -19 ../custom.initrd.img.cpio -o ../custom-initrd.img

Here we go, you then just have to pass this custom-initrd.img to your PXE grub menu, and don't forget to put the "proxmox-start-auto-installer" parameter as shown in my first post.

I still didn't do a full install, but I leave it here for ppls who needs it.
Now i'll do a correct answer file for my needs and proceed to a real full install and check how it goes, but it loaded my dummy answer file so I guess it's good :

1753958217603.png



There must be a way to do it in a more lightweight way though.
The init script looks for a proxmox.iso file, but if it doesn't find it (or any plugged in device like a USB drive for example), it is supposed to load squashfs files.
So instead of a full iso, we may just add the squashfs found in the iso (e.g. pve-installer.squashfs and pve-base.squashfs.

No time to check it now, but I'll dig deeper one day.
 
Interesting read & thanks.

Maybe mark it as a Tutorial.

I remember reading in the past on this subject, & now searching found the following:

https://www.reddit.com/r/Proxmox/comments/1m75pqs/automated_deployments_of_proxmox_ve_via_pxe_boot/
 
So, I can confirm : it works !

Little downside : in my context the IP I call to retrieve the toml answer file changes for every setup, so I have to repack the initrd every time.
So the process is slowed by something like 10 minutes (the server running the repack is not really powerful).

The upside : I can just run my playbook and do something else while it runs the full automated install :)

EDIT : I just thought about it, but maybe if I play with the compression level of zstd, I can speed up things, I'll have to try one day
 
Last edited:
Just a small update : I confirm I can drastically speed up the repacking of the initrd.img file !
Changing the compression level from -19 to -5 speed up the process from 15 mins long to 1 min long !

zstd -5 ../custom.initrd.img.cpio -o ../custom-initrd.img

Without any downside, since the final custom-inird.img does the same size anyway !