26

I found that it can be done with loopback as follows

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
}

But it works only with ubuntu or its derivatives. How it should be written if I want to boot other live images like fedora, cent, opensuse etc. ?

Edit: I found some other entries but all of them are probably debian based.

menuentry "Linux Mint 10 Gnome ISO" {
 loopback loop /linuxmint10.iso
 linux (loop)/casper/vmlinuz file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.lz iso-scan/filename=/linuxmint10.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "DBAN ISO" {
 loopback loop /dban.iso
 linux (loop)/DBAN.BZI nuke="dwipe" iso-scan/filename=/dban.iso silent --
}


menuentry "Tinycore ISO" {
 loopback loop /tinycore.iso
 linux (loop)/boot/bzImage --
 initrd (loop)/boot/tinycore.gz
}


menuentry "SystemRescueCd" {
 loopback loop /systemrescuecd.iso
 linux (loop)/isolinux/rescuecd isoloop=/systemrescuecd.iso setkmap=us docache dostartx
 initrd (loop)/isolinux/initram.igz
}

Edit2: How to chainload grub and syslinux from grub2?

Edit3: I want to boot other live images without any removable devices and use grub2 so need menu entries specific to grub2.

9
  • 1
    This is not off topic,still unix and linux stack exchange is better unix.stackexchange.com
    – Tachyons
    May 25, 2012 at 4:42
  • @Rinzwind how??
    – Tachyons
    May 27, 2012 at 11:41
  • 2
    The question is about fedora, centOS and opensuse. Not about Ubuntu. @abcd
    – Rinzwind
    May 27, 2012 at 11:50
  • 2
    By the way: Fedora is not capable of doing this. CentOS is basically Fedora. dracut has a feature request against it and it needs to be patched for this. You can find this patch on bugzilla.redhat.com
    – Rinzwind
    May 27, 2012 at 15:59
  • 2
    Possible duplicate? askubuntu.com/questions/121212/…
    – fossfreedom
    May 31, 2012 at 6:07

8 Answers 8

20
+100

Booting from iso is a feature which must be supported by the distro, and the iso-scan/filename= option will not work in Fedora or others. Those might have other kernel options for this feature or the feature may be not supported at all.

I have found a method to boot Fedora 16 DVD, here's below.

Booting Fedora 15 DVD iso from grub

menuentry "Fedora 15 (DVD)" {
 insmod loopback
 insmod iso9660
 set isofile="/Fedora-15-x86_64-DVD.iso"
 loopback loop (hd0,2)$isofile
 linux (loop)/isolinux/vmlinuz rootfstype=auto  root=live:UUID=:$isofile ro quiet
 initrd (loop)/isolinux/initrd.img
}

It assumes your iso file is at the root of second partition of the internal hard disk.

source: this page

You can search for other distribution in google, since it is not a distro-independent feature.

Note 1: It also worked with Fedora 16, I have just tested it.
Note 2: It seems that the method worked when you place the iso file in a fat or ext4 partition.


Booting grml small iso from grub2

Grml can also be booted from grub2. Note that it uses findiso option instead of iso-scan/filename option, indicating that Booting from iso is implemented as different options in different distributions.

(menuentry "Grml small 2009.10" {
  loopback loop /boot/iso/grml-small_2009.10.iso
  linux (loop)/boot/grmlsmall/linux26 findiso=/boot/iso/grml-small_2009.10.iso apm=power-off lang=us vga=791 boot=live nomce noeject noprompt --
  initrd (loop)/boot/grmlsmall/initrd.gz
}

This page has several examples of other distros booting from Grub2.


Booting openSUSE 13.1 Live from iso

Here is the only solution that worked (all others gave me a Failed to find MBR identifier and stopped). In this example the iso is placed at the first disk’s third partition in the directory /home/username/.

menuentry "openSUSE_13.1_GNOME_Live" {
  load_video
  insmod gzio
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos3)'
  set isofrom_device='/dev/sda3'
  set isofrom_system='/home/username/openSUSE-13.1-GNOME-Live-i686.iso'
  set loader='/boot/i386/loader'
  loopback loop $isofrom_system
  linux   (loop)$loader/linux isofrom_device=$isofrom_device isofrom_system=$isofrom_system ramdisk_size=512000 ramdisk_blocksize=4096 ro quiet splash $vt_handoff preloadlog=/dev/null showopts
  initrd  (loop)$loader/initrd
}

Source is janeppo’s comment.


Fedora 17 Gnome Live Iso

Here is the boot menu grub.cfg entry for Fedora 17. the iso is placed at the first disk's third partition. Also the filename is changed.

menuentry "Fedora Live" {
    loopback loop (hd0,3)/fedora.iso
    linux (loop)/EFI/BOOT/vmlinuz0 root=live:/fedora.iso rootfstype=auto ro liveimg quiet rhgb rd.luks=0 rd.md=0
    initrd (hd0,3)/initrd-fromiso
}

Last Note: I think this answer serve as an example. It should not be elaborated more with examples.

2
4

Here is which iso files I figured out to boot using grub2.

I have successfully booted following ISOs

  • Ubuntu Precise Pangolin 12.04 ISO
  • SystemRescueCd
  • Boot Hardware Detection Tool
  • Free Dos
  • Hiren's boot CD
  • Ultimate Boot CD

I found that if you want to boot other ISOs like Hiren's Boot CD, etc. you can use MEMDISK utility as kernel.

Where to Get MEMDISK ?

Download Syslinux from here. Move it to Desktop.

How to make it work ?

cd ~/Desktop/
tar xvif syslinux-4.05.tar.xz 
cd syslinux-4.05/memdisk/
sudo mkdir /customboot
sudo mv memdisk /customboot/
cd /customboot/
sudo mv memdisk memdisk4.05
gksudo gedit /etc/grub.d/40_custom 

Then paste below entries in gedit. You'll need to change set isofile="/path/to/iso-file.iso".

Then issue update-grub. Reboot and check.

My entries in 40_custom file.

menuentry "Ubuntu Natty Narwhal 11.04 ISO" {
    set isofile="/OS/ubuntu-11.04-desktop-i386.iso"
    loopback loop (hd0,6)$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject --
    initrd (loop)/casper/initrd.lz
}
menuentry "Ubuntu Precise Pangolin 12.04 ISO" {
    set isofile="/OS/ubuntu-12.04-desktop-i386.iso"
    loopback loop (hd0,6)$isofile
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject --
    initrd (loop)/casper/initrd.lz
}
menuentry "SystemRescueCd" {
    set isofile="/OS/systemrescuecd-x86-2.7.0.iso"
    loopback loop (hd0,6)$isofile
    linux (loop)/isolinux/rescuecd isoloop=$isofile setkmap=us docache dostartx
    initrd (loop)/isolinux/initram.igz
}
menuentry "Boot Hardware Detection Tool from iso using memdisk 4.05" {
    linux16 /customboot/memdisk4.05 iso
    initrd16 /customboot/hdt.iso
}
menuentry "Free Dos from iso using memdisk 4.05" {
    set isofile="/OS/fdbasecd.iso"
    linux16 /customboot/memdisk4.05 iso
    initrd16 (hd0,6)$isofile
}
menuentry "Hiren's boot CD using memdisk 4.05" {
    set isofile="/OS/Hiren's.BootCD.10.1.iso"
    linux16 /customboot/memdisk4.05 iso
    initrd16 (hd0,6)$isofile
}
menuentry "Ultimate Boot CD iso using memdisk 4.05" {
    set isofile="/OS/ubcd511.iso"
    linux16 /customboot/memdisk4.05 iso
    initrd16 (hd0,6)$isofile
}

All ISOs are kept on sda6/OS and MEMDISK is kept on partition where ubuntu is installed(in root) and renamed to memdisk4.05 so path to it is /customboot/memdisk4.05

note : fedora didn't work with the other answer given. Still trying to boot fedora :( .

1
  • Note, when loading ISO files with memdisk and grub initrd16, the ISO file must be smaller than 462 MB. Related error messages: grub: error: couldn't find suitable memory target, memdisk: MEMDISK: No ramdisk image specified. For more details see here and here.
    – gregn3
    Nov 29, 2016 at 2:52
2

unfortunatly none of these recommendation did not help me. So I have found the way and would love to share with you. To boot centos for example you need: Put iso image in the directory. if your root dir mounted on /dev/sda1, then create dir /iso and put iso there. go to grub console (when menu grub appear press 'c'.)

Choose appropriate device - hd0 means sda. You need to choose one where you iso is located.

loopback loop (hd0,msdos1)/iso/Redhat.iso 
linux (loop)/isolinux/vmlinuz inst.repo=hd:sda1:/iso/Redhat.iso 
initrd (loop)/isolinux/initrd.img 
boot

And boot it!

1

What you are asking is off topic here, as it requires knowledge of those other systems to be able to set up grub entries to boot them correctly. Yes it is possible.

However... You will find Multi System a competent tool for having very many different distro ISOs on one large USB drive. I find it works very well indeed but you will have to install it from a PPA:

http://www.pendrivelinux.com/multiboot-create-a-multiboot-usb-from-linux/

I use it so that I can have the Gparted LiveUSB and other tools, as well as Ubuntu ones on one pendrive for InstallFests. As a bonus it allows a custom splash screen for the menu, which I have set to the logo for the Australian LoCo team.

Chris

As stated, Multisystem uses Grub2 to do what you want. Since this off-topic thread is being allowed, or at least tolerated here's the Fedora entry from my Multisystem Grub2:

 menuentry "Fedora-15-i686-Live-Desktop.iso" {
 linux /fedora1/isolinux/vmlinuz0 live_locale=en_AU.UTF-8 live_keytable=us live_dir=/fedora1 root=UUID=493A-D2EF rootfstype=auto ro liveimg quiet rhgb rd_NO_LUKS rd_NO_MD noiswmd
 initrd /fedora1/isolinux/initrd0.img
 }

Note that you can't boot directly from the ISO as it's not supported as it is with Debian based distros. You will need the unpacked files from the ISO available on the hard drive as follows:

chris@chris-office:/media/RED8/fedora1$ ls -l
total 563972
drwx------ 2 chris chris      4096 Feb 11  2011 isolinux
-rw-r--r-- 1 chris chris     43503 May 14  2011 livecd-iso-to-disk
-r--r--r-- 1 chris chris      8192 May 14  2011 osmin.img
-r--r--r-- 1 chris chris 577449984 May 14  2011 squashfs.img

You will of course need to change the location of the /fedora/ directory and the UUID of the partition you are booting Fedora off. You should probably also change the mount mode from ro to rw, as well as anything else appropriate, such as the permissions on the squashfs.

You can also probably set up a virtual persistence disk, Although I see no reason why you couldn't mount your normal /home partition. Again, I can only suggest that you install Multidisk and do the config yourself to learn how to do it.

Chris

3
  • the question is How to create entry in existing GRUB2 not how to make bootable pendrive or external hard disk having different distros. BTW it requires better knowledge of GRUB2 than other distros so it is actually question related to GRUB(because some distro still use GRUB) or GRUB2. May 27, 2012 at 12:32
  • 1
    I'd say that making a grub entries for distros such as Fedora, Centos and Suse are much more related to those distros than they are to grub, and certainly nothing whatsovever to do with Ubuntu. May 28, 2012 at 8:39
  • 1
    @virpara : You also did not specify that you are booting ISOs off the hard drive - the most reasonable reason for wanting to boot various LiveISOs is to have a do-everything install device. We are not mind readers, or experts on other distros. Lastly, if you actually install and use MultiSystem to make a pendrive in this way, it will show you how to do it - it uses grub2 to to achieve the results you want. May 28, 2012 at 8:48
1

Seems as though 13.04 requires a different syntax to achieve this. Has anyone successfully booted the ubuntu-13.04-desktop-amd64.iso from a physical disk and would care to share the grub syntax?

EDIT: Answered my own question. Need to rename vmlinuz to mvlinuz.efi and it works.

menuentry "Ubuntu-13.04-desktop-amd64.iso" --class ubuntu {
set isofile="/archives/ubuntu-13.04-desktop-amd64.iso"
loopback loop (hd1,6)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile noeject noprompt --
initrd (loop)/casper/initrd.lz
}
1

I find using the loopback of grub2 invaluable for testing out new isos without requiring a usb stick or burning to CD. There are bugs filed against Fedora to make something similar work. Tracking down the current status is a little bit time consuming.

0

Try using Multisystem, installing the liveCDs you want, and then copying over the files to your / and merging the grub.cfgs! (I'm actually curious to see whether it would work!).

0

The reason of fail is that Fedora's initramfs doesn't detect UUID, label, partUUID and so on of loopback devices. You tell it to boot from LABEL=$label, but there is no such label in /dev/disk/by-label. The same with UUID -- there is no UUID of /dev/loop0 in /dev/disk/by-uuid.

So, the only way I could force Fedora to boot from .iso file is telling kernel that root is live:/dev/loop0.

Seems there is no other way.

menuentry "Fedora MATE Compiz Live X86 64 37 1 7" {
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod <YOUR PART_TABLE>
  insmod <FS TYPE OF YOUR PARTITION WITH ISO>
  search --no-floppy --fs-uuid --set=root <YOUR UUID HERE>
  iso_path="/iso/Fedora-MATE_Compiz-Live-x86_64-37-1.7.iso"
  export iso_path
  search --set=root --file $iso_path
  if [ "$grub_platform" = "efi" ]; then
    # support booting recent GRUB versions on UEFI systems
    rmmod tpm
  fi
  loopback loop "${iso_path}"
  set root=(loop)
  set gfxpayload=keep
  # Nothing to do with `probe --set iso_label --label (loop)`. It's useless.
  linux (loop)/images/pxeboot/vmlinuz root=live:/dev/loop0 rd.live.image verbose iso-scan/filename=${iso_path}
  initrd (loop)/images/pxeboot/initrd.img
}

Here is the way for booting Archlinux from .iso file:

menuentry "Archlinux 2023 01 01 X86 64" {
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod <YOUR PART_TABLE>
  insmod <YOUR FS TYPE>
  search --no-floppy --fs-uuid --set=root <YOUR UUID>
  iso_path="/iso/archlinux-2023.01.01-x86_64.iso"
  export iso_path
  search --set=root --file $iso_path
  kernelopts="   "
  export kernelopts
  if [ "$grub_platform" = "efi" ]; then
    # support booting recent GRUB versions on UEFI systems
    rmmod tpm
  fi
  loopback loop "${iso_path}"
  set root=(loop)
  set gfxpayload=keep
  probe --set isolabel --label (loop)
  set img_dev_path="/dev/disk/by-uuid/<YOUR UUID>"
  linux (loop)/arch/boot/x86_64/vmlinuz-linux archisobasedir=arch archisolabel="${isolabel}" archisodevice=/dev/loop0 img_dev="${img_dev_path}" img_loop="${iso_path}" earlymodules=loop
  initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/amd-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

(Yes, it's right to use 3 initrds.)

The way for Gentoo:

menuentry "Gentoo Install x86_64 Minimal 20230101T164658Z" {
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod <YOUR PART_TABLE>
  insmod <YOUR FS_TYPE>
  search --no-floppy --fs-uuid --set=root <YOUR UUID>
  iso_path="/iso/install-amd64-minimal-20230101T164658Z.iso"
  export iso_path
  search --set=root --file $iso_path
  kernelopts="   "
  export kernelopts
  if [ "$grub_platform" = "efi" ]; then
    # support booting recent GRUB versions on UEFI systems
    rmmod tpm
  fi
  loopback loop "${iso_path}"
  set root=(loop)
  set gfxpayload=keep
  set bootoptions="isoboot=${iso_path} root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot vga=791"
  linux  (loop)/boot/gentoo $bootoptions
  initrd (loop)/boot/gentoo.igz
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .