Debian Wheezy EFI Stub

Introduction
EFI Stub is supported in Debian Wheezy. if you not familiar with EFI Stub read this link for further information.

Basically it allows you to boot Debian on UEFI systems without a 3rd party boot loader like Grub.

EFI System Partition Configuration
If you are using Grub EFI then chances are the path /boot/efi/EFI/debian/ already exists. If not then create it. This also assumes that the EFI System Partition (ESP) is mounted on /boot/efi/ so adjust for your setup where necessary.

mkdir /boot/efi/EFI/debian

Next copy the kernel image and initrd to

cp -u /vmlinuz /initrd.img /boot/efi/EFI/debian/

We can automate this copying after kernel's are updated, removed or installed as follows:

Create a shell script in with the following code:

VMLINUZ=false INITRD=false if [ -L /vmlinuz ] ; then VMLINUZ=/vmlinuz elif [ -L /vmlinuz.old ] ; then VMLINUZ=/vmlinuz.old fi if [ -L /initrd.img ] ; then INITRD=/initrd.img elif [ -L /initrd.img.old ] ; then INITRD=/initrd.img.old fi if [ "${VMLINUZ}" == "false" ] ; then echo "Symlink for vmlinuz not found" exit 1 fi if [ "${INITRD}" == "false" ] ; then echo "Symlink for initrd not found" exit 1 fi CPEXIT=0 cp ${VMLINUZ} /boot/efi/EFI/debian/vmlinuz || { echo "Failed to copy ${VMLINUZ} to ESP" ; CPEXIT=1 ; } cp ${INITRD} /boot/efi/EFI/debian/initrd.img || { echo "Failed to copy ${INITRD} to ESP" ; CPEXIT=1 ; } exit $CPEXIT
 * 1) !/bin/bash

Make the script executable and link it so initramfs-tools runs it as well.

chmod +x /etc/kernel/postinst.d/zz-update-efistub mkdir -p /etc/initramfs/post-update.d sudo ln -s /etc/kernel/postinst.d/zz-update-efistub /etc/initramfs/post-update.d/zz-update-efistub

UEFI Boot Manager
If you are using Grub EFI then efibootmgr should be installed but if it's not then install it.

apt-get install efibootmgr

Add an EFI boot entry for EFI Stub as follows:

efibootmgr -c -p 2 -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u root=/dev/mapper/vgtWyRt3-root ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img


 * -c = Create a new EFI boot manager entry.
 * -p = specifies the ESP. In my case it is /dev/sda2 because that's how it came with Windows 8 preinstalled.
 * -g = Force disk with invalid PMBR to be treated as GPT.
 * -L = The name of the boot entry.
 * -l = Specify the kernel image.
 * -u = Arguments to pass to the kernel image such as the initrd, root device etc.

Once complete try restarting your computer and boot from the Debian (EFI stub) boot entry (adjust your BIOS accordingly, pressing F12 may also work to load the BIOS boot menu). Usually efibootmgr will have set this automatically though.

Remove Boot Loaders
This is purely optional but if your system boots ok and you happy to use EFI Stub and the possibility of having to fix an unbootable system then remove your previous boot loader.

rEFind
If you multiboot then using rEFInd may be useful. It's not in the Debian Wheezy repository and I do not recommend installing packages outside of the repo.

you can download a Debian package and install it using dpkg.

I added an entry to as follows:

menuentry Debian { icon EFI/refind/icons/os_debian.icns loader /EFI/debian/vmlinuz initrd /EFI/debian/initrd.img options "ro quiet root=/dev/mapper/vgtWyRt3-root" }

You may also decide to comment out scan_all_linux_kernels