Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have previous versions of Ubuntu, which includes grub2. I see on the Internet that, grub2 can boot from iso file, So, I booted Ubuntu from iso file, But whenever I tried to install, it gives an error that, "The disk need to be unmounted first before install".

My question is: How can I install Ubuntu 12.04 from iso file using grub2?

share|improve this question
I would suggest you to go through this links ISO Booting with Grub 2, link 2,link 3. Also read oldfred post in Install Ubuntu from GRUB2 – atenz Jun 28 '12 at 8:56
What OS do you have right now? – Mitch Jun 28 '12 at 10:17
grub2 is runnig, that's why you can't install ^^ . he runs the ISO, and the grub2 partition/s are running, which is/are your installed Ubuntu partition/s. So you have to install from a USB or a Disk, then the Disk or the USB are the "mounted" partition, so you'll be able to install (: – yinon Feb 16 '13 at 22:19
up vote 4 down vote accepted

I have successfully booted from iso file and install from that iso file!

The procedure is here

  • First put your Ubuntu iso file in a partition, I have put that in "NTFS" partition, But it should work with ext4 partition also. It is second partition in my hard disk. For example, let's name our Ubuntu iso file as ubuntu.iso. the partition is /dev/sda2 in my case. The location of the Ubuntu iso file is now in (hd0,2)/ubuntu.iso as seen by grub2, i.e It is in the root of the second partition

  • Then reboot your system, containing grub2.

  • Press SHIFT to bring the grub2 menu, if it is not shown by default.

  • In the grub2 menu, press C to bring Command Prompt of the grub2.

  • In the command prompt type this one by one, pressing Enter after each line.

    1. loopback loop (hd0,2)/ubuntu.iso
    2. linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu.iso quiet splash --
    3. initrd (loop)/casper/initrd.lz
    4. boot

In 2nd command, if vmlinuz doesn't work use vmlinuz.efi .

After typing boot press Enter. The Live Ubuntu system will be started.

  • Open a terminal and type the below command to unmount the drive where iso file resides

    sudo umount -l /isodevice  
  • Then proceed with the normal installation procedure.


  1. If you put your iso file in a partition other than 2nd partition, change (hd0,2) to (hd0,X), where X refers to the partition number.

  2. If you put your iso file in a USB pendrive, and you start grub2 from Hard disk (installed by your previous system) , change (hd0,2) accordingly. If you have only one partition in the pendrive, it will be (hd1,1). here hd1 refers to the pen drive.

  3. I have tested this method for installing Ubuntu in ext4 and jfs partition, they worked. But installation in btrfs partition failed.

share|improve this answer

Your Answer


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.