PNG multiboot
        usb
[THIS PAGE IS A WORK IN PROGRESS]

Numerous webpages describe the ability of the GRUB2 bootloader to boot from a a desired Linux distribution directly from an ISO file without fully-installing it onto the USB stick -- giving the Linux user the ability to demonstrate and/or install their favorites.

This page will briefly describe my own simplistic-but-useful script to accomplish this task.  One possible advantage of my script (not fully tested) is the ability to use such a multiboot USB stick in either a older-style BIOS boot computer, or a newer UEFI boot computer (I need someone to verify that this is true!).  It does this by creating both a 'BIOSBOOT' partition and an 'EFIBOOT' one, with the appropriate version of GRUB2 installed onto each.

In the script/config files below, I use my own favorite Linux distros as samples i.e. Linux Mint.  Every distro has its own unique set of GRUB2 boot parameters, which you can find from some appropriate Google searches.  In the cases of popular distros, these will be easy to find.  For obscure distros, it could be difficult or impossible (some distros are not able to use GRUB2 in this way).

The normal/BIOS version of GRUB2 seems to be commonly present in Linux distros, but you might need to specifically install the app for the EFI one by doing something like the following:
apt install grub-efi
I have another version of the script (not shown here) that creates a fourth partition -- one containing a fully-installed Linux distro.  Yes, it is possible to boot and run a real non-demo Linux from a USB stick (typically USB3 stick/port is desirable for best possible performance).

WARNING: My script assumes that the USB stick will be assigned to the '/dev/sdc' devices.  Change as appropriate, or risk the possibility of formatting the wrong device!

BASH SCRIPT: dusbmake.sh

This bash script makes the following assumptions:
  • EFI version of the GRUB2 bootloader is present on your Linux system
  • The USB stick that you will insert (and completely re-format) will be assigned to device '/dev/sdc' (verify and/or change)
  • The USB stick will be large enough to contain all the Linux ISO files that you want to chose from (typically 4GB or larger)
  • The Linux ISO files, GRUB2 config file, and background image file are stored in another directory named '/data/download/isodirs' (change if you want)
#!/bin/bash
#
# make sure that EFI version of grub installer is present
#
#apt install grub-efi-amd64-bin
#
# erase USB device using multiple methods -- make sure you pick the right one
#
sudo wipefs /dev/sdc
sudo sgdisk -Z /dev/sdc
sudo partprobe /dev/sdc
#
# create my standard 3 partitions - just enough for the BIOS/EFI partitions, and the rest for ISO partition
#
sudo sgdisk -n 0:0:+1M -t 0:ef02 -c 0:"BIOSBOOT" /dev/sdc
sudo sgdisk -n 0:0:+100M -t 0:ef00 -c 0:"EFIBOOT" /dev/sdc
sudo sgdisk -n 0:0:0 -t 0:0700 -c 0:"ISO" /dev/sdc
sudo gdisk -l /dev/sdc
#
# create proper file systems on relevant partitions
#
sudo mkfs.fat -F32 -n "EFIBOOT" /dev/sdc2
sudo mkfs.fat -F32 -n "ISO" /dev/sdc3
#
# create desired directory structures
#
sudo mkdir -p /mnt/efiboot
sudo mkdir -p /mnt/iso
#
# mount partitions to be ready for activity
#
sudo mount /dev/sdc2 /mnt/efiboot/
sudo mount /dev/sdc3 /mnt/iso/
sudo mkdir -p /mnt/iso/boot/isos
#
# install EFI and non-EFI versions of GRUB2
#
sudo grub-install --target=x86_64-efi --efi-directory=/mnt/efiboot --boot-directory=/mnt/iso/boot --removable --recheck
sudo grub-install --target=i386-pc --boot-directory=/mnt/iso/boot --recheck /dev/sdc
#
# copy desired ISO and config files to ISO partition
#
cd /data/download/isodirs
sudo time cp lmde-3-201808-cinnamon-64bit.iso linuxmint-19-cinnamon-64bit-v2.iso memtest86+-4.20.bin /mnt/iso/boot/isos
sudo cp grub.cfg.lmde3.mint19 /mnt/iso/boot/grub/grub.cfg
sudo cp background_image_640x480.jpg /mnt/iso/boot/grub
#
# check things out and dismount
#
sudo gdisk -l /dev/sdc
sudo umount /dev/sdc2 /dev/sdc3

CONFIG FILE: grub.cfg.lmde3.mint19

This config script is merely a sample to show the parameters necessary to boot my favorite distros.  It is up to you to find appropriate ones for the distros that you will to include.  My script typically also includes the small memory tester named 'memtest86+', which you can find from looking on the web if you want it :)
if loadfont /boot/grub/unicode.pf2 ; then
set gfxmode="640x480"
insmod gfxterm
insmod vbe
terminal_output gfxterm
if terminal_output gfxterm; then true ; else
terminal gfxterm
fi
fi
insmod jpg
background_image /boot/grub/background_image_640x480.jpg

menuentry "Mint Debian Edition 3 201808 Cinnamon 64-bit" {
set isofile="/boot/isos/lmde-3-201808-cinnamon-64bit.iso"

loopback loop $isofile
linux (loop)/live/vmlinuz findiso=${isofile} debug boot=live
initrd (loop)/live/initrd.lz
}
menuentry "Mint 19 V2 Cinnamon 64-bit" {
set isofile="/boot/isos/linuxmint-19-cinnamon-64bit-v2.iso"

loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd.lz
}
menuentry "Memory test (memtest86+ 4.20)" {
linux16 /boot/isos/memtest86+-4.20.bin
}
menuentry "Reboot" {
reboot
}
menuentry "Halt" {
halt
}

JPG IMAGE FILE: background_image_640x480.jpg

This JPG image file can be any nice background image you wish displayed on the GRUB2 boot screen :)