5

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?

  • 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
9

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.

    loopback loop (hd0,2)/ubuntu.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu.iso quiet splash --
    initrd (loop)/casper/initrd.lz
    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.

Notes:

  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.

|improve this answer|||||
  • It helps me a lot – van abel Apr 20 '17 at 10:00
  • @vanabel glad to hear this, especially for one your answers that doesn't get much attention :) – Anwar Apr 20 '17 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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