Thursday 20 March 2014

Add ProxMox Install ISOs to a USB Easy2Boot drive


ProxMox VE 8.2 ISO


1. Use E2B or agFM to boot to ISO.  Legacy or UEFI64 can be used.

2. At ProxMox boot menu, select GUI or Text mode install and then press 'e' to edit the entry (don't press Enter)

3. Move cursor to just before 'rw' in the menu and type the string

lvm2root=/dev/sdX4

where X is the USB drive letter which proxmox will give the USB drive when it boots.
If legacy booting this will be sda4 because the boot drive is always hd0 when legacy booting.
If UEFI64 booting it may differ from a. To check, press c key and then type ls. If USB drive is listed as hd0 then you need to use /dev/sda4. If USB drive is listed as hd1 then you need to use /dev/sdb4.



You can use a .mnu file if you want to automate it under the E2B menu system. For E2B legacy, modify and use proxmox_v5.4_iso_with_patch.mnu from \_ISO\docs\sample mnu files folder and edit iso name.

For agFM (legacy and UEFI64), you will need to use a .cfg or .grubfm file - see here for details.
You can copy the proxmox commands but insert the lvm2root command - however, different systems will give the USB drive a different drive letter, so it is not a good solution unless you add some code to enumerate existing drives (as done by the .mnu file for legacy grub4dos). I will leave this as an exercise for the geeks!


Other versions



For ProxMox4-7 see end of this article

ProxMox 3
The ProxMox install ISOs don't 'just work' with Easy2Boot. The ISO shows a 'PROXMOX INSTALLER' splash screen and then seems to hang. However, if you press F2 or ESC to get to the linux command prompt, you can easily start the installer as follows:
1. Type
    fdisk -l
to find the USB 4th partition. This will usually be /dev/sdb4 on a single disk system.
2. Next type
    mount /dev/sdb4 /mnt
to mount the 4th partition (this will already contain the ISO file set up by E2B).
3. Finally type
    chroot /mnt sbin/unconfigured.sh
to start the installer (it takes a minute or two to load - be patient).

If you prefer, you can copy the ISO file to the \_ISO\MAINMENU\MNU folder and make a small .mnu file in the same folder to remind you of the commands that are required:

title ProxMox Installer ISO \n Use fdisk -l to find 4th partition\n mount /dev/sdb4 /mnt\n chroot /mnt sbin/unconfigured.sh
set ISO=proxmox-ve_3.2-1933730b-2.iso
/%grub%/qrun.g4b $HOME$/%ISO%
boot


P.S. If the E2B drive is an NTFS drive, the mount command fails (for some reason).

For NTFS E2B USB Drives


1. Create an empty folder on the Windows Desktop

2. Copy your PROXMOX.ISO file to the empty folder (do NOT extract the contents)

3. Drag-and-drop the folder onto the MPI_FAT32 Desktop icon and create a PROXMOX.imgPTN file on your NTFS E2B USB drive that is about double the size of the ISO file - e.g. 1400MB for a 665MB ISO.

4. Boot to E2B and select the PROXMOX.imgptn file to get to the CSM Menu - then Quit.

5.  Edit the \menu.lst file on the E2B USB drive (it should be the large CSM menu.lst and there should be a \e2b folder present also).

Add to the bottom of the menu:

title ProxMox Installer ISO \n Use fdisk -l to find 4th partition\n mount /dev/sdb4 /mnt\n chroot /mnt sbin/unconfigured.sh
partnew (hd0,3) 0 /proxmox.iso
map /proxmox.iso (0xff)
map --hook
root (0xff)

chainloader (0xff)

Note that the PROXMOX.ISO file inside the .imgPTN file needs to be contiguous - this is why we must choose a much larger size for the .imgPTN file than we need. If you get a 'not contiguous' error from the above menu, use WinContig to defrag the PROXMOX.ISO file on the E2B USB drive. If it is not possible, create a larger .imgPTN file and try again.


ProxMox 4/5/7

The file structure has changed with proxmox 4 and later versions.

Here is one way to get it to work:

1. Copy the .ISO file to \_ISO\LINUX on your E2B drive
2. Boot to the proxmox boot menu
3. Select the first install option in the menu and press e for edit
4. Add the string lvm2root=/dev/sdX4  where X is the drive letter for your USB drive (try sda4 first).
For instance, on a notebook with a single hard disk, add lvm2root=/dev/sdb4
Under a VM where the USB drive is the first drive in the system, use /dev/sda4
Also, on a notebook which had an internal hard drive, /dev/sda4 worked but /dev/sdb4 did not!

Add in lvm2root=/dev/sdX4  in the exact place shown  (the \ character at the end of the line in the screenshot just shows that the line continues)

5. Press F10 to boot.


E2B v1.B3 contains a sample .mnu file which uses this method to modify the grub.cfg file in the ISO so that you dont need to manually edit the menu. See ....

proxmox_v5.4_iso_with_patch.mnu

# MBR-boot from proxmox iso
# This assumes the \boot\grub\grub.cfg menuentry line inside the ISO file ends in 'quiet splash=silent'
# It loads the ISO contents into memory and then patches the grub.cfg menu entry
# You must pick the correct device - sometimes this is sda and sometimes it is as suggested
# Copy this .mnu file and the ISO file to \_ISO\LINUX folder

iftitle [if exist $HOME$/proxmox-ve_5.4-1.iso] ProxMox VE v5.4.1 Installer (patch ISO)\nTip: Try sda or sdb or sdc, etc.
set ISO=$HOME$/proxmox-ve_5.4-1.iso

# set DEV to the drive device number of the USB drive - e.g. a
#don't echo of values on screen
debug off
#make sure all drives are unmapped as this can change the count
#reset hdcount in BIOS to default
map --unhook
map --unmap=0:0xff
root (bd)
#set number of hard disks in system from BIOS location 475h
set /a HDCNT=*0x475 & 0xff > nul
# cannot install to E2B drive!
if %HDCNT%==1 pause --wait=3 ERROR: No internal hard disk detected && configfile (md)0x3000+0xA0
# add 0x60 so drive 1 = a, drive 2 = b
set /A ldisk=%HDCNT%+0x60 > nul
call echo -e sd\%ldisk:~1,4% | set ldisk=
echo %HDCNT% disks in system including USB drive
echo
echo -e      I guess the USB drive will be sda or $[0104]%ldisk%
echo
set /p ldisk=Enter linux device name for USB drive, e.g. sda or sdb (A=abort, ESC=%ldisk%) : 
echo
# must start with sd
if not "%ldisk:~0,2%"=="sd" pause --wait=3 ERROR: Must begin with "sd" && configfile (md)0x3000+0xA0
echo Will use /dev/%ldisk%4 for ISO file

set NOSUG=1
set redir=> nul
echo Loading ISO into memory and patching menuentry...
/%grub%/QRUN.g4b force.isomem %ISO%
root (0xff)
clear
echo
cat --locatei=menuentry --number=1 ()/boot/grub/grub.cfg > nul
set /a st=%?%
cat --skip=%st% --length=570  ()/boot/grub/grub.cfg
echo -e \n.......... NEW PATCHED MENU .............\n
cat --locatei=quiet    --replace=lvm2root=/dev/%ldisk%4\x20 ()/boot/grub/grub.cfg > nul
cat --locatei=lvm2root --replace=lvm2root=/dev/%ldisk%4\x20 ()/boot/grub/grub.cfg > nul
cat --locatei=\x20e\x20 --replace=\x20\x20 ()/boot/grub/grub.cfg > nul
#display menu
cat --skip=%st% --length=570 ()/boot/grub/grub.cfg
pause Press a key to boot...
chainloader (0xff)
boot


Alternative for Proxmox 4\5

Or you can use a .mnu file to automate the process (but you need to check the suggested /dev/sdx device is correct for that system)...

# place ISO and this .mnu file in \_ISO\LINUX\MNU folder.
# vga=791 is required or will get Installation aborted error.
# lvm2root must be set the the E2B USB drive partition which is mapped to the ISO

iftitle [if exist $HOME$/proxmox-ve_4.4-eb2d6f1e-2.iso] proxmox 4.4\n You must enter the correct USB name.
set ISO=proxmox-ve_4.4-eb2d6f1e-2.iso

#don't echo of values on screen
debug off
#make sure all drives are unmapped as this can change the count
#reset hdcount in BIOS to default
map --unhook
map --unmap=0:0xff
root (bd)
#set number of hard disks in system from BIOS location 475h
set /a HDCNT=*0x475 & 0xff > nul
# cannot install to E2B drive!
if %HDCNT%==1 pause --wait=3 ERROR: No internal hard disk detected && configfile (md)0x3000+0x50
# add 0x60 so drive 1 = a, drive 2 = b
set /A ldisk=%HDCNT%+0x60 > nul
call echo -e sd\%ldisk:~1,4% | set ldisk=
echo %HDCNT% disks in system including USB drive
echo
echo -e      I guess the USB drive will be $[0104]%ldisk%
echo
set /p ldisk=Enter linux device name for USB drive, e.g. sdb or sdc (A=abort, ESC=%ldisk%) : 
echo
# must start with sd
if not "%ldisk:~0,2%"=="sd" pause --wait=3 ERROR: Must begin with "sd" && configfile (md)0x3000+0x50
pause --wait=3 Will use /dev/%ldisk%4 for ISO file
set NOSUG=1
set redir=> nul
/%grub%/QRUN.g4b $HOME$/%ISO%
kernel /boot/linux26 ro ramdisk_size=16777216 lvm2root=/dev/%ldisk%4 vga=791 rw quiet splash=silent
initrd /boot/initrd.img
boot


Note: proxmox 5.4 seems to be broken. It won't even boot if I dd the ISO to a USB drive.

proxmox 5.4.1 UEFI booting

This seems to not 'just work' for USB drives. Here is a workaround.

1. Make a FAT32 .imgPTN file from the ISO
2. Copy it to the E2B drive and switch-in the .imgPTN file
3. UEFI boot - it will fail and it will land you at the grub rescue prompt
(note VirtualBox will try to boot the MAC EFI boot file and it will hang in VBox - so rename the \System folder to \SystemXX).
4. At the grub rescue prompt, type set to see the variables.
Type ls to determine the USB drive number.

We need to fix the root and prefix variables, so type
set root=hd0,msdos1
set prefix=(hd0,msdos1)/boot/grub
5. Now we need to load the normal module from the $prefix config folder which could not be loaded before and boot, so type
insmod normal
normal



6. At the proxmox boot screen, select the first menu entry 'Install proxmox VE' but press e instead of ENTER so you can edit the menu and add lvm2root=/dev/sdX1  where X will be the USB drive letter (this may depend on how many drives are in the system).

P.S. This doesn't seem to work on ProxMox 6.3.1 !!! :-(  Mass Storage USB drivers appear to be missing from the ProxMox grub2 so it does not even see the USB drive.




No comments:

Post a Comment