LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 06-12-2014, 03:48 PM   #1
donatom
Member
 
Registered: Feb 2012
Location: Southern California
Distribution: Archlinux, Debian, Fedora
Posts: 44
Blog Entries: 4

Rep: Reputation: Disabled
Booting Fedora 20 and Parted Magic isos on a usb drive under EFI


I have been trying to manually create a usb flash drive that can boot several live Linux iso's using the UEFI booting method (I do not want to use any of the apps like MultiBoot that supposedly can do this). There is a simple explanation for getting one iso to boot on the following web-page: http://askubuntu.com/questions/39587...sb-live-media/

Try as I might, I could not get more than one iso to boot, but finally I was able to figure out how to boot two, Fedora 20 and Parted Magic. If you care to follow these instructions, heed the following warning: Whenever you use tools like gparted, parted or gdisk, you run the risk of destroying data on any connected drive, including your system hard drive – so be very careful, and be forewarned.

Here is how I got my Linux iso's to boot on a HP Pavilion i3 core laptop:

First delete all data on you drive, using gparted, etc. Then create a GUID partition table (gpt) on your cleaned drive:
# gdisk /dev/sdx (“x” refers to your usb flash drive – sdb, sdc, etc).

Then type “?” and press the “enter” key to get a print-out of all the gdisk commands and their uses. Next type the letter “o” and press “enter” to create a gpt partitition table. Now type "n" to add (create) a partition after which you will hit the "enter" key three times (choosing the defaults) to make the first (and only) partition which will use the entire drive. Next type “t” and press “enter”, after which you will type “0700” (all numbers) and then press the enter-key. This will give you a microsoft-like partition. Finally you will type “w” and press “enter” which will write all of the above-mentioned changes.

Exit gdisk by typing “q” and pressing the enter-key. Now you will need to label your drive, especially if you want to boot Fedora, or another OS based on RedHat. To do this use gparted, navigate to your usb drive and click on the partition. Then right-click and select “Label” and enter whatever name you please. Then save the changes (actually only one change) by clicking on the check mark above. Disregard the warning about destroying any data (provided you are working on the correct drive!).

Now you will need to turn the partition into a FAT32 file system partition. To do this enter the following command in terminal:
# mkfs.vfat /dev/sdx1

After this make the drive bootable by using the following command (this might not be necessary):
# parted /dev/sdx set 1 boot on

The number 1 in the command listed above refers to the first partition. If you want to make a different partition bootable, then change the number to correspond to the proper partition.

Next you may have to mount your usb drive – if your Linux box doesn't recognize it. Use the following command:
# mount /dev/sdx1 /mnt (if /mnt doesn't exist, then create it like so: mkdir /mnt

Now copy the contents of Parted Magic (only certain distributions currently boot under EFI: Fedora and other Red Hat based OS's, Ubuntu, Parted Magic, and perhaps Debian and other Debian-based distributions are able to boot under UEFI, and only if they are 64 bit systems; in the near future many more Linux isos will be able so). To do this run the following command:
$ 7z x /path/to/PartedMagic.iso -o/path/to/drive

You can also choose to use Archive Manager or mount the iso as follows:
# mount -o loop pmagic.iso /mnt

Then copy the contents of the iso using this alternate (loop) method as follows:
$ cp -r /mnt /path/to/drive

Now you have a bootable drive that will boot Parted Magic using EFI. To get Fedora to boot, you copy all the contents of the Fedora iso except the EFI directory onto the root of the usb drive (using loop mount or Archive Manager). Next you create a directory called Fedora20 inside of the EFI directory that was created when you placed all of the contents of the Parted Magic iso on the root of the drive. You then copy the “boot” directory which is inside of the EFI directory of the Fedora iso into the Fedora20 directory which you just created. The only thing left to do is to change the Fedora grub.cfg file so that instead of pointing to the original iso file, everything is pointing to the name of your usb drive. Here is a copy of my amended grub.cfg file:
Code:
set default="1" 

function load_video { 
  insmod efi_gop 
  insmod efi_uga 
  insmod video_bochs 
  insmod video_cirrus 
  insmod all_video 
} 

load_video 
set gfxpayload=keep 
insmod gzio 
insmod part_gpt 
insmod ext2 

set timeout=10 
### END /etc/grub.d/00_header ### 

search --no-floppy --set=root -l 'EFI_DRIVE' 

### BEGIN /etc/grub.d/10_linux ### 
menuentry 'Start Fedora Live' --class fedora --class gnu-linux --class gnu --class os { 
	linuxefi /isolinux/vmlinuz0 root=live:LABEL=EFI_DRIVE ro rd.live.image quiet  rhgb 
	initrdefi /isolinux/initrd0.img 
} 
menuentry 'Test this media & start Fedora Live' --class fedora --class gnu-linux --class gnu --class os { 
	linuxefi /isolinux/vmlinuz0 root=live:LABEL=EFI_DRIVE ro rd.live.image quiet  rhgb rd.live.check 
	initrdefi /isolinux/initrd0.img 
} 

submenu 'Troubleshooting -->' { 
menuentry 'Start Fedora Live in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { 
	linuxefi /isolinux/vmlinuz0 root=live:LABEL=EFI_DRIVE ro rd.live.image quiet  rhgb nomodeset 
	initrdefi /isolinux/initrd0.img 
} 
}
Note that the only thing I changed was the name of the Fedora iso to “EFI_DRIVE”, the label of my usb drive. I had to make changes in several (actually 4) places, however.

At first I tried to place the “boot” directory (the subdirectory of EFI) of Parted Magic in the EFI directory just as I did with the Fedora “boot” directory, but that did not work. If you chose to use Ubuntu instead of Parted Magic, doing it this way would probably work (i.e., EFI/ubuntu/boot and EFI/Fedora20/boot)

The following are the contents of my EFI directory on the usb drive:

EFI/boot/ (which boots pmagic) The “boot” directory contains: bootx64.efi grub.cfg grub.cfg~ pmagic.png unicode.pf2

EFI/Fedora20/BOOT/ (which boots Fedora) The “BOOT” directory contains: BOOTX64.efi fonts grub.cfg grubx64.efi

In theory you could add Ubuntu, Mint, and other EFI bootable isos the same way I added Fedora. You can probably create directories on the root of the drive and fill each one with the contents of an iso, so that the root of the drive is less cluttered (i.e., /Fedora, /Ubuntu, /MintLinux, /Arch).

When I boot up my usb drive on my HP laptop I press esc, then F9 and choose “Boot From EFI File”. Then I navigate to the EFI directory, then choose either Fedora20 or “boot” (for Parted Magic) and then select “BOOT” or “boot” and then select BOOTX64.efi/bootx64.efi to start Fedora or Parted Magic.

Let me know how this works for you and whether you are able to boot other isos on the same usb drive.
If anyone knows or can figure out how to set up a usb drive to boot from an mbr AND an EFI system, please let me know.

In any case, I can now use Linux tools contained in a bootable usb drive to repair a UEFI system.

Last edited by donatom; 06-16-2014 at 02:13 PM.
 
Old 06-13-2014, 01:52 PM   #2
Steve6375
LQ Newbie
 
Registered: Mar 2013
Posts: 15

Rep: Reputation: Disabled
Won't there be a clash if some ISOs use the same files and folders?
If you copy the ISOs to a different folder, you will have to specify the folder in the cheat codes and not all distros support that.
Have you tried Easy2Boot? It can boot multiple UEFI images and MBR boot all from the same USB drive. To prepare the UEFI partition images (drag-and-drop) you will need a Windows system however.
 
Old 06-13-2014, 07:31 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,010

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Steve6375, not sure what the iso question is. The menu is a selection of choices and only one will be used.

Wonder what inserting modules does on kms kernels. I guess I'll have to look that up.
 
1 members found this post helpful.
Old 06-14-2014, 01:30 AM   #4
donatom
Member
 
Registered: Feb 2012
Location: Southern California
Distribution: Archlinux, Debian, Fedora
Posts: 44

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by Steve6375
Won't there be a clash if some ISOs use the same files and folders?
I believe that the only really vital information for an EFI boot comes from the iso's EFI directory and the OS directory, so there shouldn't be a clash. In any case, I copied the contents of both isos (Fedora, pmagic) onto the root of the drive and there is, in fact, no clash.

Quote:
Originally Posted by Steve6375
If you copy the ISOs to a different folder, you will have to specify the folder in the cheat codes and not all distros support that.
I copied the contents of the Fedora iso to /Fedora20 which I created on the root of the drive without any other changes, and EFI had no trouble finding it and it booted right up. I image most other EFI-bootable live Linux isos will be able to be booted in a similar way.

Quote:
Originally Posted by Steve6375
Have you tried Easy2Boot?
Easy2Boot sounds interesting, but I would like to set up the drive manually in Linux. Thanks.
 
Old 06-14-2014, 03:30 AM   #5
Steve6375
LQ Newbie
 
Registered: Mar 2013
Posts: 15

Rep: Reputation: Disabled
What I mean is that the first stage linux boot should work with your method, but the 2nd stage where it loads the squashfs filesystem may be a problem.

In the case of Fedora, the 2nd stage file is located in the \LiveOS folder
In the case of pmagic it is in the \pmagic\pmodules folder

So this will work as there is no clash. However, if two linux distros use the same folder and filename for the squashfs 2nd stage, then your method won't work. For instance, two versions of Fedora or two closely related linux distros will both use the same file.
 
1 members found this post helpful.
Old 06-16-2014, 10:37 AM   #6
donatom
Member
 
Registered: Feb 2012
Location: Southern California
Distribution: Archlinux, Debian, Fedora
Posts: 44

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
Steve6375,

You are perfectly right about clashes (which would result in over-writes of files/directories). I thought I could get around this by creating a directory for the contents of each OS. I tried that last night and it (Fedora) will not boot this way. The contents of the OS must be copied to the root. As you say, this shouldn't be a problem unless the file names of the contents of two isos are the same.

Thanks for your pointing out erroneous information.
 
Old 06-16-2014, 10:43 AM   #7
Steve6375
LQ Newbie
 
Registered: Mar 2013
Posts: 15

Rep: Reputation: Disabled
Some multiboot solutions like Xboot or Yumi use cheatcodes for some distros, to specify the folder where the squashfs file is located, however not all distros support these special cheat codes.
Easy2Boot can boot directly from the ISO files.
 
Old 06-16-2014, 04:00 PM   #8
donatom
Member
 
Registered: Feb 2012
Location: Southern California
Distribution: Archlinux, Debian, Fedora
Posts: 44

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
I figured out a way to boot Fedora20 without copying contents of the iso to the root of the drive. I copied everything except the EFI directory into a directory named "Fedora". I also included the iso itself, but I doubt that that is necessary. I then modified the grub.conf file in the EFI/Fedora20/BOOT directory. I changed "linuxefi /isolinux/vmlinuz0" to "linuxefi /Fedora/isolinux/vmlinuz" (placing Fedora at the beginning of the path indicates where the isolinux folder has been placed) and I changed "initrdefi /isolinux/initrd0.img" to "initrdefi /Fedora/isolinux/initrd0.img". I did this for each of the "menuentries".

I booted Fedora up but I got an error saying that "live.rw" couldn't be found, so I compared menuentries I have for mbr systems for Fedora and noticed there was an entry for "live_dir" so I added the following to the menuentries for Fedora on the "linuxefi" line (in the grub.conf): . . . live_dir=/Fedora/LiveOS . . . and Fedora 20 booted right up.

Now there will be no clashes with folders/files of the various OS's.

The following is how the modified grub.conf for Fedora looks:

Code:
set default="1"

function load_video {
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
  insmod all_video
}

load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat32

set timeout=10
### END /etc/grub.d/00_header ###

search --no-floppy --set=root -l 'EFI_DRIVE'

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Start Fedora Live' --class fedora --class gnu-linux --class gnu --class os {
	linuxefi /Fedora/isolinux/vmlinuz0 root=live:LABEL=EFI_DRIVE live_dir=/Fedora/LiveOS ro rd.live.image quiet  rhgb 
	initrdefi /Fedora/isolinux/initrd0.img
}
menuentry 'Test this media & start Fedora Live' --class fedora --class gnu-linux --class gnu --class os {
	linuxefi /Fedora/isolinux/vmlinuz0 root=live:LABEL=EFI_DRIVE live_dir=/Fedora/LiveOS ro rd.live.image quiet  rhgb rd.live.check
	initrdefi /Fedora/isolinux/initrd0.img
}

submenu 'Troubleshooting -->' {
menuentry 'Start Fedora Live in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os {
	linuxefi /Fedora/isolinux/vmlinuz0 root=live:LABEL=Fedora-Live-Desktop-x86_64-20-1 live_dir=/Fedora/LiveOS ro rd.live.image quiet  rhgb nomodeset
	initrdefi /Fedora/isolinux/initrd0.img
}
}

Last edited by donatom; 06-16-2014 at 04:03 PM.
 
Old 06-16-2014, 05:43 PM   #9
Steve6375
LQ Newbie
 
Registered: Mar 2013
Posts: 15

Rep: Reputation: Disabled
Exactly! But unfortunately, the cheat code is different for different distros and some distros don't support a similar cheatcode

If you download YUMI and then look at the InstallDistro.nsh file, you will see what cheat codes it uses for each distro

e.g.
live-media-path=
BOOT_IMAGE=
psubdir=
knoppix_dir=
loop=
image_dir=
archisobasedir=

etc. etc. etc.
 
Old 06-23-2014, 09:33 PM   #10
donatom
Member
 
Registered: Feb 2012
Location: Southern California
Distribution: Archlinux, Debian, Fedora
Posts: 44

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
I found another web-site that explains how to boot isos under uefi -- and the isos themselves do not have to be built for uefi booting.

Here is the web-site: https://www.nixaid.com/creating-uefi...distributions/

I tried four isos and got three to boot (and I think the fourth needs to have its contents copied to the root of the usb drive (parted magic had to be dealt with this way to get it to boot). Except for SystemRescueCD, I could not get the actual iso to boot, but creating a directory and then emptying the contents of the iso did work. The menuentries look just like menuentries for bios-booting isos (using grub). I did get errors when I followed the instructions for installing grub; grub-install didn't recognize the option "--no-uefi-secure-boot" as well as another option which I can't recall; when I removed these two options, grub-install worked fine (and, more importantly, the "isos" booted right up -- after following all the instructions).

Finding the exact menuentry for each iso is trivial: you just open the iso, find syslinux.cfg or isolinux.cfg and add everything that follows "append" to the "linux" line of the menu.

Nixaid's method makes it possible to boot many, many linux, etc isos.

Here is a copy of my grub.cfg which is a bit different from Nixaid's -- since for the most part I was booting the contents of the iso, not the iso itself:
Code:
 set timeout=15
set default=0

# (U)EFI Graphic Protocol
insmod efi_gop
insmod efi_uga
insmod font

if loadfont ${prefix}/unicode.pf2
then
    insmod gfxterm
    set gfxmode=auto
    set gfxpayload=keep
    terminal_output gfxterm
fi

insmod tga 
background_image /grub/LinuxGreen.tga 

#######################################################


search --no-floppy --set=root -l 'EFI_DRIVE'

menuentry "Parted Magic 2013_5_1" {
	gfxpayload=1024x768
	
	linux /pmagic/bzImage64 initrd=/pmagic/initrd.img boot=live edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal loglevel=9 max_loop=256 vmalloc=384MiB
	initrd /pmagic/initrd.img
}

menuentry "Fedora 20"  {
		
	linux /isos/Fedora20/isolinux/vmlinuz0 initrd=initrd0.img root=live:LABEL=EFI_DRIVE rd.live.dir=/isos/Fedora20/LiveOS rootfstype=auto  live-config.timezone=America/Los_Angeles ro rd.live.image quiet rhgb rd.luks=0 rd.md=0 rd.dm=0 
 initrd /isos/Fedora20/isolinux/initrd0.img 
}

menuentry "SystemRescue CD 4.2 32 bit" {
	loopback loop /isos/systemrescuecd-4.2.0.iso
        linux (loop)/isolinux/rescue64 rescue64 scandelay=1 -- rescue32 scandelay=1 setkmap=us isoloop=/isos/systemrescuecd-4.2.0.iso
        initrd (loop)/isolinux/initram.igz
}

menuentry "AVG Rescue CD" { 
  loopback loop /isos/avg_antivirus.iso 
  linux (loop)/isolinux/vmlinuz max_loop=255 vga=791 init=linuxrc iso-scan/filename=/isos/avg_antivirus.iso 
  initrd (loop)/isolinux/initrd.lzm 
}

Last edited by donatom; 06-24-2014 at 04:42 PM. Reason: adding information, correcting a path for splash image
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird problem with booting fedora from USB drive moofang Linux - Hardware 0 10-26-2008 10:19 PM
Install Parted Magic to USB. citra.cool2 Linux - Newbie 1 04-25-2008 03:50 AM
installing fedora 6 on extrnal usb drive and dual booting with vista _kg Linux - Newbie 3 11-26-2007 08:02 AM
LXer: ReviewLinux.Com: Parted Magic 1.8 USB CD Utility Tool LXer Syndicated Linux News 0 07-27-2007 03:01 AM
Booting Fedora Core 3 from USB Drive tniemeie Fedora 7 04-01-2005 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 10:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration