UGRUB
Create an ultimate multiboot USB flash drive with Grub2 bootloader
Install / Use
/learn @adi1090x/UGRUBREADME
Multiboot USB Drive With GRUB2 Bootloader
<p align="left"> <a href="https://github.com/adi1090x/uGRUB#prepare-the-usb-drive" target="_blank"><img alt="undefined" src="https://img.shields.io/badge/Preparation-red?style=for-the-badge"></a> <a href="https://github.com/adi1090x/uGRUB#install-grub2-on-the-usb-flash-drive" target="_blank"><img alt="undefined" src="https://img.shields.io/badge/Installation-green?style=for-the-badge"></a> <a href="https://github.com/adi1090x/uGRUB#configuration" target="_blank"><img alt="undefined" src="https://img.shields.io/badge/Configuration-blue?style=for-the-badge"></a> <a href="https://github.com/adi1090x/uGRUB#menu-entries" target="_blank"><img alt="undefined" src="https://img.shields.io/badge/Menu%20Entries-purple?style=for-the-badge"></a> <a href="https://github.com/adi1090x/uGRUB#changing-themes" target="_blank"><img alt="undefined" src="https://img.shields.io/badge/Theming-orange?style=for-the-badge"></a> </p>The ultimate guide to install and configure grub2 bootloader on USB Flash Drive to boot multiple ISO files.

It's a headache to format your USB again and again just to try out a new Linux distribution or when you want to install another distribution, Distrohoppers can feel the pain. This guide may help you with that situation. In this guide, I'm trying to explain how you can install and configure grub2 bootloader on an USB thumb drive and then boot multiple Linux ISOs with it. So, follow this guide if you want to create one. I'll also tell you how you can boot the Linux ISO from an installed Linux OS later in this guide.
Prepare the USB drive
You need to boot into a Linux based operating system for this. I'm assuming that you've already done that. If not, first boot into a Linux environment (eg: Ubuntu live cd). I'm using Arch Linux here to perform these operations. Now follow the steps below :
1. Insert your USB Flash Drive and find out your USB. Open the terminal and enter the lsblk command...
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 29.3G 0 disk
└─sda1 8:1 1 29.2G 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 100M 0 part /boot
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 80G 0 part
├─nvme0n1p4 259:4 0 101.8G 0 part
├─nvme0n1p5 259:5 0 41G 0 part /
├─nvme0n1p6 259:6 0 512M 0 part
├─nvme0n1p7 259:7 0 14G 0 part
└─nvme0n1p8 259:8 0 1G 0 part
You'll get similar output. As you can see in the output above, /dev/sda is my USB drive. On your system, it may be different (like /dev/sdb, /dev/sdc). You can recognize your USB by it's size (mine is 32GB). Be careful here...
2. Now, to modify disk, we need root access. To gain root, type...
$ sudo su
3. Now format your USB Flash Drive to use a single partition. Open a terminal and type...
# fdisk /dev/sdX
Replace
Xwith your actual usb device (eg:/dev/sdb)
- You'll see something similar to this :
Welcome to fdisk (util-linux 2.36).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help):
Warning : All the data on the USB drive will be lost here.
- Type
dto delete the existing partition (repeat this step if you have multiple partitions)
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
- Type
nto create a new partition
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
- Type
pfor primary partition
Select (default p): p
- Type
1to create the first partition
Partition number (1-4, default 1): 1
- Press
Enterto use the default value as first cylinder
First sector (2048-61341695, default 2048):
- Press
Enteragain to use the default value as the last cylinder
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-61341695, default 61341695):
- Type
afor mark partition as active (sets bootable flag)
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
- Type
t(for partition type) and then Typec(to use fat32 partition)
Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
- And, Finally... Type
wto write the changes and closefdisk
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
4. Now, Let's create a Fat32 Filesystem on the USB Flash Drive...
# umount /dev/sdX1
# mkfs.vfat -F 32 -n Multiboot /dev/sdX1
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
Ignore
lowercase labelswarnings. Remember to replaceXwith your USB device.
Install Grub2 on the USB Flash Drive
We have successfully prepared our USB Flash Drive to install grub bootloader on it. Now let's install it, follow the steps below carefully. If you use the wrong syntax, you will receive an error stating "Installation is impossible. Aborting" or something similar.
- Mount the partition you've just created on your USB drive
# mount /dev/sdX1 /mnt
- Now, find out whether the host (system) is booted in
UEFIorBIOSmode. The easiest way is to check to see if/sys/firmware/efiexists. If it does not exist, you booted using traditional BIOS.
# ls -ld /sys/firmware/efi
drwxr-xr-x 5 root root 0 Nov 14 2020 /sys/firmware/efi
As you can see, the directory /sys/firmware/efi exists on my system, which means my host is booted into UEFI mode. Now install grub accordingly...
If Grub2 64 bit UEFI x86_64-efi is installed on the Linux host, then type...
# grub-install --force --removable --target=x86_64-efi --boot-directory=/mnt/boot --efi-directory=/mnt /dev/sdX
If Grub2 32 bit UEFI i386-efi is installed on the Linux host, then type...
# grub-install --force --removable --target=i386-efi --boot-directory=/mnt/boot --efi-directory=/mnt /dev/sdX
If Grub2 BIOS i386-pc is installed on the Linux host, then type...
# grub-install --force --removable --target=i386-pc --boot-directory=/mnt/boot /dev/sdX
- If you've selected the right options, you'll see
Installation finished.ie: for me its...
Installing for x86_64-efi platform.
Installation finished. No error reported.
- You can varify the installation by listing the contents of
/mnt
# ls -l /mnt/boot/grub
total 80
drwxr-xr-x 2 root root 16384 Nov 13 18:04 fonts
-rwxr-xr-x 1 root root 1024 Nov 13 18:04 grubenv
drwxr-xr-x 3 root root 16384 Nov 13 18:04 themes
drwxr-xr-x 2 root root 32768 Nov 13 18:04 x86_64-efi
# ls -l /mnt/EFI/BOOT
total 128
-rwxr-xr-x 1 root root 131072 Nov 13 18:04 BOOTX64.EFI
- That's it. Grub installed on the USB drive. Unmount the partition...
# umount /dev/sdX1
Remember to replace
Xwith your USB device in the commands above.
Reboot your Computer, and enter your Boot Menu. Set the Boot Order to boot from the USB Device. Save your changes and Reboot. If all goes well, you should be presented with the Grub2 command line interface like this...

Configuration
Just installing grub bootloader is not enough to boot the ISOs, We've to configure grub to load the bootable files from the ISO. Well Lucky you, I've already done that for you. I've configured grub to have nice themes with distro logo, added a lot of menu entries to boot various ISO files. However, there's a bit of configuration you need to do before you can actually boot an ISO. Follow the steps below to finish the config for you :
- First, Clone this repository in your home directory
$ cd $HOME
$ git clone --depth=1 https://github.com/adi1090x/uGRUB.git
-
Mount the bootable USB we've created using a file manager to avoid performing further operations as
root -
Copy everything from
grubdirectory of repository to/boot/grubin the USB drive
$ cd ~/uGRUB
$ cp -rf grub/* /path/to/USB/boot/grub
Replace
path/to/usbwith path your USB mounted on. You can get that withlsblkcommand.
- Get the UUID of your USB drive
$ sudo blkid
/dev/sdX1: ... UUID="B17C-FEDA" ...
- Now, Edit the
grub.cfgfile you copied on the USB drive using your favorite text editor
$ vim /path/to/usb/boot/grub/grub.cfg
- Replace every instance of
YOUR_UUIDwith the UUID of your USB drive. eg:
...
else
search --no-floppy --fs-uuid --set=root YOUR_UUID
fi
...
...
else
search --no-floppy --fs-uuid --set=root B17C-FEDA
fi
...
Menu Entries
Before adding or modifying menu entries in our config file, first we need to understand it's format. Below is a skeleton of a simple grub menu entry -
1 menuentry "TITLE" --class ICON {
2 set root='(hd0,PARTITION)'
3 set isofile="PATH/TO/ISO"
4 loopback loop $isofile
5 linux (loop)/KERNEL iso-scan/filename=${isofile} KERNEL_ARGUMENTS
6 initrd (loop)/MICROCODE (loop)/INITRD
7 }
Line 1is the beginning of a menuentry, replace TITLE and ICON according to the ISO.Line 2specifies the root partition, where the bootloader looks for the ISO file.Line 3is the path of the ISO.Line 4creates a loopback device for the ISO.Line 5loads the kernel from the loop, and passes various kernel arguments.Line 6loads initial ramdisk file and microcode (eg :amd-ucode.img) if available.Line 7ends the menu entry.
Example Entry : According to format above, this is the menu entry for Ubuntu ISO...
menuentry "Ubuntu 20.04 Live ISO" --class ubuntu --class linux {
set root='(
Related Skills
node-connect
338.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.4kCommit, push, and open a PR
Security Score
Audited on Feb 22, 2026
