0

I have created a multiboot bootable USB with GRUB and used it to install Debian 8.1 successfully. A multiboot USB is one that contains the ISO images of multiple operating systems, with GRUB being used to choose which one to boot.

For Debian, it is a key that:

  1. The Debian 8.1 ISO should be the type of hybrid. I downloaded it from
    http://ftp.nl.debian.org/debian-cd/8.1.0-live/amd64/bt-hybrid/

  2. The vmlinuz and initrd.gz files should be hd-median for debian-installer. I downloaded them from http://ftp.nl.debian.org/debian/dists/jessie/main/installer-i386/current/images/hd-media/

The grub.cfg file for installing Debian 8.1 is :

menuentry 'to install Debian 8.1 from usb' {
    insmod part_msdos
    insmod ext2
    set isofile="(hd0)/debian-8.1/debian-8.1-hybrid.iso"
    loopback loop $isofile
    linux (hd0)/debian-8.1/vmlinuz
    initrd (hd0)/debian-8.1/initrd.gz
 }

Now, I want to add CentOS 7 to the same USB drive and be able to boot it from the GRUB menu. There three kinds of CentOS ISO:

  1. DVD ISO
  2. Everything ISO
  3. Minimal ISO

There is no hybrid ISO for CentOS like there is for Debian. Which kind of ISO file and vmlinuz, initrd.gz files should I use to install CentOS from USB? How should I configure GRUB to boot the CentOS 7 ISO?

I have tested:

  1. I downloaded CentOS-7-x86_64-LiveCD-1503.iso
  2. I mounted the ISO and copied vmlinuz0 and initrd0.img from the isolinux directory
  3. I created a grub.cfg entry as follows:

    menuentry 'to install centos7.1 from usb' {
        insmod part_msdos
        insmod ext2
        insmod ntfs
        set isofile="(hd0,0)/centos-7.1/CentOS-7-x86_64-LiveCD-1503.iso"
        loopback loop $isofile
        linux (hd0,0)/centos-7.1/vmlinuz0    
        initrd (hd0,0)/centos-7.1/initrd0.img
    }
    

I received the following error:

The USB HDD I'm using has a directory structure as follows:.

├── boot
│   └── grub
│       ├── fonts
│       │   └── unicode.pf2
│       ├── grub.cfg
│       ├── grubenv
│       ├── i386-pc
│       │   ├── 915resolution.mod
│       │   └── zfs.mod
│       └── locale
│           ├── ast.mo
│           ├── ca.mo
│           ├── da.mo
│           ├── vi.mo
│           ├── zh_CN.mo
│           └── zh_TW.mo
├── centos-7.1
│   ├── CentOS-7-x86_64-LiveCD-1503.iso
│   ├── initrd0.img
│   └── vmlinuz0
├── debian-8.1
│   ├── debian-8.1-hybrid.iso
│   ├── initrd.gz
│   └── vmlinuz

Many sub-directories deleted for simplicity.

1

When you reference where the vmlinuz file is you reference from the ISO's root, so your centos-7.1 directory is wrong.

To boot from an official ISO which has been marked as a live CD you will have to do some hacking.

First to identify what vmlinuz and initrd I would mount the iso image, and find the directory where the vmlinuz and initrd are. THAT is the directory you have to write in your grub.cfg after (hd0,0) (By the way, it should be loop, not (hd0,0)) substituting centos-7.1 I would also check its config scripts to see if some options are needed and add those options.

Anyway, you have a guide here

  • please see the usb-hdd directories structure, my centos-7.1 directory isn't wrong. – it_is_a_literature Jul 22 '15 at 7:48
  • 1
    I wouldn't have that structure, I would just have a folder called ISOs and inside that folder the iso file of the live CDs I want to boot from. You don't need the vmlinuz nor initrd, since they are inside the iso files. Just access them via linux (loop)/live/vmlinuz $options modify live by the right directory in your centos iso and check the options. Also check the link I posted. – YoMismo Jul 22 '15 at 7:51
0

The CentOS wiki has a guide to installing from USB that covers 6.5 and later (including 7.x). Have you tried those steps?

Basically, it involves writing the ISO image to a USB drive and booting from it. So, something like:

dd if=CentOS-7-x86_64-DVD-1503-01.iso of=/dev/sdb

Where /dev/sdb is your flash drive.

That's slightly different from your Debian example, but you don't specify booting the ISO from GRUB is a requirement just "from USB". If that is the case @YoMismo's answer has the information required.

  • My usb-hh is 16G,the dd command will delete everything on my disk,i have tried the dd way,it is rigth ,but i want to save my disk space,so l want to install centos with grub way, to write a right grub.cfg,and put centos iso on the usb-hdd, the other space can be used. – it_is_a_literature Jul 22 '15 at 7:38
  • Ah, it wasn't 100% clear that was what you wanted to do. I've amended your question to make it clearer – mjturner Jul 22 '15 at 8:47
0

In my situation the proper format of grub.cfg should be the following:

menuentry "to install  CentOS-7.0-1406-x86_64-DVD" {
    insmod part_msdos
    insmod ext2
    insmod ntfs
    set isofile='(hd0)/centos-7.1/CentOS-7-x86_64-DVD-1503-01.iso'
    loopback loop $isofile
    linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:/dev/sdb:/centos-7.1/CentOS-7-x86_64-DVD-1503-01.iso
    initrd (loop)/isolinux/initrd.img
}

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.