Boot multiple iso from USB using GRUB2
  1. Partition and Formatting

    sudo fdisk /dev/sdb (change usb device from sdb to your one)

                Command (m for help): d
                Selected partition 1
                Command (m for help): n
                Partition type:
                p   primary (0 primary, 0 extended, 4 free)
                e   extended
                Select (default p): p
                Partition number (1-4, default 1): 1
                First sector (2048-30871551, default 2048): 
                Using default value 2048
                Last sector, +sectors or +size{K,M,G} (2048-30871551, default 30871551): 
                Using default value 30871551
                Command (m for help): a
                Partition number (1-4): 1
                Command (m for help): p
                Disk /dev/sdd: 15.8 GB, 15806234624 bytes
                255 heads, 63 sectors/track, 1921 cylinders, total 30871552 sectors
                Units = sectors of 1 * 512 = 512 bytes
                Sector size (logical/physical): 512 bytes / 512 bytes
                I/O size (minimum/optimal): 512 bytes / 512 bytes
                Disk identifier: 0x3a42665b
                Device Boot      Start         End      Blocks   Id  System
                /dev/sdd1   *        2048    30871551    15434752   83  Linux
                Command (m for help): w
                The partition table has been altered!
                Calling ioctl() to re-read partition table.
                Syncing disks. 
        
  2. Install GRUB2 to USB drive

                $ sudo mkfs.ext2 /dev/sdx1
                $ sudo mkdir /mnt/usb
                $ sudo mount /dev/sdx1 /mnt/USB
                $ sudo grub2-install --force --no-floppy --root-directory=/mnt/usb /dev/sdx
                Installation finished. No error reported.
            
  3. Download ISO image

    Create a directory for iso images and put iso files

                $ cd /mnt/usb/
                $ sudo mkdir img
                $ sudo rsync --info=progress2 mythbuntu-16.04.6-desktop-amd64.iso /mnt/usb/img/mythbuntu.iso
                $ sudo rsync --info=progress2 openSUSE-Leap-15.3-KDE-Live-x86_64-Media.iso /mnt/usb/img/opensuse.iso
            
  4. Configure GRUB2

    Create new file grub.cfg in the directory "/boot/grub2" with content:

                set timeout=10
                set default=0
                set isodir='/img'
                menuentry "Ubuntu (persistent)" {
                set isofile="/img/mythbuntu.iso"
                loopback loop $isofile
                linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject quiet splash fsck.mode=skip persistent
                initrd (loop)/casper/initrd
                }
                menuentry "Ubuntu (live only)" {
                set isofile="/img/mythbuntu.iso"
                loopback loop $isofile
                linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject quiet splash maybe-ubiquity nopersistent
                initrd (loop)/casper/initrd
                }
                menuentry "openSUSE boot:CDLABEL" {
                set isofile="/img/opensuse.iso"
                set isolabel="openSUSE_Leap_15.3_KDE_Live"
                loopback loop $isofile
                linux (loop)/boot/x86_64/loader/linux boot=isolinux iso-scan/filename=$isofile root=live:CDLABEL=$isolabel ro rd.live.image rhgb
                initrd (loop)/boot/x86_64/loader/initrd
                }
                menuentry "Install Debian i386 netinst" {
                loopback loop $isodir/debian-6.0.6-i386-netinst.iso
                linux (loop)/boot/i386/vmlinuz desktop=lxde --
                initrd /boot/i386/initrd.gz
                }
                menuentry "Grub2 HDD" {
                set root=(hd1)
                chainloader +1
                }
                menuentry "Restart" {
                reboot
                }
                menuentry "Shut Down" {
                halt
                }
            

    The iso label can be determined with command

                $ isoinfo -d -i openSUSE-Leap-15.3-KDE-Live-x86_64-Media.iso | sed -n 's/Volume id: //p'
            
  5. References:

  • Boot Linux from USB. part I

    Multiple boot using GRUB2 from live ISO files located on USB
    Read more ...

  • Boot Linux from USB. part II

    Multiple boot using SYSLINUX from live ISO files located on USB
    Read more ...

  • Tweet update.

    Added tweet on @lloadm
    Read