Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I don't want to burn a CD, DVD or USB memory stick. And I don't care about saving the existing operating system (Linux Mint). I want to install Ubuntu (actually Kubuntu 12.04 LTS) to the computer directly from the ISO image. The image is for the Kubuntu Live DVD (3.5 GB).

The computer is now booted into Linux Mint. A set of command line steps would be satisfactory. In my mind, I simply need to trick the existing system into thinking I inserted a CD/DVD, right?

I know there is a similar question already but it does not have a good answer. The answer basically says, "see this link." I reviewed the link and I decided that StackExchange needs a good answer to this question. Furthermore, most answers at other places on the Internet assume the user is coming to Ubuntu from Windows. So I think this question is one that needs a good answer here. Thanks

share|improve this question
    
Isnt this the same as this? askubuntu.com/questions/76401/… –  fossfreedom Sep 1 '13 at 19:28
    
@fossfreedom - did you read the answer to that question? It isn't really an answer -- at least it does not strike me as an answer worthy of StackExchange. Surely there is a better answer out there. –  MountainX Sep 1 '13 at 19:31
    
You can boot from an ISO, and also install. There is a wiki just for that. –  mikewhatever Sep 1 '13 at 19:38
    
Ughhh, this wiki page needs some serious cleanup: help.ubuntu.com/community/Installation/FromLinux –  Richard Sep 1 '13 at 19:54

2 Answers 2

up vote 17 down vote accepted

I found this looking around on the net.

Grub2 is capable of directly booting ISO images for many Linux distros if the entries have been properly defined in the Grub2 configuration files.

The ISO image can be placed virtually anywhere on your HDD but for the sake of simplicity, we would place it inside a new directory under /boot.

1.Create the new directory and copy your ISO image:

sudo mkdir /boot/iso
sudo cp ~/Desktop/name.iso /boot/iso

Where ~/Desktop/name.iso is the location and name of your ISO image assuming that the image is located at your desktop.

2.Add the Grub2 entry:

The entry for the ISO image needs to be added to /etc/grub.d/40_custom file. Edit the file by:

gksudo gedit /etc/grub.d/40_custom

And replace the text in that file with this one:

#!/bin/sh
echo "Adding 40_custom." >&2
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Kubuntu ISO" {
        set isofile="/boot/iso/kubuntu-12.04.iso"
        loopback loop (hd0,8)$isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
        initrd (loop)/casper/initrd.lz
}

Where is:

  • "Kubuntu ISO" = The name you want to display in the Grub menu.
  • "boot/iso/kubuntu-12.04.iso" = The location and name of your ISO image.
  • (hd0,8) = The partition which contains the ISO image.

Grub reads the partitions in a different way than Ubuntu does. 'hd0' means first HDD which is read as sda by Ubuntu, and 8 is the partition which is the same as for Ubuntu. So in other words, (hd0,8) means 'sda8'.

To find out your partition, run this command in a Terminal:

sudo fdisk -l

Suppose your image is contained in the sda1 partition, you'd change (hd0,8) in the above line to (hd0,1) and if the image is in the 'sdb1' partition, you'd change (hd0,8) to (hd1,1).

3.Save and close this file and now run this command:

sudo update-grub

4.Reboot and choose the new ISO entry from Grub menu this time. Hopefully, it will boot successfully to the desktop.

Now, if you want to perform an installation from the same ISO, you'd need to unmount the ISO image first as it is mounted from a partition on your HDD (probably you've got a single HDD and want to install Ubuntu to the same HDD) and the installer needs to unmount any mounted partitions before it can make any changes.

So, from the Live CD environment, go to a Terminal and run:

sudo umount -l /isodevice

That's all. Now you can double-click the 'Install' icon at the desktop and proceed with the installation.

More info see Ubuntu Forums 1, and Ubuntu Forums 2

Source:TuxGarage

share|improve this answer
    
Using this to load Ubuntu 14.04 (64-bit), I had to change the kernel on line 4 of the menuentry to vmlinuz.efi, hence it became:linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noprompt noeject –  nanyaks May 9 at 5:48

I couldn't use Mitch's answer because I wanted to install Ubuntu minimal and the ISO image didn't work (there's no vmlinuz). So instead I adapted it to use NetbootInstall

I put the downloaded files into /boot/netboot and added the following entry to the grub config:

menuentry "NetInstall" {
    linux (hd0,0)/boot/netboot/ubuntu-installer/amd64/linux
    initrd (hd0,0)/boot/netboot/ubuntu-installer/amd64/initrd.gz
}

I then forgot to run

sudo update-grub

so I had to boot into the existing linux once again, but having finally updated grub the actual installation went very smoothly.

share|improve this answer

protected by Community Jan 19 at 10:02

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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