Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menuentry examples in /boot/grub/grub.cfg and append any options normally found in the distributions syslinux.cfg file on the 'append' line to the 'linux' line of the menu entry.
Active5 years, 1 month ago
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).
Albert
AlbertAlbert3,13477 gold badges3232 silver badges4545 bronze badges
2 Answers
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):
Supposedly the Win7 ISO can be booted with this entry:
Other ISOs can be booted with Memdisk:
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):
If you're trying to boot a non-Linux LiveCD, you may be out of luck. Again, Memdisk may help:
quack quixotequack quixote36.1k1111 gold badges9090 silver badges123123 bronze badges
You can use dd from the terminal to write an iso file to a partition. Just be careful, if you use dd wrong you can wipe everything. It should look something like this:dd if=Desktop/LinuxCDFile.iso of=/Path/To/Partition
Naos parthNaos parth
Not the answer you're looking for? Browse other questions tagged bootgrubiso-image or ask your own question.
Most Linux distros offer a live environment, which you can boot up from a USB drive, for you to test the system without installing. You can either use it to evaluate the distro or as a disposable OS. While it is easy to copy these onto a USB disk, in certain cases one might want to run the same ISO image often or run different ones regularly. GRUB 2 can be configured so that you do not need to burn the ISOs to disk or use a USB drive, but need to run a live environment directly form the boot menu.
Grub Boot Windows Iso
Obtaining and checking bootable ISO images
To obtain an ISO image, you should usually visit the website of the desired distribution and download any image that is compatible with your setup. If the image can be started from a USB, it should be able to start from the GRUB menu as well.
Grub Boot Iso Image From Usb
Once the image has finished downloading, you should check its integrity by running a simple md5 check on it. This will output a long combination of numbers and alphanumeric characters
which you can compare against the MD5 checksum provided on the download page. The two should be identical.
Setting up GRUB 2
ISO images contain full systems. All you need to do is direct GRUB2 to the appropriate file, and tell it where it can find the kernel and the initramdisk or initram filesystem (depending on which one your distribution uses).
In this example, a Kubuntu 15.04 live environment will be set up to run on an Ubuntu 14.04 box as a Grub menu item. It should work for most newer Ubuntu-based systems and derivatives.
In this example the file
kubuntu-15.04-desktop-amd64.iso
To make GRUB2 look for it in the right place, you need to edit the
file which allows you to add your own menu entries. The file should already exist and contain a few lines.
To start Kubuntu from the above location, add the following code (after adjusting it to your needs) below the commented section, without modifying the original content.
Breaking down the above code
First set up a variable named
$menuentry
. This is where the ISO file is located. If you want to change to a different ISO, you need to change the bit where it says set isofile='/path/to/file/name-of-iso-file-.iso'
.The next line is where you specify the loopback device; you also need to give it the right partition number. This is the bit where it says
Note the
hd0,1
bit; it is important. This means first HDD, first partition (/dev/sda1
).GRUB’s naming here is slightly confusing. For HDDs, it starts counting from “0”, making the first HDD #0, the second one #1, the third one #2, etc. However, for partitions, it will start counting from 1. First partition is #1, second is #2, etc. There might be a good reason for this but not necessarily a sane one (UX-wise it is a disaster, to be sure).
This makes fist disk, first partition, which in Linux would usually look something like
/dev/sda1
become hd0,1
in GRUB2. The second disk, third partition would be hd1,3
, and so on.The next important line is
It will load the kernel image. On newer Ubuntu Live CDs, this would be in the
/casper
directory and called vmlinuz.efi
. If you use a different system, your kernel might be missing the .efi
extension or be located somewhere else entirely (You can easily check this by opening the ISO file with an archive manager and looking inside /casper.
). The last options, quiet splash,
would be your regular GRUB options, if you care to change them.Finally
will load
initrd
, which is responsible to load a RAMDisk into memory for bootup.Booting into your live system
To make it all work, you will only need to update GRUB2
When you reboot your system, you should be presented with a new GRUB entry which will allow you to load into the ISO image you’ve just set up.
Selecting the new entry should boot you into the live environment, just like booting from a DVD or USB would.