The creator of mkusb has released an Template Image for creating BIOS/UEFI boot partitions on a USB.
How can I use this image to boot ISO files from a USB?
The creator of mkusb has released an Template Image for creating BIOS/UEFI boot partitions on a USB.
How can I use this image to boot ISO files from a USB?
There are a few pre-built programs available for multibooting Linux systems: MultiBootUSB, Ventoy and YUMI. The inner workings of these tools is not very transparent.
Now it is easy to build an ISO booting USB that works in BIOS and ISO mode from scratch.
There are several versions of the mkusb BIOS/UEFI GRUB template.
https://phillw.net/isos/linux-tools/uefi-n-bios/dd_grub-boot-template-for-uefi-n-bios.img.xz For use in Windows 10 and in Linux.
https://phillw.net/isos/linux-tools/uefi-n-bios/mkusb_grub-boot-template-for-uefi-n-bios_fat32_4GB_use-in-wins.img.xz For use in Windows 7 thru 10, it has a 4GB FAT32 No 1 partition that is accessible in older versions of Windows or IOS.
MD5SUM's can be found here: https://phillw.net/isos/linux-tools/uefi-n-bios/grub-boot-templates-for-uefi-n-bios.md5.
Basic ISO Booter (Min 4GB USB)
Flash mkusb_grub-boot-template-for-uefi-n-bios_fat32_4GB_use-in-wins.img
to a USB using Rufus, Etcher, Gnome-Disks, mkusb or etc. (Use 7zip to extract from xz if necessary).
Copy the ISO file for any flavor of Ubuntu (Kubuntu, Lubuntu ... Xubuntu) or Linux Mint* to the USB.
Rename the ISO file to ubuntu.iso
.
Boot the USB and confirm that everything works.
Linux Mint, Elementary OS and some flavors of Ubuntu may require initrd.lz
rather than initrd
in grub.cfg.
Basic ISO Booter with Persistent Partition Alt1 (Min 4GB USB) Only one persistent partition is allowed per Computer.
Create Basic ISO Booter above.
Boot USB, open GParted and format empty space to the right of the boot partitions as ext4, label it casper-rw
.
Basic ISO Booter with Persistent Partition Alt2 (Min 4GB USB)
Create Basic ISO Booter above.
Boot the USB, at the boot menu select live-only option and press e
to edit.
Use the arrow keys to get to the end of the linux line, (one space after the word nopersistent
). and type toram
then press F10 to boot.
In Terminal type sudo umount -lrf /isodevice
to unmount the USB.
Open GParted. Move EFI boot partition 1MB from right side. Move BIOS boot partition next to it. click apply, Adjust Partition No1 size as required.
Create a new ext4 partition in the unused space, label it casper-rw
A persistent partition labeled home-rw can also be created, It is similar to a /home partition in a Full install.
Boot the USB using the persistent menuentry option.
Named ISO Files
Boot the USB and edit grub.cfg
using
sudo gedit -H /media/ubuntu/usbboot/boot/grub/grub.cfg
Add proper ISO names, (and path), as shown below. Note: Using /etc/grub.d/40_custom
to edit grub.cfg
does not work with ISO files.
menuentry "ubuntu-20.04.1-desktop-amd64.iso live-only" {
set isofile="/ubuntu-20.04.1/ubuntu-20.04.1-desktop-amd64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject quiet splash maybe-ubiquity nopersistent
initrd (loop)/casper/initrd
}
ISO Multi-Booter (Min 8GB USB)
Boot toram
and move boot partitions as above using GParted.
Resize FAT32 partition to fill empty space.
Copy preferred Ubuntu flavors (Kubuntu, Lubuntu ... Xubuntu) ISO's to USB.
Edit grub.cfg providing a uniquely named menuentry for each ISO.
ISO Multi-Booter with Multi-Persistence (16GB+ USB)
Create multi-booter as above.
Add a uniquely named folder to a FAT32 partition for each ISO file requiring persistence if not already there.
Add a persistence file labeled writable
to each folder.
Add a persistence file labeled home-rw
to each folder as desired.*
Edit linux
line of each persistent
menuentry adding persistent-path=foldername
Example: linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject quiet splash fsck.mode=skip persistent persistent-path=ubuntu-20.04.1
To create persistence file:
sudo dd if=/dev/zero of=casper-rw bs=1M count=512
sudo mkfs.ext4 -F casper-rw
casper-rw
with writable
home-rw
partition replace casper-rw
with home-rw
Additional Tweaks
Booting to RAM: Add toram
at the end of the grub.cfg menuentry linux line.
Eliminating Disk Check: Add fsck.mode=skip
at the end of the grub.cfg live-only
menuentry linux line.
Eliminating Try/Install screen: Remove maybe-ubiquity
from the grub.cfg live-only
menuentry linux line.
Safe Graphics Mode: Add nomodeset
at the end of the grub.cfg menuentry linux line.
To watch boot progress remove quiet splash
from the menuentry linux line.
Personalize a persistent ISO. Go to settings/Users and add a New User and a password. You can make new users for each persistent ISO.
Additional menuentries see: https://help.ubuntu.com/community/Grub2/ISOBoot/Examples
When booted from the USB, data copied to the disk is located in the isodevice folder.
These templates require editing to work with other Linux distros
grub.cfg
).Additional Menuentries for some popular Linux distro's:
Debian Live
menuentry "debian-live-10.5.0-amd64-gnome" {
set isofile="/debian-live-10.5.0/debian-live-10.5.0-amd64-gnome.iso"
loopback loop (hd0,1)$isofile
linux (loop)/live/vmlinuz-4.19.0-10-amd64 boot=live findiso=$isofile persistence persistence-path=debian-live-10.5.0
initrd (loop)/live/initrd.img-4.19.0-10-amd64
}
To create persistence file:
sudo dd if=/dev/zero of=persistence bs=1M count=512
sudo mkfs.ext4 -F persistence
then mount it
mkdir perst
sudo mount persistence perst
Create a persistence.conf file
echo / union >persistence.conf
echo >>persistence.conf
Move it to the perst
directory.
And unmount:
sudo umount perst
To create persistence partition:
Create an ext4 partition, label it persistence
and drop a persistence.conf file into it.
/casper/vmlinuz
to /install.amd/vmlinuz
and /casper/initrd
to /install.amd/initrd.gz
. I have not had a chance to play with persistence yet. I will leave the edits until I have confirmed the fix on Debian Live.
– C.S.Cameron
Aug 29 '20 at 10:59
casper
needs to be changed to live
in three places and findiso=$isofile needs to be added to the linux
line. Both vmlinuz
and iinitrd.img
should be followed by -4.19.0-10-amd64
I think it works better without splash
. Persistent becomes persistence and fsck.mode=skip
is not required. I think casper-rw/writable is called persistence.
– C.S.Cameron
Aug 30 '20 at 13:04
initrd
to initrd.lz
. Lubuntu 16.04 also uses initrd.lz
. casper-rw
still works for the persistence file, writable
doesn't.
– C.S.Cameron
Sep 01 '20 at 13:50
mkusb_grub-boot-template-for-uefi-n-bios_fat32_4GB_use-in-wins_2020-09-07.img.xz
which I think is better than the previous 'wins' files. Please check that it works for you and let me know the result. See also this link. You may suggest that I add another link or two to the end of that post in the Ubuntu Forums.
– sudodus
Sep 08 '20 at 11:06