From Sabayon Wiki
Revision as of 15:57, 23 October 2011 by Spekulatius (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article is work in progress! The procedure described here may destroy your system. If you're an expert feel free to contribute!

At the time of writing Sabayon cannot boot EFI Systems from USB sticks.

E.g. the EeePC Asus 1215b does only boot from (U)EFI capable usb sticks.

In the older days the bios booted an usb stick if it complied to the El Torito Bootable CD Specification. Newer systems, like the iBook or some EeeePcs, implement a different specification.

Here are a few links to get you started what (U)EFI is all about:



The current Sabayon ISO install images are made bootable with the syslinux project. Since there is no efi compatibility in syslinux the following howto uses grub2 to create a bootable image.

grub2 bootimages

The following procedure was tested on an x86 64bit system. The directory names are different on 32bit systems!

Given that the existing grub2 packages are not capable of creating efi images, we have to build one ourselves. (TODO: Create gentoo ebuilds and entropy packages...)

First we need to download a grub2 version with efi support: grub-1.99.tar.gz

Unpack the sources somewhere and invoke the following commands to build a local grub2 installation:

# cd grub-1.99
# ./autogen.sh
# export EFI_ARCH=x86_64
# ./configure --prefix=/home/someuser/local/grub2 --with-platform=efi --target=${EFI_ARCH} --program-prefix=""
# make
# make install

create an grub2 efi boot image

For some reasons the local grub2 installation does only work if you're inside the following directory:


The grub-mkimage command creates the desired grub2 boot image:

# ../../../bin/grub-mkimage -Ox86_64-efi  -d . -o BOOTX64.EFI -p "" part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot configfile linux multiboot

Next we need to create a font in pf2 format. Most documents use the unifont.pf2. If you don't have this file on your system you can use the grub-mkfont utility to create such a font. Download the PCF version of unifont from http://unifoundry.com/unifont.html, e.g. unifont-5.1.20080820.pcf.gz. Then use grub-mkfont to convert it:

# wget http://unifoundry.com/unifont-5.1.20080820.pcf.gz
# gunzip unifont-5.1.20080820.pcf.gz
# grub2/bin/grub-mkfont -o unifont.pf2 unifont-5.1.20080820.pcf

preparing the USB stick

The USB has to be formatted with a GUID Partition Table (GPT). Furthermore you must create a partition with the "boot" flag on. The program gparted is great to create such a partition scheme, but you may not have Xorg installed, so here are the steps for the console variant parted:

Let's assume the usb stick is registered under /dev/sdc:

# parted /dev/sdc
GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdc will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) mkpart 1 fat32 0 100%                                            
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore
(parted) toggle                                                           
Partition number? 1                                                       
Flag to Invert? boot                                                      
(parted) print                                                            
Model: Kingston DT 100 G2 (scsi)
Disk /dev/sdc: 4012MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  4012MB  4012MB  fat32        1     boot
(parted) quit

Now create a fat32 filesytem on the new usb partition:

# mkfs.vfat -F 32 /dev/sdc1
mkfs.vfat 3.0.9 (31 Jan 2010)

Mount the new system, e.g. under /mnt/usb:

# mount /dev/sdc1 /mnt/usb

installing the grub2 efi image

First create the directory from where an efi system will search for bootable images. The filesystem must be supported by the boot system, so we choose fat32 (nerds forgive us), because it is almost always supported:

# mkdir -p /mnt/usb/efi/BOOT

In the first step we created a grub2 efi image named BOOTX64.EFI under:


Out of this directory we copy the efi image along with all needed grub2 modules to efi/BOOT:

# cp BOOTX64.EFI *.mod *.lst /mnt/usb/efi/BOOT
# cp unifont.pf2 /mnt/usb/efi/BOOT

Next we need to gather the kernel sources from a Sabayon ISO image and write a grub configuration file. Go to sabayon.org and download the file:


Mount this image, e.g. under /mnt/cdrom and copy all necessary file to the usb stick still mounted under /mnt/usb:

# mount -o loop -t iso9660 Sabayon_Linux_7_amd64_G.iso /mnt/cdrom
# cp /mnt/cdrom/boot/sabayon /mnt/usb/
# cp /mnt/cdrom/boot/sabayon.igz /mnt/usb/
# cp /mnt/cdrom/livecd.squashfs /mnt/usb/

Inside the /mnt/usb/efi/BOOT directory create a grub configuration file to boot the sabayon kernel:

# cat > grub.cfg << EOF

insmod efi_gop
insmod efi_uga
insmod font

if loadfont efi/BOOT/unifont.pf2
    insmod gfxterm
    set gfxmode=auto
    set gfxpayload=keep
    terminal_output gfxterm

menuentry "Sabayon" {
  linux /sabayon root=/dev/ram0 initrd=/sabayon.igz aufs init=/linuxrc cdroot cdroot_type=udf looptype=squashfs loop=/livecd.squashfs splash=silent,theme:sabayon  vga=791 console=tty1 quiet installer-gui --
  initrd /sabayon.igz

The kernel parameters for the grub menuentry are taken from the syslinux configuration file (isolinux/text.cfg) which you can find inside the Sabayon_Linux_7_amd64_G ISO image.

NOW you can unmount the usb stick and boot from it.

What's next?? Figure out, why the systems shows the grub2 menu, boots the kernel, begins preparing the installation, but stops after a while with the following error message:

>> Determining root device...
!! Could not find the root block device in .
   Please specifiy another value or: press Enter for the same, type "shell" for a shell, or "q" to skip...
root block device() ::

And that's it ;-) Please HELP!!!