Hello.
After many searches and some time testing, I'd like to propose a solution for installing Proxmox from ISO image located in a different partition. It involves adding some additional checkings in initrd init script, which will only enter if specifically selecting this kind of boot; otherwise they're totally innocuous and touch nothing in a normal boot.
For a how-to, I based in this old thread:
https://forum.proxmox.com/threads/proxmox-installation-via-pxe-solution.8484/
Overall, we need to get initrd.img from Proxmox ISO (it's currently in /boot/initrd.img within ISO), extract it, make changes to init script, and repack the initrd.img.
1. Make sure initrd is the correct file type
2. To have a fallback in case of any failure, rename initrd
3. Create a temporal directory to hold initrd's extracted files, and extract initrd there
4. Modify init script with a text editor (change ownership if needed), with the following starting at line 279 (including some additional already existing lines around for easier reference):
5. Repack initrd
6. For the Grub menu (the bootloader normally used), use something like this:
Some comments:
--Although not recommended by the Proxmox team, this method can also work for booting different Proxmox ISO versions, for the adventurous who use, for example, multiboot USB drives (in which case the Grub menu entry even becomes simper, by the way).
--Originally tried to search for a more "general" way for both PXE and partition booting, but they simply work very differently from each other. In particular iPXE (not sure about others) is able to load kernel and initrd, but after this there are only *them* and nothing else currently loaded, so distro's initrd would need to do some convoluted stuff to search for installation ISO in network locations. At least as far as I understand. So forum thread mentioned at beginning of this post is still in place.
--Trying to apply PXE method from forum thread above for partition booting *used* to work, and not even in all cases. Most common error was "initrd is too big" and one needed to load kernel and initrd with Grub commands "linuxefi" and "initrdefi", leaving legacy BIOS systems totally out. But even with these options, it doesn't work in all cases; totally dependent of each individual machine's UEFI implementation.
--While testing, it'd have been a bit easier if one were able to test stuff directly in initrd shell. While there, you cannot simply enter shell, "vi init", make changes, run init script, and expect it to boot normally. See this:
https://forum.proxmox.com/threads/need-some-help-with-proxmox-init-script.102993/
Still waiting for possible help...
Well, it would be nice if proposed changes mentioned here could be included in future Proxmox releases; would make it far easier by not having to do all the unpacking/repacking initrd stuff.
Thanks very much for your attention.
After many searches and some time testing, I'd like to propose a solution for installing Proxmox from ISO image located in a different partition. It involves adding some additional checkings in initrd init script, which will only enter if specifically selecting this kind of boot; otherwise they're totally innocuous and touch nothing in a normal boot.
For a how-to, I based in this old thread:
https://forum.proxmox.com/threads/proxmox-installation-via-pxe-solution.8484/
Overall, we need to get initrd.img from Proxmox ISO (it's currently in /boot/initrd.img within ISO), extract it, make changes to init script, and repack the initrd.img.
1. Make sure initrd is the correct file type
Code:
file initrd.img
2. To have a fallback in case of any failure, rename initrd
Code:
mv initrd.img initrd0.img
3. Create a temporal directory to hold initrd's extracted files, and extract initrd there
Code:
mkdir initrdTemp
cd initrdTemp
zstdcat ../initrd0.img | cpio -idmv # For some reason must be run as root; otherwise errors
4. Modify init script with a text editor (change ownership if needed), with the following starting at line 279 (including some additional already existing lines around for easier reference):
Code:
[...]
cdrom= # Line 276
initrdisoimage="/proxmox.iso"
# Would this part be better inside the parse_cmdline() function?
partuuid=
isopath=
for par in $(cat /proc/cmdline); do
case $par in
partuuid=*)
partuuid="${par#partuuid=}" ;;
isopath=*)
isopath="${par#isopath=}" ;;
esac
done
if [ -f $initrdisoimage ]; then # <-- Already existing "if" block
# this is useful for PXE boot
echo "found proxmox ISO image inside initrd image"
if mount -t iso9660 -o loop,ro $initrdisoimage /mnt >/dev/null 2>&1; then
cdrom=$initrdisoimage
fi
elif [ -n "$partuuid" ] && [ -n "$isopath" ]; then
echo "Trying to boot from partition, waiting for devices to get ready..."
# Perhaps a "for" loop to do several tries would be better...
sleep 6
# Pity Busybox's mount command doesn't support the "--uuid/-U" switch, so this is necessary
part0=$(blkid | grep " UUID=\"$partuuid\"")
part=${part0%%:*}
mkdir /mnt0
# Seemingly only possible file systems to boot from are vfat and ext2/3/4; not necessary to specify "-t <type>"?
if mount $part /mnt0 > /dev/null 2>&1; then
partisoimage="/mnt0$isopath"
if [ -r $partisoimage ]; then
if mount -t iso9660 -o loop,ro $partisoimage /mnt > /dev/null 2>&1; then
echo "found Proxmox ISO image inside partition $part"
cdrom=$partisoimage
fi
fi
fi
else
echo "searching for block device containing the ISO $ISONAME-$RELEASE-$ISORELEASE"
[...]
5. Repack initrd
Code:
# Cpio "-c" option used to be a synonym for "-H newc"; today seems it no longer is
find . | cpio -H newc -o | zstd -19 > ../customInitrd.img
6. For the Grub menu (the bootloader normally used), use something like this:
Code:
menuentry "Proxmox install" {
set isopartuuid="<UUID>"
insmod search_fs_uuid # <-- Not sure if needed in *all* cases...
search --no-floppy --set=isopart --fs-uuid $isopartuuid
set isofile='/path/to/<proxmox.iso>' # Whatever it is called
loopback loop ($isopart)$isofile
# Additional parameters for Proxmox debug mode: "vga=791 video=vesafb:ywrap,mtrr proxdebug"
bootoptions="ramdisk_size=16777216 rw quiet splash=silent partuuid=$isopartuuid isopath=$isofile"
linux (loop)/boot/linux26 $bootoptions
#initrd (loop)/boot/initrd.img <-- In case modified init was already included in Proxmox ISO
initrd ($isopart)/path/to/customInitrd.img
}
Some comments:
--Although not recommended by the Proxmox team, this method can also work for booting different Proxmox ISO versions, for the adventurous who use, for example, multiboot USB drives (in which case the Grub menu entry even becomes simper, by the way).
--Originally tried to search for a more "general" way for both PXE and partition booting, but they simply work very differently from each other. In particular iPXE (not sure about others) is able to load kernel and initrd, but after this there are only *them* and nothing else currently loaded, so distro's initrd would need to do some convoluted stuff to search for installation ISO in network locations. At least as far as I understand. So forum thread mentioned at beginning of this post is still in place.
--Trying to apply PXE method from forum thread above for partition booting *used* to work, and not even in all cases. Most common error was "initrd is too big" and one needed to load kernel and initrd with Grub commands "linuxefi" and "initrdefi", leaving legacy BIOS systems totally out. But even with these options, it doesn't work in all cases; totally dependent of each individual machine's UEFI implementation.
--While testing, it'd have been a bit easier if one were able to test stuff directly in initrd shell. While there, you cannot simply enter shell, "vi init", make changes, run init script, and expect it to boot normally. See this:
https://forum.proxmox.com/threads/need-some-help-with-proxmox-init-script.102993/
Still waiting for possible help...
Well, it would be nice if proposed changes mentioned here could be included in future Proxmox releases; would make it far easier by not having to do all the unpacking/repacking initrd stuff.
Thanks very much for your attention.
Last edited: