Page 1 of 29 12311 ... LastLast
Results 1 to 10 of 290

Thread: ISO Booting with Grub 2

  1. #1
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    ISO Booting with Grub 2

    This page has been migrated to the Ubuntu Community Documentation site. For the most up-to-date information, please visit:
    https://help.ubuntu.com/community/Grub2/ISOBoot

    The above page is a sub-page of the main community documentation regarding Grub2.

    Thank you to all the users who posted in these threads and expanded our knowledge of Grub 2 since it's introduction.

    A thread for discussion of the wiki can be found at http://ubuntuforums.org/showthread.php?p=12073029

    If you have a known working menuentry not posted on the community Grub2/ISOBoot/Examples page please post it on that page. If you do not have write privileges on that page post the menuentry in the previous link.

    Support threads regarding the wiki and it's content should be created in a suitable forum.

    ----

    ISO Booting with Grub 2

    This thread will detail how to place a menu entry in Grub 2 to allow booting an ISO file stored on your computer without a CD/DVD. Not all ISOs will work with Grub 2. The ISO must be constructed in a manner to allow this method of booting. Currently the Ubuntu family of Live CD ISOs (9.10 and later), Gparted CD, Parted Live CD, and SystemRescue CD, among others, support this feature. As pointed out by Splooshie123 in Post 240, this method (as described) won't work with the Ubuntu Alternate Installation CD.

    I have another thread which covers actually installing Ubuntu from an ISO booted from a Grub promtp. This might be useful for someone who can download the ISO but can't use a CD/DVD. That thread is located here:
    HOWTO: Boot & Install Ubuntu from the Grub Rescue Prompt

    I have received a report from YorYor in Grub 2 Basics Post #642 that at least some image files (.img) can also be booted by Grub 2. An example menuentry is included below.

    Note 1: In addition to being able to use Grub2 to boot Ubuntu (and other) ISOs, Multisystem offers additional capabilities which the user may find helpful in booting and testing other OS's ISOs such as Fedora without installing the OS. Thanks to seanbw in Post #137 for calling attention to this app.

    Note 2: I have written a guide on booting the Ubuntu ISO from the Grub rescue prompt in order to repair a previously-working installation. The guide also includes instructions on how to install Ubuntu from the rescue prompt via the Live CD ISO or via the Internet.
    HOWTO: Boot & Install Ubuntu from the Grub Rescue Prompt


    Being able to mount an Ubuntu ISO via the Grub menu has the following advantages:
    • There is no need to insert a CD/DVD.
    • Boot times of the CD/DVD's ISO is normally faster than booting from an actual CD/DVD.


    Downloading ISOs:

    Note: Users should consider using torrents to download the ISOs, especially after a new release when servers are likely to be very busy.

    Here are a few sites from which users can download bootable ISO images:


    Where to place the ISOs:

    I prefer storing the ISO files on a non-system partition but for simplicity's sake in this post I will make a new folder in the system's /boot folder called "iso". The ISO files will reside in the sda1 partition in the /boot/iso folder. In this example, the address of the ISO, translated so Grub2 understands, is:
    (hd0,1)/boot/iso/<iso_filename>

    Since 'rescue CDs' such as Gparted are loaded into memory and use a self-contained version of linux, the format of the partition does not matter as long as it is one that Grub 2 can recognize. Additionally, the ISOs like Gparted's can be located on a system partition since the partition is not mounted. This allows the real partition to be resized even if the ISO is located in the same partition.

    The user will need to adjust the Grub menu entries to properly point to the correct partition and folder for their own situation.


    Notes on ISO locations
    • Separate /home folder: Many Ubuntu users have a separate HOME partition. If the ISO folder or file is placed in your HOME folder, be sure to use the correct path in the menuentry - do not include "/home" in the path. Since a separate /home partition is only mounted by fstab later in the boot process, Grub 2 will not find the file if the path is designated (hdX,Y)/home/username/iso/isofilename.

    • Non-Linux Partitions: If the ISO is stored on a non-Linux partition (NTFS, vfat, etc), the appropriate module must be loaded to ensure Grub2 can read the filesystem. An example of an added module as the first line below the menuentry follows. (See ny6ga's post #39 for a complete example)
      menuentry "Parted Magic" {
      insmod ntfs
      ... continued ....


    • The correct Grub 2 path for an ISO file normally found in /home/username/iso/isofilename would be (hdX,Y)/username/iso/isofilename, with (hdX,Y) being the partition of the separate HOME files and username being the user's login name.
    • Example: / is on sda5, /home/drs305 is on sda10. The iso file is in folder "iso" and the filename is "maverick-desktop-i386.iso". When running Ubuntu, the file can be found at /home/drs305/iso/maverick-desktop-i386.iso.
      In Grub 2, the address would be: (hd0,10)/drs305/iso/maverick-desktop-i386


    To make the new folder in which to store the ISOs:
    Code:
    sudo mkdir /boot/iso
    Then copy the ISO file(s) as root to this new folder.
    Note: If you will have your ISO's stored on another partition, be sure the partition is mounted before copying files to the mount point.

    To summarize, I have downloaded the ISOs, placed them in the /boot/iso folder of the sda1 partition. If I did a search for the Ubuntu Lucid ISO, it would be shown in:
    /boot/iso/ubuntu-10.04-desktop-i386.iso

    Customizing the menuentries:

    In the following examples, the user can change the title (between the quotation marks) on the menuentry line to whatever title is desired.

    The filenames reflect the current release version of the ISOs mentioned previously. As newer versions are released the filenames will need to adjusted to reflect the newer filename.


    Making the Grub 2 entry:

    The following line is not necessary but provides feedback during the execution of "update-grub". It generates a line in the terminal when updating Grub to indicate that the 40_custom file contents are being added to the Grub2 menu:
    echo "Adding 40_custom." >&2
    Sample /etc/grub.d/40_custom file:

    The simple way to add entries. The easiest way to incorporate ISOs into the Grub2 menu is to add them to the /etc/grub.d/40_custom file. Leave the existing lines in 40_custom as they are, and add the new entries below. The menu items will appear at the bottom of the Grub 2 menu. If you wish the items to appear first, name the menu "06_custom" and make the file executable. Items in "06_custom" will appear before linux and other OS menu items.

    Manually creating the menuentry. If you create the entry manually, I recommend a slightly different format for the menuentry. Incorporating the set isofile= line to set the path and filename of the ISO file allows for easier troubleshooting and less confusion. It also allows the user to change only one entry if a file's name changes (e.g. version update). I thank forum user oldfred, who showed me this method. For entries not copied directly from the grub.cfg file:
    menuentry "Lucid ISO" {
    set isofile="/boot/iso/ubuntu-10.04-desktop-i386.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
    initrd (loop)/casper/initrd.lz
    }

    #!/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 'ISO Precise ' {
    isofile=ubuntu-12.04-desktop-amd64.iso
    loopback loop (hd0,1)/iso/$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/$isofile noprompt noeject
    initrd (loop)/casper/initrd.lz
    }
    menuentry 'Oneiric ' {
    isofile=ubuntu-11.10-desktop-amd64.iso
    loopback loop (hd0,1)/iso/$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/iso/$isofile noprompt noeject
    initrd (loop)/casper/initrd.lz
    }

    menuentry "Lucid ISO" {
    loopback loop (hd0,1)/boot/iso/ubuntu-10.04-desktop-i386.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-10.04-desktop-i386.iso noprompt noeject
    initrd (loop)/casper/initrd.lz
    }

    menuentry "Karmic 64-bit ISO" {
    loopback loop (hd0,1)/boot/iso/ubuntu-9.10-desktop-amd64.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-9.10-desktop-amd64.iso noprompt quiet splash
    initrd (loop)/casper/initrd.lz
    }

    menuentry "Gparted Live ISO" {
    set isofile="/boot/iso/gparted-live-0.8.0-1.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/live/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia findiso=$isofile toram=filesystem.squashfs
    initrd (loop)/live/initrd.img
    }

    menuentry "SystemRescue CD ISO" {
    set isofile="/boot/iso/systemrescuecd-x86-1.5.8.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/isolinux/rescue64 setkmap=us isoloop=/systemrescuecd-x86-1.5.8.iso
    initrd (loop)/isolinux/initram.igz
    }

    menuentry "Parted Magic ISO" {
    set isofile="/boot/iso/pmagic-5.2.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/pmagic/bzImage iso_filename=$isofile boot=live load_ramdisk=1 prompt_ramdisk=0 noeject noprompt
    initrd (loop)/pmagic/initramfs
    }

    menuentry "Boot IMG - Seagate Tools" {
    linux16 /memdisk bigraw
    initrd16 /SeaTools.img
    }

    Courtesy of cbowman57 in Post #54; with Clonezilla ISO located in sda9's root directory (/)
    menuentry "Clonezilla live" {
    set isofile="(hd0,9)/clonezilla-live-1.2.8-3-amd64.iso"
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_keymap=\"\" ocs_live_batch=\"no\" ocs_lang=\"\" vga=788 ip=frommedia nosplash toram=filesystem.squashfs findiso=$isofile
    initrd (loop)/live/initrd.img
    }

    Modified from the post by Dancer_69
    menuentry "Gentoo 11 Live DVD" {
    set isofile="/boot/iso/gentoo-livedvd-x86-amd64-32ul-11.0.iso"
    loopback loop (hd1,6)$isofile
    linux (loop)/boot/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=/boot/gentoo.igz isoboot=/boot/iso/gentoo-livedvd-x86-amd64-32ul-11.0.iso
    initrd (loop)/boot/gentoo.igz
    }
    • Run "sudo update-grub" after saving /etc/grub.d/40_custom to include the new entries into the Grub 2 menu.


    Persistence:
    See Post #254 by NikTh for information on making an ISO persistent. http://ubuntuforums.org/showpost.php...&postcount=253

    More ISO Menuentries:

    If you need to inspect the contents of an ISO for troubleshooting purposes, you can mount it while running a Linux OS with the following commands. You will make a mount point in /mnt and then mount the ISO to /mnt/temp. After mounting, you can use a file browser to inspect the contents of /mnt/temp.
    • One example of using the mount command to inspect the contents is to check the initrd file. In bootable Ubuntu ISOs (Karmic & later) the file is initrd.lz In some other third-party ISOs, the file may be initrd.gz rather than initrd.lz.



    Code:
    sudo mkdir /mnt/temp
    sudo mount -o loop /boot/iso/<filename.iso> /mnt/temp
    When you are finished:
    sudo umount /mnt/temp

    This thread is an update of a closed Karmic Testing thread which was created during the early testing of Karmic and Grub 2:
    http://ubuntuforums.org/showthread.php?t=1295506


    More ISO Menuentries:

    If you would like to add examples of other ISO menuentries, please start the post with the OS or Utility Name and place the menu entry within "code" tags.
    Last edited by drs305; July 4th, 2012 at 12:17 AM. Reason: Persistence
    Back to Xorg...

    Retired.

  2. #2
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: ISO Booting with Grub 2

    Got me going. Great info, as always, and I am in love with the ability to boot the ISOs.

    Thanks for this post.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  3. #3
    Join Date
    Nov 2009
    Beans
    15

    Re: ISO Booting with Grub 2

    Quick question:

    I notice you said you use a non-system partition for your ISO's, and this makes sense to me.

    I am currently running a multi-boot system with 2 partitions and an extended partition with 2 more partitions, and only have 1 ext4 partition for Ubuntu (I don't even have a swap partition right now).

    I would really like to add GParted to my GRUB, but would it be ok to put the .iso on my Ubuntu system partition, considering I would be using the iso to resize the partition the .iso is in?

    If this would pose a problem, how difficult would it be to create a new partition to store .isos for GRUB, for example what File System would it have to be for GRUB to recognize the disc images?

    Thank you very much for any info you could give me regarding this.
    Last edited by danageis; August 25th, 2010 at 10:14 AM.

  4. #4
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: ISO Booting with Grub 2

    Quote Originally Posted by danageis View Post
    I would really like to add GParted to my GRUB, but would it be ok to put the .iso on my Ubuntu system partition, considering I would be using the iso to resize the partition the .iso is in?

    If this would pose a problem, how difficult would it be to create a new partition to store .isos for GRUB, for example what File System would it have to be for GRUB to recognize the disc images?
    The Gparted CD ISO appears to work without mounting the partition within which it is located. This means the ISO can be located in any partition, even one you wish to resize.

    I've always used ext3 or ext4, but I would assume that any format recognized by Grub2 would be acceptable, since the ISO is going to mount and use it's own file system for booting.
    Back to Xorg...

    Retired.

  5. #5
    Join Date
    Nov 2009
    Beans
    15

    Re: ISO Booting with Grub 2

    cool thank you very much for the quick reply. I followed your tutorial and installed a GPARTED live .iso into GRUB from /boot/iso and used it to shrink my current FAT32 partition and expand my Ubuntu partition to 12GB. thanks!

  6. #6
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: ISO Booting with Grub 2

    Quote Originally Posted by danageis View Post
    cool thank you very much for the quick reply. I followed your tutorial and installed a GPARTED live .iso into GRUB from /boot/iso and used it to shrink my current FAT32 partition and expand my Ubuntu partition to 12GB. thanks!
    Glad it worked. You posed some good questions which I hadn't addressed in the original post. I'm fighting a bad hotel Internet connection today but when I get the chance I'll include a mention of this topic in the original post.
    Back to Xorg...

    Retired.

  7. #7
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: ISO Booting with Grub 2

    I am glad the mounting of partitions was brought up. I thought maybe I was just not seeing it right.

    Hadn't tried it yet but, with great trepidation, was going to. Now I will just have FUN.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  8. #8
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: ISO Booting with Grub 2

    I believe that I have to beg to differ with the idea that the drive is not mounted.

    If you think about it the partition where the ISO is located MUST be mounted. Trying to install from the ISO leads to failure due to mounted drives.

    I do not think that I would partition from an ISO residing on the same drive.

    Seeing that this is the Maverick UNE ISO and there have been problems with the new Ubiquity I am not at all convinced that installing from the ISO is a bad idea. I will be copying the ISO to another drive and try it from there.

    You will get a report.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

  9. #9
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: ISO Booting with Grub 2

    I was referring to the Gparted ISO regarding the mounting of the partition, but perhaps I didn't make that clear. At least Gparted doesn't show the partition as mounted, and I was able to resize the partition on which the ISO physically resided using the Gparted ISO. [Added: Perhaps it's possible for Gparted to umount the partition once it's running - I have no idea really.] I did it on a partition I was willing to trash, as I was uncertain of the results.

    I did try installing via the LiveCD ISO soon after I learned how to mount it via Grub2, and as you experienced, I was unable to complete a normal install via this method. I belive I only tried this with 9.10.
    Last edited by drs305; August 28th, 2010 at 03:46 AM.
    Back to Xorg...

    Retired.

  10. #10
    Join Date
    Aug 2008
    Location
    South East Montana
    Beans
    6,153

    Re: ISO Booting with Grub 2

    I think I can install the bugger if I use a good ISO from a different drive. I do not have one of those new fangled thumb drives. Might be time to see if I can get somewhere they sell them. Seems the perfect place for ISOs and something to boot from.

    I can't see how you can boot an ISO from a drive with out that drive mounted. The partition has to be mounted.

    You can use Gparted from a mounted drive. I just do not think it is something that I want to do. I am really good at screwing things up anyway and do not feel I need any help from gparted or any other partition editor.
    Dell 480 XPS 3G ram Quad Core 2.40GHz, Radeon HD 2400 PRO, Audigy1, 3x320G HDD, 320G External, Debian Testing for use, Debian Squeeze for secure use, Debian Sid for FUN

Page 1 of 29 12311 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •