Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I boot into an ISO file in GRUB? The ISO file is on a reiserfs partition and GRUB can access it (already tested that).

share|improve this question
    
which version of grub? –  quack quixote Jun 18 '10 at 17:08
    
The same question answered here. –  dma_k May 12 at 10:07

1 Answer 1

up vote 34 down vote accepted

The biggest problem with booting an ISO file is that ISOs that are designed to be booted are almost always designed to be booted from a CD. As explained on Marco's blog regarding Grub 2 (emphasis mine):

GRUB can read ISO9660 (”iso”) images. It can for example load the first few sectors and boot it. But most people do not realize is “what then?”. What would the loaded operating system do? It will most likely look for a CDROM, which it won’t find, and fail.

So the dead-simple-est way to boot from some random ISO file is to load it into a virtual machine (VirtualBox, VMware, or Virtual PC) as a virtual CD and boot it there. That should almost always work, because to the VM, it's not an ISO file -- it's a real CD on real CD hardware.

Booting from an ISO file on bare metal is much harder. How you do this depends on which version of Grub you're using, and results can differ depending on what ISO you're using and how it was configured to boot. This is why most boot-ISO-from-USB tools (Unetbootin, WinToFlash, etc) usually extract the ISO contents to the drive -- because that way they can be accessed directly, without confusing the OS being booted.


Grub 1

... not sure. If possible, menu entries will probably look a lot like Grub4DOS, though I think the "map --hook" command is a Grub4DOS enhancement. On the plus side, Grub has wider filesystem support than Grub4DOS.

A note on Grub with reiserfs (unconfirmed) indicates you "have to mount your partition with notail for it to work".

Memdisk is an option; see below.


Grub4DOS

Grub4DOS offers some experimental "CD emulation" that works with some ISOs. Unfortunately, Grub4DOS only reads FAT32/NTFS filesystems. Download Grub4DOS.

Here's a sample entry (source):

title fdfullcd.iso (0xFF)
  find --set-root /fdfullcd.iso
  map /fdfullcd.iso (0xFF)
  map --hook
  root (0xFF)
  kernel /isolinux/data/memdisk
  initrd /isolinux/data/fdboot.img

Supposedly the Win7 ISO can be booted with this entry:

title Windows 7
  map (hd0,0)/win7.iso (hd32)
  map --hook
  chainloader (hd32)

Other ISOs can be booted with Memdisk:

title Boot Hardware Detection Tool from iso image (with 'iso' parameter)
  kernel /memdisk iso
  initrd /hdt.iso

You can also use a menu configurator like MultiBootISOs.exe from PenDriveLinux. Place ISOs on the flash drive, and run the utility to install the bootloader and configure the boot menu.

Here's a Hak5 episode on installing Grub4DOS.


Grub 2

Here's a couple of example Grub2 entries. chainloader doesn't work to boot an ISO at present, so these entries must (1) use loopback to "mount" the ISO, and (2) add something like iso-scan or findiso to the linux line that specifies the ISO file.

Unfortunately, there's no generic way to do this. Each different boot entry must be customized to the target ISO's contents. Most Linux LiveCDs use ISOLINUX as a bootloader; find the isolinux.cfg and examine that boot entry to see what it usually boots.

Example entries (source):

menuentry "Ubuntu Live 9.10 32bit" {
 loopback loop /boot/iso/ubuntu-9.10-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-9.10-desktop-i386.iso noeject noprompt --
 initrd (loop)/casper/initrd.lz
}

menuentry "Grml small 2009.10" {
  loopback loop /boot/iso/grml-small_2009.10.iso
  linux (loop)/boot/grmlsmall/linux26 findiso=/boot/iso/grml-small_2009.10.iso apm=power-off lang=us vga=791 boot=live nomce noeject noprompt --
  initrd (loop)/boot/grmlsmall/initrd.gz
}

If you're trying to boot a non-Linux LiveCD, you may be out of luck. Again, Memdisk may help:

menuentry "Boot Hardware Detection Tool from iso" {
  linux16 /memdisk iso
  initrd16 /hdt.iso
}
share|improve this answer
    
Wow, thank you for the detailed response! –  Albert Jun 18 '10 at 18:40
    
@albert: i'm using Grub2 on a flash drive and been frustrated by the same things, so it wasn't hard putting together. i'm looking into your other question, but i've never tried "burning" an ISO onto a partition before, so it may be... interesting. –  quack quixote Jun 18 '10 at 18:54
    
Ofc I can boot it inside VMware (and I also already did) but that doesn't help me much because it is Windows and when I install it via VMware on my disk, it wont boot later on (stupid Windows...). –  Albert Jun 18 '10 at 19:00
    
Can you give me a suggestion what option I should try first, i.e. Grub1, Grub2 or Grub4DOS? I can just install whatever is needed, that wont really be the problem. –  Albert Jun 18 '10 at 19:01
    
@albert: are you asking in reference to your earlier question? i believe your best bet is to use the extraction method; the Windows installer is one of those ISOs that have problems when they aren't booted from hardware. you can try memtest, but i don't know much about it. you probably want to get a flash drive and use that; see superuser.com/questions/66948/… or superuser.com/questions/62193/install-win7-from-usb –  quack quixote Jun 18 '10 at 20:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.