1

Please Note: I read all posts in here, about booting ISO from partition using GRUB2 and based on that, I have tried the following, which is not worknig:

I have these partitions and I want to boot an ISO from /dev/sda5 -- should be (hda0,5) in GRUB terms.

root@myhost:/home/vyom# lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0    30G  0 disk 
`-sda1   8:1    0   243M  0 part [SWAP]
`-sda2   8:2    0  11.2G  0 part /
`-sda3   8:3    0     1K  0 part 
`-sda5   8:5    0   9.3G  0 part /mypart5    <<<
`-sda6   8:6    0   9.3G  0 part /mypart6
root@myhost:/home/vyom# blkid
/dev/sda1: UUID="79813f4a-85da-4c81-a044-097922b30648" TYPE="swap" 
/dev/sda2: UUID="68923f34-385e-4740-b8af-4502aa3dd847" TYPE="ext4" 
/dev/sda5: UUID="ef7ca072-bfc9-457b-8a9e-b923fa0d3fe7" TYPE="ext4"   <<<
/dev/sda6: UUID="d8bd9333-dc41-47b3-8a42-f6c308a6f047" TYPE="ext4" 

I tried using UUID with --fs-uuid and fromiso= - didn't work:

menuentry 'UbuntuBionicVSCustom4' --class ubuntu --class gnu-linux --class gnu --class os {
   set isofile="/mypart5/ubuntu-18.04-3f8806d-test2.iso" 
   insmod ext2
   insmod loopback
   insmod iso9660
   loopback loop (hd0,5)$isofile
   search --no-floppy --fs-uuid --set=root ef7ca072-bfc9-457b-8a9e-b923fa0d3fe7
   linux (loop)/install/vmlinuz boot=install fromiso=/dev/sda5/$isofile noprompt noeject
   initrd (loop)/install/initrd.gz
}

I tried --file option to search - that too didnt work:

menuentry 'UbuntuBionicVSCustom3' --class ubuntu --class gnu-linux --class gnu --class os {
   set isofile="/mypart5/versa-flexvnf-3f8806d-21.2.1-B-S.iso"
   insmod ext2
   insmod part_msdos
   insmod lvm
   insmod loopback
   insmod iso9660
   search --file --no-floppy --set=root "${isofile}"
   loopback loop "(${root})${isofile}"
   linux (loop)/install/vmlinuz boot=install findiso="${isofile}" noprompt noeject
   initrd (loop)/install/initrd.gz
}

The ISO file is actually at: /mypart5/ubuntu-18.04-3f8806d-test2.iso

So, should I do:

   set isofile="/mypart5/ubuntu-18.04-3f8806d-test2.iso"

OR, just:

   set isofile="ubuntu-18.04-3f8806d-test2.iso"

So that, next I can do:

   loopback loop (hd0,5)$isofile

also, I am confused with the kernel command line options, should I use:

     fromiso=/dev/sda5/$isofile

OR

     findiso="${isofile}"

OR

     iso-scan/filename=${isofile}

OR

     isoloop=/${isofile}

I am not able to get GRUB to actually pick the file from the partition /dev/sda5 mounted on /mypart5. I get "error: no such device" or unknown filesystem . Please help me what I am missing here!

Ani
  • 59

1 Answers1

4

Try this:

menuentry 'UbuntuBionicVSCustom3' {
  set root='hd0,5'
  set isofile=/ubuntu-18.04-3f8806d-test2.iso
  loopback loop $isofile
  linux (loop)/install/vmlinuz boot=install iso-scan/filename="${isofile}" noprompt noeject
  initrd (loop)/install/initrd.gz
}