30

MultiBootISOs is a tool that let you install Grub on a USB flash drive. I really like it because it lets me boot from ISO files and let me put a bunch of ISOs on my USB and choose which one to boot.

The problem is, this is a Windows tool, and I don't know how to do it through the command lines. I would also like to know how to install Grub (2) this way, Grub Legacy seems to be easier...

EDIT: I'm not asking for a tool (and definitely not a Windows tool). I want to know the commands that I have to execute to have the same effects. I'm having Ubuntu in my mind right now, but if there is a general way that I can boot any ISO in the USB then that would be better.

1

3 Answers 3

18

You got me curious how this would be done. The Pendrivelinux site had a tutorial I did this from my Mint 9 install instead of a live cd as the site suggests.

I started with finding the location of my USB drive in a terminal I ran df it returned the location of the device as

/dev/sdg1   /media/LINUXUSB

after that I ran

sudo su

and then to install grub 2

grub-install --no-floppy --force --root-directory=/media/LINUXUSB /dev/sdg1

I had to use --force additionally, the example on the site did not. Then I did

cd /media/LINUXUSB/boot/grub

The site gave a link to download a copy of grub.cfg to the /boot/grub directory on my USB drive. The link was

wget http://pendrivelinux.com/downloads/grub.cfg

After that I edited grub.cfg to reflect the iso's on my USB drive.

set timeout=10 set default=0

menuentry "Run Fedora" {
    loopback loop /Fedora13.iso
    linux (loop)/isolinux/vmlinuz0 boot=isolinux iso-scan/filename=/Fedora13.iso splash --
    initrd (loop)/isolinux/initrd0.img
}

menuentry "Run Ubuntu" {
    loopback loop /ubuntu-10.04-netbook-i386.iso 
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.04-netbook-i386.iso splash --
    initrd (loop)/casper/initrd.lz
}

menuentry "Run Clonezilla" {
    loopback loop /clonezilla.iso
    linux (loop)/live/vmlinuz boot=live iso-scan/filename=/clonezilla.iso splash --
    initrd (loop)/live/initrd.img }

I found that in the different iso's, vmlinuz and initrd were located in a different directory. I was able to get all three to start the boot process; but, only Ubuntu to actually load. If I figure out what I need to get the other two to finish loading, I will add that later. I have not tried any other iso's just these three.

4
  • @phunehehe glad it helped. This site panticz.de/MultiBootUSB has grub.cfg with quite a few entries, it has some good examples. Aug 23, 2010 at 14:05
  • I have added hiren entry ( that use grub.exe ) to chainload
    – Francesco
    Mar 21, 2015 at 5:26
  • Can you help me at unix.stackexchange.com/q/249049/66803 ?
    – Pandya
    Dec 17, 2015 at 5:00
  • How can I install BIOS GRUB to my USB drive when I have a UEFI laptop. It installs UEFI GRUB instead
    – Suici Doga
    May 18, 2016 at 14:33
5

GRUB2 Bootloader Full tutorial is a good place to start on multi boot configurations with GRUB2.
If you are familiar with GRUB, jump straight to the 5th or 6th section.

There is also a Superuser question on Setting up a multiboot system with GRUB.
There is also a Ubuntu MultiOSBoot community page which suggests you should stick to the Legacy GRUB.

The technique works on flash drives too as long as your machine can boot from them.
I have been working off flash drives for some time now.

-1

i spent hours in the internet trying to find how to generate a working grub.cfg for a removable disk.

finally based on the script from here, i made my working script (the below is contents of grub.cfg):

### inputs ###
set UUID_ESP="E8C0-B8AE"
set UUID_ISO="c11f533e-a298-4381-950a-5d6d1f7f5907"
### end ###


search --no-floppy --set=ESP --fs-uuid $UUID_ESP # the address of the ESP
set ESP=($ESP) # add parentheses
echo "The address of the ESP is $ESP"
search --no-floppy --set=ISO_PART --fs-uuid $UUID_ISO # the address of the ISO partition
set ISO_PART=($ISO_PART) # add parentheses
echo "The partition on the flash drive with the iso is $ISO_PART"
echo "the prefix is $prefix" # GRUB folder with modules
sleep 5

insmod efi_gop
insmod font

if loadfont $ESP/boot/grub/fonts/unicode.pf2
then
        insmod gfxterm
        set gfxmode=auto
        set gfxpayload=keep
        terminal_output gfxterm
fi

menuentry "arch_linux_iso" {
        set ISOFILE="/archlinux-2019.10.01-x86_64.iso"
        loopback loop ${ISO_PART}${ISOFILE}
        linux (loop)/arch/boot/x86_64/vmlinuz img_dev=/dev/disk/by-uuid/$UUID_ISO img_loop=$ISOFILE
        initrd (loop)/arch/boot/intel_ucode.img (loop)/arch/boot/amd_ucode.img (loop)/arch/boot/x86_64/archiso.img
}

You must log in to answer this question.

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