Steps to setup a USB drive for use as installer for multiple Linux distributions without using any third-party tools. This is to avoid more convenient but potentially malware Ventoy.
IMPORTANT: Use fdisk -l
and dmesg
to identify the USB disk to use. Steps below assume /dev/sda
as the USB disk to target. If you pick a wrong disk, you would LOSE ALL DATA on that disk.
# Create two partitions
sudo fdisk /dev/sda
1 - EFI System (type=1): size=+1G
2 - Linux: size=rest of the disk (default from fdisk)
# Format
sudo mkfs.vfat -F 32 /dev/sda1
sudo mkdfs.ext4 /dev/sda2
# Setup grub on /dev/sda1
sudo mkdir -p /mnt/usb
sudo mount /dev/sda1 /mnt/usb
sudo grub-install --target=x86_64-efi --removable --boot-directory=/mnt/usb/boot --efi-directory=/mnt/usb
# Grub config
sudo mkdir -p /mnt/usb/boot/grub
## (see grub cfg below)
sudo vi /mnt/usb/boot/grub/grub.cfg
# Copy ISO files to /dev/sda2
sudo umount /mnt/usb
sudo mount /dev/sda2 /mnt/usb
sudo mkdir /mnt/usb/iso
cp ~/Downloads/ubuntu-desktop.iso /mnt/usb/iso/
cp ~/Downloads/ubuntu-server.iso /mnt/usb/iso/
(With /dev/sda1
mounted, edit /mnt/usb/boot/grub/grub.cfg
)
Get UUID of partition with ISO files:
blkid /dev/sda2
Use this blkid in the grub config file below:
set timeout=30
set default=0
# Find the second partition by its filesystem label or UUID
# search --set=root --label YOUR_SECOND_PARTITION_LABEL
# OR use UUID (more reliable)
search --set=root --fs-uuid <<<<YOUR_SECOND_PARTITION_UUID>>>>
menuentry "Ubuntu Desktop" {
set isofile="/iso/ubuntu-desktop.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd
}
menuentry "Ubuntu Server" {
set isofile="/iso/ubuntu-server.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd
}
# Add more entries as needed
sudo umount /mnt/usb
sudo sync
On Dell laptops, press F12
for one-time boot menu. Booting with USB-C does not seem to work, so use USB-A for booting.