136 - UEFI-boot directly from Ubuntu-based ISO files

Ubuntu-based ISOs and those that contain a \boot\grub\loopback.cfg file can be easily UEFI-booted to just by copying some files, no menu is needed!

1. Format a FAT32 USB flash drive (e.g. using RMPrepUSB)

2. Make a \efi\boot directory on the flash drive

3. Copy your Ubuntu-based ISO file (must be <4GB) to the \efi\boot directory and rename it as boot.iso

4. Extract the .efi files from the UEFI_boot_from_ISO.zip file and copy them to the \efi\boot directory

FAT32 volume

  • \efi\boot\bootX64.efi

  • \efi\boot\bootIA32.efi

  • \efi\boot\boot.iso

Note: \efi\boot is lowercase and boot.iso is lowercase.

That's it!

Now you should be able to UEFI-boot (32-bit and 64-bit) from the USB flash drive (disable Secure Boot in the BIOS options first).

To use a different Ubuntu-based ISO which should contain a \boot\grub\loopback.cfg file, simply replace the boot.iso file.

A 64-bit version of Ubuntu will not boot on a 32-bit UEFI system. Use a 32-bit Ubuntu ISO on a 32-bit UEFI system and a 64-bit UEFI ISO on a 64-bit UEFI system.

This tutorial is based on an article here, but the.efi files in my download have been patched by me to load the loopback.cfg file and so ensure reliable booting.

In depth

The .efi file contains a version of grub2 with an embedded grub menu

The grub2 variable iso_path must be set before loopback.cfg is called (and exported).

An example of a simple embedded menu which boots to the loopback.cfg file inside the boot.iso is:

set efi_machtype='x86_64'

export efi_machtype

set efi_arch='EFI64'

export efi_arch

fix_video

set grub2efi_intel_gma_patch='enabled'

export grub2efi_intel_gma_patch

fakebios

set grub2efi_fakebios='generic'

export grub2efi_fakebios

set boot_iso='/efi/boot/boot.iso'

export boot_iso

set iso_path=${boot_iso}

export iso_path

set real_root=${root}

export real_root

set real_prefix=${prefix}

export real_prefix

loopback loop (${real_root})${boot_iso}

set root=(loop)

set gfxpayload=keep

configfile /boot/grub/loopback.cfg

boot

A typical Ubuntu menu entry inside loopback.cfg inside boot.iso would be:

menuentry "Try Ubuntu without installing" {

set gfxpayload=keep

linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} quiet splash ---

initrd /casper/initrd.lz

}

Note that no persistent parameter is specified in the loopback.cfg, so it prevents us from booting with persistence...:-(