Install Proxmox from ISO placed in a file system partition

sacarias

Active Member
Oct 2, 2019
59
0
26
Background:
I learned that Grub2 supports loopback devices, which allow to install Linux distros directly from ISO files placed in some file system partition; for example, from an ISO placed in a FAT32 or NTFS hard disk partition.
This also applies for partitions in USB external devices, which in turn can allow making multiboot USBs to boot several Linux distros by just copying the ISO files and using Grub2 to boot them.

Indeed, I was able to make one such multiboot USB and use it. Worked for several distros so far, *but* Debian and its derivatives are an exception because of this:
https://wiki.debian.org/Installation+Archive+USBStick#Using_GRUB.27s_Loopback_Facility
https://unix.stackexchange.com/ques...n-iso-file-from-ntfs-partition-and-install-it
https://unix.stackexchange.com/ques...b-entry-for-iso-debian-file-cannot-copy-cdrom

TL;DR, Debian-based distros (at least the *installer* ISOs) have an initrd which doesn't support this loopback feature, seemingly lacking scripts --namely the "iso-scan" program-- which would look for the ISO in the partition; and the workaround would be downloading initrd from Debian's hd-media (perhaps also the kernel vmlinuz) and load them instead of the ISO's ones.

My question is, would these Debian's hd-media files work also for Proxmox?
I saw Proxmox doesn't have a proper hd-media...

Thanks.
 
My question is, would these Debian's hd-media files work also for Proxmox?
As you can install Proxmox VE on top of Debian, you could use this two step approach. Or you can copy the ISO image into the PVE initrd.gz with the name 'proxmox.iso'. This is also the method done, to boot the ISO with PXE.
 
As you can install Proxmox VE on top of Debian, you could use this two step approach. Or you can copy the ISO image into the PVE initrd.gz with the name 'proxmox.iso'. This is also the method done, to boot the ISO with PXE.
I'd like to install purely Proxmox VE rather than installing on top of Debian.

And, thanks for your answer, but I couldn't understand very well.
What ISO image "into Proxmox VE's initrd"?
So using Debian's hd-media initrd would not work for Proxmox?
 
Or you can copy the ISO image into the PVE initrd.gz with the name 'proxmox.iso'. This is also the method done, to boot the ISO with PXE.
Just found it
https://forum.proxmox.com/threads/proxmox-installation-via-pxe-solution.8484/
Still, I'd prefer the Grub2 looping because, and probably I didn't really understood the post 100%, if Proxmox installer is loaded into the server's RAM and server's hard disk is gonna be entirely wiped out anyways, where do I actually mount the Proxmox ISO?

No, the installer has its own modified initrd.
According to this -never solved- report (also mentioned within links in OP),
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724931
they left initrd and/or installer itself without loop.ko module and iso-scan support, so attempting to boot from ISO stored in a filesystem gives error "No cdrom detected", "Problem with cdrom", or similar. (And yes, I just tested with Proxmox 6).
And after more google searches, the most I understood is: they left it like that *for no good reason*, as in "we already dumped it available on hd-media, why more efforts in the other ISOs".

If Proxmox's initrd differs from Debian's anyways, couldn't Proxmox devs do something to fix it so it supports Grub2 loopback?
Could it be a valid bug report for Proxmox?
 
The initrd is loaded into memory, so if the ISO is packed in there, it will be loaded too, into memory. When you go through with the installation then, yes it will wipe the traget disk.
 
The initrd is loaded into memory, so if the ISO is packed in there, it will be loaded too, into memory. When you go through with the installation then, yes it will wipe the traget disk.
As far as I understood, the proposed solution indeed consists in packing the PVE ISO itself into the modified and repacked initrd. Also, initrd script is modified so it searches the PVE ISO and then mounts it in a /mnt directory.

a) Does ISO need to forcibly be inside packaged initrd in order to be found? Can't initrd's script search in other locations, e.g, say, my external USB device? (Both kernel and initrd would be in same directory as PVE ISO, all inside USB drive).

b) So initrd finds ISO and mounts it to /mnt directory. Where is this /mnt directory? In RAM as well? Where did it come from? Cannot be in target disk because it will be wiped!


No, the installer has its own modified initrd.
Couldn't Proxmox devs do something to fix it so it supports Grub2 loopback?
Can't it be a valid bug report for Proxmox?
Or you're not interested neither, just like Debian people?
 
a) Does ISO need to forcibly be inside packaged initrd in order to be found? Can't initrd's script search in other locations, e.g, say, my external USB device? (Both kernel and initrd would be in same directory as PVE ISO, all inside USB drive).
It needs to be in initrd. You can change the script and do all sorts of things.

b) So initrd finds ISO and mounts it to /mnt directory. Where is this /mnt directory? In RAM as well? Where did it come from? Cannot be in target disk because it will be wiped!
Memory.

Couldn't Proxmox devs do something to fix it so it supports Grub2 loopback?
Can't it be a valid bug report for Proxmox?
Or you're not interested neither, just like Debian people?
Not our use-case.
 
It needs to be in initrd. You can change the script and do all sorts of things.
So one can change initrd's script to the like, but no matter how it's modified, will never work if PVE ISO is not packaged inside initrd?
If I have the USB stick like this

/proxmox
----proxmox.iso
----linux26
----initrd.img <-- (without PVE ISO inside)

initrd's script cannot be made to work?
 

Please stop posting empty messages.

You are trying something what we do not support, therefore we do not support this here.
 
you can check yourself what the other boot options do -> boot the iso, hit 'e' at the grub menu. if you want do things that are very custom / out of the ordinary, you are expected to know what you are doing, and be able to debug stuff yourself..
 
First, I apologize for 2 things:
--for not trying things further
--for necroposting; but I do because I think the following is still very relevant. Hope it's still valid

So after a very long time of idling, I finally felt like giving this another try.
So, I referred to this yet again:
https://forum.proxmox.com/threads/proxmox-installation-via-pxe-solution.8484/
and did the stuff, just with some differences:
--first checked that initrd.img is packed in gzip format:
Code:
file initrd.img
--once inside working directory, extracted initrd.img with this
Code:
zcat ../initrd0.img | cpio -idmv
--no longer necessary to modify the init file; the commitment is already there since long ago:
Code:
[...]
    done

else

    cdrom=

    initrdisoimage="/proxmox.iso"

    if [ -f $initrdisoimage ]; then
    # this is useful for PXE boot
    echo "found proxmox cdrom image inside initrd image"
    if mount -t iso9660 -o loop,ro $initrdisoimage /mnt >/dev/null 2>&1; then
        cdrom=$initrdisoimage
    fi
    else
    echo "searching for cdrom"   
[...]
--repacked initrd.img with this
Code:
find . | cpio -c -o | gzip -9 > ../initrd.img

Finally for the grub menu, it was similar to the "LABEL Proxmox" part; I created separate menuentry for "Install Proxmox VE" and "Install Proxmox VE (Debug mode)". For the due kernel parameters I referred to Proxmox ISO's /boot/grub/grub.cfg file.

This way, I was able to boot "Install Proxmox VE" and "Install Proxmox VE (Debug mode)".
 
Now I have one last doubt.

The option "Rescue Boot" didn't work for me.
I guess just copying the whole entry from ISO's grub.cfg is not enough.

If anyone knows by chance, how could I adapt the "Rescue Boot" menuentry to make it work?
It's not just a matter of "linux [...]" and "initrd [...]"

Lastly, should I use "linux" and "initrd", or "linuxefi" and "initrdefi"?

Thanks.
 

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!