Create a Universal Linux Multiboot USB Drive for Live ISO Images with GRUB 2
This tutorial walks you through building a bootable USB flash drive using a GRUB 2 UEFI bootloader. It supports storing and booting multiple Live Linux ISO images directly from the drive. The key advantage is the simplicity of adding, swapping, or updating Linux distributions, as the core boot setup stays completely untouched. With support for files larger than 4GB, this approach bypasses FAT32 limitations, ensuring flexibility for modern distributions. Follow these steps to create a powerful multiboot USB.
Prerequisites
- Ubuntu-based Linux host environment (64-bit, UEFI system)
Prepare Installation ISO Files
Creating a multiboot USB begins with downloading Live Linux ISO files from official sources. Authentic files ensure a reliable and secure setup. Verify each ISO using signatures or SHA256 checksums to confirm integrity and enhance security. Below are some trusted sources for popular Debian-based distributions to help you get started.
This tutorial uses Ubuntu LTS.
Download the latest release (e.g., ubuntu-24.04.2-desktop-amd64.iso) to ~/Downloads.
Prepare Device
Selecting the wrong device name can permanently destroy your host system’s partitions! Always double-check the device name before proceeding.
Insert your USB drive and find its device name (e.g., /dev/sdX) with this command:
lsblk
Replace /dev/sdX with your actual device name in the commands below.
A device (e.g., /dev/sdX) is not the same as a partition (e.g., /dev/sdX1).
Mixing them up can corrupt data.
Unmount any mounted partitions:
sudo umount /dev/sdX*
Wipe the disk and create a GPT partition table with an ESP (EFI system partition) and an ext4 partition:
sudo sgdisk --zap-all /dev/sdX
sudo sgdisk --new=1:0:+512M --typecode=1:ef00 --change-name=1:esp /dev/sdX
sudo sgdisk --new=2:0:0 --typecode=2:8300 --change-name=2:linux /dev/sdX
sudo sgdisk --print /dev/sdX
The UEFI standard requires the ESP (EFI System Partition) to use FAT32. Since modern ISO files often exceed FAT32’s 4GB file size limit, a separate ext4 partition is used to store the ISO files.
Format the partitions:
sudo mkfs.vfat -F 32 /dev/sdX1
sudo mkfs.ext4 /dev/sdX2
Mount Device
Mount the ext4 partition:
sudo mkdir /mnt/usb
sudo mount -t ext4 /dev/sdX2 /mnt/usb/
Create a directory for the ESP and mount it:
sudo mkdir /mnt/usb/boot
sudo mkdir /mnt/usb/boot/efi
sudo mount -t vfat /dev/sdX1 /mnt/usb/boot/efi
Install GRUB 2 Boot Loader
Install GRUB 2 for UEFI on the USB drive, using the ext4 partition for the boot directory and the ESP for EFI files:
sudo grub-install --target=x86_64-efi --efi-directory=/mnt/usb/boot/efi --boot-directory=/mnt/usb/boot --removable /dev/sdX
The --removable flag installs GRUB 2 to the ESP, ensuring compatibility with UEFI systems.
Copy ISO Files
Copy the ISO files to the mounted ext4 partition:
sudo mkdir /mnt/usb/iso
sudo cp ~/Downloads/ubuntu-24.04.2-desktop-amd64.iso /mnt/usb/iso/
Sync the data to ensure it’s fully written:
sync
Configure Boot Loader
Create and edit the GRUB 2 configuration file:
sudo vi /mnt/usb/boot/grub/grub.cfg
Each distribution requires specific settings.
Below is an example for a recent Ubuntu version.
Ensure ISO filenames match those copied to the iso/ folder.
One can open the ISO file with an archive manager to confirm the exact paths and filenames for vmlinuz and initrd.
These vary by distribution and version.
menuentry "Ubuntu Desktop 24.04.2 64bit" {
set isofile="/iso/ubuntu-24.04.2-desktop-amd64.iso"
set bootoptions="iso-scan/filename=$isofile boot=casper toram noeject noprompt"
loopback loop $isofile
linux (loop)/casper/vmlinuz $bootoptions
initrd (loop)/casper/initrd
}
menuentry "UEFI Firmware Settings" {
fwsetup
}
menuentry "Reboot" {
reboot
}
Add more menu entries for other distributions if needed.
Ensure each has a corresponding ISO file in the iso/ folder.
Here are examples for common Linux distributions:
menuentry "Xubuntu Desktop 24.04.2 64bit" {
set isofile="/iso/xubuntu-24.04.2-desktop-amd64.iso"
set bootoptions="iso-scan/filename=$isofile boot=casper toram noeject noprompt"
loopback loop $isofile
linux (loop)/casper/vmlinuz $bootoptions
initrd (loop)/casper/initrd
}
menuentry "Debian Live 12.10.0 (GNOME) 64bit" {
set isofile="/iso/debian-live-12.10.0-amd64-gnome.iso"
set bootoptions="findiso=$isofile boot=live components quiet splash"
loopback loop $isofile
linux (loop)/live/vmlinuz $bootoptions
initrd (loop)/live/initrd.img
}
menuentry "Linux Mint 22.1 64bit" {
set isofile="/iso/linuxmint-22.1-cinnamon-64bit.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper iso-scan/filename=${isofile} quiet splash --
initrd (loop)/casper/initrd.lz
}
Finalize
Confirm all data is written, then unmount and eject the USB drive:
sync
sudo umount /mnt/usb/boot/efi
sudo umount /mnt/usb/
sudo eject /dev/sdX
Test
This section shows you how to test your multiboot USB to confirm it boots the GRUB 2 menu and Live ISO files. Follow these steps to verify everything works in UEFI mode.
Ensure UEFI mode is enabled and Secure Boot is disabled in your BIOS/UEFI settings. Some Linux ISOs or unsigned GRUB 2 configurations may fail to boot with Secure Boot enabled.
- Plug the USB flash drive into your system.
- Reboot your computer. Press the boot menu key (e.g., F12, F11, or Esc) during startup to select the USB.
- If the USB doesn’t boot, enter the BIOS/UEFI setup (e.g., F2, Del, or Esc). Enable UEFI mode, disable Legacy/CSM mode, and disable Secure Boot. Save changes and restart.
- Select the USB from the boot menu. Look for an entry like 'UEFI: [USB Brand]'.
- The GRUB 2 menu should display your configured ISOs (e.g., Ubuntu, Debian). Select an entry and press Enter to boot the Live ISO. If the ISO fails to boot, check the menu entry configuration in
grub.cfg