Grub2 ISO Boot

Are you tired of burning away one disk after another just to try out a different flavour or wear out that USB stick for the mere fun of it? How about booting directly off the ISO image using Grub2? Personally I keep pending ISO images in ~/iso/. However, some ISO images refuse to work unless placed in the filesystem's root.

Unfortunately there doesn't exist an official standard for booting directly off an ISO image. The below menu entries are rendered preformatted for better readability. Make sure to save the linux command on one single line in your /etc/grub.d/40_custom file!

For the sake of simplicty I'm using /path/to/iso.iso to indicate where the ISO image lives and set the first partition of the first hard disk (hd0,1) as the loop device. You'll probably want to change that and any occurances of sda1 to match your own environment.

4M Linux

menuentry "4M Linux ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/boot/bzImage
    from=/dev/sda1$iso
    iso-scan/filename=$iso
    noprompt
    noeject
  initrd (loop)/boot/initrd.gz
}

Triggers kernel panic as of version 11!

Android

menuentry "Android ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/kernel
    from=/dev/sda1$iso
    iso-scan/filename=$iso
    noprompt
    noeject
  initrd (loop)/initrd.img
}

Arch Linux

menuentry "Arch ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/arch/boot/x86_64/vmlinuz
    archisolabel=ARCH_201602
    img_dev=/dev/sda1
    img_loop=$iso
    earlymodules=loop
  initrd (loop)/arch/boot/x86_64/archiso.img
}

Change label ARCH_201602 to match your release.

Backbox Linux

menuentry "Backbox ISO" {
  set iso="/path/to/iso.iso"
  set gfxpayload="keep"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    from=/dev/sda1$iso
    file=/preseed/backbox.seed
    boot=casper
    iso-scan/filename=$iso
    noprompt
    noeject
    quiet
    splash --
  initrd (loop)/casper/initrd.gz
}

Bodhi Linux

menuentry "Bodhi ISO" {
  set root="(hd0,1)"
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    file=/cdrom/preseed/custom.seed
    boot=casper
    iso-scan/filename=$iso
    nomodeset
  initrd (loop)/casper/initrd.gz
}

Budgie Linux

menuentry "Budgie ISO" {
  set iso="/path/to/iso.iso"
  set gfxpayload="keep"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    from=/dev/sda1$iso
    boot=casper
    iso-scan/filename=$iso noprompt
    noeject
    quiet
    splash --
  initrd (loop)/casper/initrd.lz
}

Debian Dog

menuentry "Debian Dog ISO" {
  set iso="/path/to/iso.iso"
  loopback loop $iso
  linux (loop)/live/vmlinuz1
    boot=live
    config
    swapon
    noeject
    showmounts
    rw-basemount
    quickreboot
    iso-scan/filename=$iso
    quiet
    splash
    autologin
    init=/bin/systemd
  initrd (loop)/live/initrd.img
}

Elementary OS

menuentry "Elementary OS ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    boot=casper
    iso-scan/filename=$iso
    noprompt
    noeject
    quiet
    splash
  initrd (loop)/casper/initrd.lz
}

GParted

menuentry "Gparted ISO" {
  set iso="/path/to/iso.iso"
  loopback loop $iso
  linux (loop)/live/vmlinuz
    boot=live
    config
    union=aufs
    noswap
    noprompt
    vga=788
    ip=frommedia
    toram=filesystem.squashfs
    findiso=$iso
  initrd (loop)/live/initrd.img
}

Lubuntu

menuentry "Lubuntu ISO" {
  set iso="/path/to/iso.iso"
  set root="(hd0,1)"
  set gfxpayload="keep"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz.efi
    from=/dev/sda1$iso
    file=/preseed/lubuntu.seed
    boot=casper
    iso-scan/filename=$iso
    quiet
    splash --
  initrd (loop)/casper/initrd.lz
}

Open Mandriva

menuentry "Open Mandriva ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/isolinux/vmlinuz0
    root=live:CDLABEL=OpenMandrivaLx_2014.2
    iso-scan/filename=$iso rd.live.image
    toram --
  initrd (loop)/isolinux/initrd0.img
}

Minimum 2 GiB of RAM! Change label CDLABEL to match your release.

Porteus Portable Linux

menuentry "Porteus ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/boot/syslinux/vmlinuz
    from=/dev/sda1$iso
    iso-scan/filename=$iso
    noprompt
    noeject
  initrd (loop)/boot/syslinux/initrd.xz
}

SliTaz

menuentry "SliTaz ISO" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/boot/vmlinuz-2.6.37-slitaz
    iso-scan/filename=$iso
    boot=live
    noprompt
    noeject
  initrd (loop)/boot/rootfs.gz
}

Applies to core ISO!

Tiny Core

menuentry "Tiny Core ISO" {
  set iso="/path/to/iso.iso"
  set root="(hd0,1)"
  loopback loop $iso
  linux (loop)/boot/vmlinuz
  tce=sda1
  initrd (loop)/boot/core.gz
}

Boots to command line!

Trisquel

menuentry "Trisquel ISO" {
  set iso="/path/to/iso.iso"
  set gfxpayload="keep"
  set root="(hd0,1)"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    from=/dev/sda1$iso
    file=/preseed/trisquel.seed
    boot=casper
    iso-scan/filename=$iso
    noeject
    quiet
    splash --
  initrd (loop)/casper/initrd
}

Ubuntu Studio

menuentry "U Studio ISO" {
  set iso="/path/to/iso.iso"
  set gfxpayload="keep"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    from=/dev/sda1$iso
    file=/preseed/ubuntustudio.seed
    boot=casper
    iso-scan/filename=$iso noprompt
    noeject
    quiet
    splash --
  initrd (loop)/casper/initrd.lz
}

USU

menuentry "USU ISO" {
  set iso="/path/to/iso.iso"
  set gfxpayload=keep
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz
    from=/dev/sda1$iso
    file=/preseed/custom.seed
    boot=casper
    iso-scan/filename=$iso
    noeject
    quiet
    splash --
  initrd (loop)/casper/initrd.gz
}

Vector Linux

menuentry "Vector Linux ISO" {
  set iso="/path/to/iso.iso"
  set root="(hd0,1)"
  loopback loop (hd0,1)$iso
  linux (loop)/isolinux/kernel/sata
  initrd (loop)/isolinux/init.lz
}

Boots to command line!

Zorin OS

menuentry "Zorin" {
  set iso="/path/to/iso.iso"
  loopback loop (hd0,1)$iso
  linux (loop)/casper/vmlinuz.efi
    boot=casper
    preseed=/preseed/ubuntu.seed
    from=/dev/sda1$iso
    iso-scan/filename=$iso
    noprompt
    noeject
  initrd (loop)/casper/initrd.lz
}