Ubuntu – How to boot from an .iso file in GRUB2?

grub2isosoftware-recommendation

Is there a way for doing this?

Best Answer

It may be much easier than the impression you get from all the detailed explanations on the web. I just did the following on Ubuntu 12.04 to boot FreeDOS .iso for a firmware update

  • Install grub-imageboot
  • copy your .iso file(s) to /boot/images/
  • run update-grub2

Or copy/paste these:

sudo -s
apt-get install grub-imageboot
mkdir /boot/images/
cp $YOUR_ISO_FILE.iso /boot/images/

update-grub2

That's it.

Sometimes, you may need 2 more steps to do before running update-grub2:

If you never did it before, you need to edit /etc/default/grub so that you see the grub menu on boot:

## To show the menu, disable the hidden_timeout, and set a timeout
#GRUB_HIDDEN_TIMEOUT=0
GRUB_TIMEOUT=10

For some .iso images, you may need to add this option in /etc/default/grub-imageboot : (I needed it for my FreeDOS .iso)

ISOOPTS="iso raw"

If you did edit one of these config. files, you need to run update-grub2 again.

Update: Here is the resulting menuentry asked by "dma_k"

menuentry "Bootable ISO Image: SV100S2_64_128_120229" {
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos6)'
    search --no-floppy --fs-uuid --set=root 6ca082d0-63d0-48c3-9e5f-2ce5d7a74fe4
    linux16 /boot/memdisk iso raw
    initrd16 /boot/images/SV100S2_64_128_120229.iso
}

This was for a FreeDOS image with some firmware update or such.