This page contains info about various [[UEFI]] Bootloaders capable of booting Linux kernel. It is recommended to read the [[UEFI]] and [[GPT]] pages before reading this page. The following [[Boot Loader|bootloaders]] (listed in decreasing order of stability) are explained here:

+

This page contains info about various [[UEFI]] Bootloaders capable of booting Linux kernel. It is recommended to read the [[UEFI]] and [[GPT]] pages before reading this page. The following [[Boot Loader|bootloaders]] are explained here:

# Mount the UEFI System Partition at {{ic|/boot/efi}} with {{ic|# mount <UEFI Partition> /boot/efi}} if you're going to be using GRUB2, or at {{ic|/boot}} with {{ic|# mount <UEFI Partition> /boot}} if you're going to be using Gummiboot or rEFInd. Gummiboot cannot boot across partitions, and will never have such capability due to its nature, so it's paramount that you mount the UEFI System Partition at /boot for use with Gummiboot so that the kernel and initramfs lie on the same partition as the bootmanager.

{{Note| As of [https://www.archlinux.org/packages/extra/any/refind-efi/ refind-efi 0.6.5], refind now automatically detects kernels in {{ic|/boot}}. They do not have to be renamed to have a {{ic|.efi}} extension either, as long as you are using [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Using_rEFInd refind].}}

−

{{Warning|The EFISTUB Kernel must be updated each time the kernel is updated (follow step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB]. Failure to do so will result in failure to boot. Alternatively one can automatically update the EFISTUB kernel using one of the following methods:}}

−

{{Note| As of [https://www.archlinux.org/packages/extra/any/refind-efi/ refind-efi 0.6.5], refind now automatically detects kernels in {{ic|/boot}}. They do not have to be renamed to have a {{ic|.efi}} extension either. Hence, the following sync scripts aren't needed if using [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Using_rEFInd refind].}}

+

=== Booting EFISTUB ===

−

−

==== Systemd ====

−

[[Systemd]] features event triggered tasks. In this particular case, the ability to detect a change in path is used to sync the EFISTUB kernel and initramfs files when they are updated in {{ic|boot}}.

−

−

{{Tip|Save the following script as {{ic|/usr/lib/systemd/system/efistub-update.path}}}}

−

{{bc|<nowiki>

−

[Unit]

−

Description=Copy EFISTUB Kernel to UEFISYS Partition

−

−

[Path]

−

PathChanged=/boot/vmlinuz-linux

−

PathChanged=/boot/initramfs-linux.img

−

PathChanged=/boot/initramfs-linux-fallback.img

−

−

[Install]

−

WantedBy=multi-user.target

−

</nowiki>}}

−

−

{{Tip|Save the following script as {{ic|/usr/lib/systemd/system/efistub-update.service}}}}

{{Tip|Save the following script as {{ic|/etc/incron.d/efistub-update.conf}}}}

−

{{Note|The first parameter {{ic|/boot/initramfs-linux-fallback.img}} is the file to watch. The second parameter {{ic|IN_CLOSE_WRITE}} is the action to watch for. The third parameter {{ic|/usr/local/bin/efistub-update.sh}} is the script to execute.}}

{{Tip|In order to use this method, incron must be activated, if it is not run

−

{{bc|<nowiki>

−

# systemctl enable incrond.service

−

</nowiki>}}}}

−

−

==== Mkinitcpio hook ====

−

Mkinitcpio can generate a hook that does not need a system level daemon to function. It spawns a background process which waits for the generation of {{ic|vm-linuz}}, {{ic|initramfs-linux.img}}, and {{ic|initramfs-linux-fallback.img}}; then follows step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB]

−

−

{{Tip|Save the following script as {{ic|/usr/lib/initcpio/install/efistub-update}}}}

−

{{bc|<nowiki>

−

#!/bin/sh

−

−

build() {

−

/root/watch.sh &

−

}

−

−

help() {

−

cat <<HELPEOF

−

This hook waits for mkinitcpio to finish and copies the finished ramdisk and kernel to the ESP

−

HELPEOF

−

}

−

</nowiki>}}

−

−

{{Tip|Save the following script as {{ic|/root/watch.sh}} and make it executable}}

{{Tip|Add {{ic|efistub-update}} to the list of hooks in {{ic|/etc/mkinitcpio.conf}}}}

+

{{Warning|Linux Kernel EFISTUB booting uses {{ic|\}} instead of {{ic|/}} and should be relative to the UEFI System Partition's root. For example, if the initramfs is located in {{ic|/boot/efi/EFI/arch/initramfs-linux.img}}, the corresponding UEFI formatted line would be {{ic|\EFI\arch\initramfs-linux.img}}. Failure to convert the options will lead to a system hang without any error message from the firmware or kernel.

+

{{Note| Support of initrd path name with {{ic|/}} in EFISTUB booting has been added in [https://patchwork.kernel.org/patch/1899361/ mainline 3.9-rc1] and [http://lwn.net/Articles/541002/ stable 3.8.2]. Leading {{ic|/}} can be ignored but the path still has to be full path. Example: {{ic|initrd&#61;EFI/arch/initramfs-linux.img}} }}

+

}}

−

=== Booting EFISTUB ===

−

{{Warning|Linux Kernel EFISTUB booting uses {{ic|\}} instead of {{ic|/}} and should be relative to the UEFI System Partition's root. For example, if the initramfs is located in {{ic|/boot/efi/EFI/arch/initramfs-linux.img}}, the corresponding UEFI formatted line would be {{ic|\EFI\arch\initramfs-linux.img}}. Failure to convert the options will lead to a system hang without any error message from the firmware or kernel.}}

One can boot the EFISTUB kernel using one of the following ways :

One can boot the EFISTUB kernel using one of the following ways :

Line 142:

Line 41:

|-

|-

| /usr/share/refind/icons || /boot/efi/EFI/refind/icons

| /usr/share/refind/icons || /boot/efi/EFI/refind/icons

+

|-

+

| /usr/lib/refind/drivers_<arch> || /boot/efi/EFI/tools/drivers

|}

|}

Line 148:

Line 49:

{{Note|As of {{Pkg|refind-efi}} 0.6.5-1, refind can auto-detect kernels in {{ic|/boot}}, if there are UEFI drivers for the filesystem used by /boot partition (or / partition if no separate /boot is used) in the ESP, and are loaded by rEFInd. To enable rEFInd to detect and load the drivers and /boot kernels you must enable the appropriate options in {{ic|refind.conf}} (mainly mention the PATH for the drivers location in the ESP) and also copy your {{ic|refind_linux.conf}} to {{ic|/boot/refind_linux.conf}} .}}

{{Note|As of {{Pkg|refind-efi}} 0.6.5-1, refind can auto-detect kernels in {{ic|/boot}}, if there are UEFI drivers for the filesystem used by /boot partition (or / partition if no separate /boot is used) in the ESP, and are loaded by rEFInd. To enable rEFInd to detect and load the drivers and /boot kernels you must enable the appropriate options in {{ic|refind.conf}} (mainly mention the PATH for the drivers location in the ESP) and also copy your {{ic|refind_linux.conf}} to {{ic|/boot/refind_linux.conf}} .}}

−

{{Tip|Pass kernel specific commands by copying {{ic|/usr/lib/refind/config/refind_linux.conf}} to {{ic|/boot/efi/EFI/arch/refind_linux.conf}}. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUIID with your root's PARTUIID}}

+

{{Tip|Pass kernel specific commands by copying {{ic|/usr/lib/refind/config/refind_linux.conf}} to {{ic|/boot/efi/EFI/arch/refind_linux.conf}}. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUUID with your root's PARTUUID}}

{{Note|Please notice the difference between the standard UUID and the PARTUUID shown by {{ic|$ ls -l /dev/disk/by-partuuid/}}}}

{{Note|Please notice the difference between the standard UUID and the PARTUUID shown by {{ic|$ ls -l /dev/disk/by-partuuid/}}}}

echo "Updated binaries and directory files for refind at $refind_dir";

echo "Updated binaries and directory files for refind at $refind_dir";

else

else

Line 243:

Line 144:

{{Tip|Enable the systemd path unit by running :

{{Tip|Enable the systemd path unit by running :

{{bc|<nowiki>

{{bc|<nowiki>

−

# systemctl enable refind_update.path;

+

# systemctl enable refind_update.path

</nowiki>}}}}

</nowiki>}}}}

Line 258:

Line 159:

==== Using gummiboot ====

==== Using gummiboot ====

−

[[Gummiboot]] is a UEFI Boot Manager which provides a nice menu for EFISTUB Kernels. It is a new program and relatively untested compared to rEFInd . It is available in [extra] as {{Pkg|gummiboot-efi}}. See http://freedesktop.org/wiki/Software/gummiboot for more info.

+

[[Gummiboot]] is a UEFI Boot Manager which provides a nice menu for EFISTUB Kernels. It is available in [extra] as {{Pkg|gummiboot}}. See https://wiki.archlinux.org/index.php/Gummiboot for more info.

This way you can specify UUID's without needing to remember the name or type out 20-30 characters.

This way you can specify UUID's without needing to remember the name or type out 20-30 characters.

Line 282:

Line 183:

==== Using efibootmgr entry ====

==== Using efibootmgr entry ====

−

{{Note|1=This menthod may not work due to [https://git.kernel.org/?p=linux/kernel/git/mfleming/efi.git;a=commitdiff;h=b003aaf799c991295b8b73e8f940d20bda2c1bbb;hp=ddffeb8c4d0331609ef2581d84de4d763607bd37 limitations in how the kernel handles uefi runtime variables]. For example in Lenovo Thinkpads the initrd path is truncated (verified using {{ic|efibootmgr -v}} command) and therefore the kernel fails to boot.}}

+

{{Note|1=This method may not work due to [https://git.kernel.org/?p=linux/kernel/git/mfleming/efi.git;a=commitdiff;h=b003aaf799c991295b8b73e8f940d20bda2c1bbb;hp=ddffeb8c4d0331609ef2581d84de4d763607bd37 limitations in how the kernel handles uefi runtime variables]. For example in some Lenovo Thinkpads the initrd path is truncated (verified using {{ic|efibootmgr -v}} command) and therefore the kernel fails to boot.}}

{{Note|Some UEFI firmwares may not support embedding command line parameters to uefi applications in the boot entries.}}

{{Note|Some UEFI firmwares may not support embedding command line parameters to uefi applications in the boot entries.}}

Line 292:

Line 193:

Install efibootmgr if you haven't already.

Install efibootmgr if you haven't already.

# pacman -S --needed efibootmgr

# pacman -S --needed efibootmgr

−

−

Determine the UUID or PARTUUID of your boot device (ie. the partition for {{ic|/}}, not the EFI boot partition)

−

# blkid

Load the EFI module.

Load the EFI module.

Line 301:

Line 199:

Finally, add the efistub.

Finally, add the efistub.

WARNING: Make sure you replace the following before running this command:

WARNING: Make sure you replace the following before running this command:

−

* ''3518bb68-d01e-45c9-b973-0b5d918aae96'' -- with the UUID of your {{ic|/}} partition. (This is not PARTUUID!)

to verify that the resulting entry is correct. You should also consider reordering the boot options ({{ic|efibootmgr -o}}) to place the Arch entry last, which will make the system easier to recover if it fails.

+

to verify that the resulting entry is correct. You should also consider reordering the boot options ({{ic|efibootmgr -o}}) to place the Arch entry last, which could make the system easier to recover if it fails.

−

{{Note|On at least one system, the {{ic|\\a}} in the initrd path was still interpreted as an escape character. If you get a "Failed to open initrd file" error or suspect that might be the case, try putting a triple backslash before the a in arch}}

−

{{Note|The trailing hyphen after {{ic|--append-binary-args}} or {{ic|-@}} is required to instruct efibootmgr to read the parameters from STDIN (standard input). The code should be {{ic|--append-binary-args -}} or {{ic|-@ -}} .}}

More info about efibootmgr at [[UEFI#efibootmgr]]. Forum post https://bbs.archlinux.org/viewtopic.php?pid=1090040#p1090040 .

More info about efibootmgr at [[UEFI#efibootmgr]]. Forum post https://bbs.archlinux.org/viewtopic.php?pid=1090040#p1090040 .

−

{{Note|Some firmwares may have trouble with the "initrd path" when piping in ucs-2 as shown above. In this case, one may put vmlinuz-linux.efi and the initramfs in the root of the ESP and adjust the efibootmgr entry accordingly.}}

+

{{Note|Some firmwares may have trouble with the "initrd path" when using ucs-2 as shown above. In this case, one may put vmlinuz-linux.efi and the initramfs in the root of the ESP and adjust the efibootmgr entry accordingly.}}

+

+

When booting using this method, care must be taken to synchronize the kernel with the ESP following a kernel upgrade but before rebooting. If you fail to do so, your system will not boot until you update the ESP by some other means (e.g. using the installation media to mount your hard drive).

== GRUB 2.x ==

== GRUB 2.x ==

Line 337:

Line 231:

== ELILO ==

== ELILO ==

−

ELILO is the UEFI version of LILO Boot Loader. It was originally created for Intel Itanium systems which supported only EFI (precursor to UEFI). It is the oldest UEFI bootloader for Linux. It is still in development but happens at a very slow pace. Upstream provided compiled binaries are available at http://sourceforge.net/projects/elilo/ . Elilo config file {{ic|elilo.conf}} is similar to [[LILO]]'s config file. AUR package - {{AUR|elilo-efi-x86_64}} (only for x86_64 UEFI).

+

ELILO is the UEFI version of LILO Boot Loader. It was originally created for Intel Itanium systems which supported only EFI (precursor to UEFI). It is the oldest UEFI bootloader for Linux. It is still in development but happens at a very slow pace. Upstream provided compiled binaries are available at http://sourceforge.net/projects/elilo/ . Elilo config file {{ic|elilo.conf}} is similar to [[LILO]]'s config file. AUR package - {{AUR|elilo-efi}}.

== EFILINUX ==

== EFILINUX ==

Revision as of 12:01, 3 May 2013

zh-CN:UEFI Bootloaders
This page contains info about various UEFI Bootloaders capable of booting Linux kernel. It is recommended to read the UEFI and GPT pages before reading this page. The following bootloaders are explained here:

Linux Kernel EFISTUB

Linux (Kernel >= 3.3) supports EFISTUB (EFI BOOT STUB) booting. It is enabled by by default on Arch Linux kernels or can be activated by setting CONFIG_EFI_STUB=y in the Kernel configuration (see The EFI Boot Stub for more information).

A single EFISTUB kernel is not capable of launching other kernels, hence each EFISTUB Kernel + Initramfs pair requires a separate boot menu entry. It is recommended to use a UEFI Boot Manager to manage multiple kernels.

Setting up EFISTUB

Mount the UEFI System Partition at /boot/efi with # mount <UEFI Partition> /boot/efi if you're going to be using GRUB2, or at /boot with # mount <UEFI Partition> /boot if you're going to be using Gummiboot or rEFInd. Gummiboot cannot boot across partitions, and will never have such capability due to its nature, so it's paramount that you mount the UEFI System Partition at /boot for use with Gummiboot so that the kernel and initramfs lie on the same partition as the bootmanager.

Note: As of refind-efi 0.6.5, refind now automatically detects kernels in /boot. They do not have to be renamed to have a .efi extension either, as long as you are using refind.

Booting EFISTUB

Warning: Linux Kernel EFISTUB booting uses \ instead of / and should be relative to the UEFI System Partition's root. For example, if the initramfs is located in /boot/efi/EFI/arch/initramfs-linux.img, the corresponding UEFI formatted line would be \EFI\arch\initramfs-linux.img. Failure to convert the options will lead to a system hang without any error message from the firmware or kernel.

Note: Support of initrd path name with / in EFISTUB booting has been added in mainline 3.9-rc1 and stable 3.8.2. Leading / can be ignored but the path still has to be full path. Example: initrd=EFI/arch/initramfs-linux.img

One can boot the EFISTUB kernel using one of the following ways :

Using rEFInd

rEFInd is a fork of rEFIt Boot Manager (used in Intel Macs) by Rod Smith (author of GPT-fdisk). rEFInd fixes many issues in rEFIt with respect to non-Mac UEFI booting and also has support for booting EFISTUB kernels and contains some features specific to them. More info about rEFInd support for EFISTUB is at The rEFInd Boot Manager: Methods of Booting Linux.

Copy the following files from their source directory to their destination

Note: <arch> is the bit architecture of the system. Run $ uname -m to get the architecture. Replace <arch> with "ia32" for 32 bit systems, and <arch> with "x64" for 64 bit systems.

rEFInd File Source

UEFI Destination

/usr/lib/refind/refind_<arch>.efi

/boot/efi/EFI/refind/refind_<arch>.efi

/usr/lib/refind/config/refind.conf

/boot/efi/EFI/refind/refind.conf

/usr/share/refind/icons

/boot/efi/EFI/refind/icons

/usr/lib/refind/drivers_<arch>

/boot/efi/EFI/tools/drivers

Tip: Refind's configuration file is located in /boot/efi/EFI/refind/refind.conf. The file is well commented.

Note: As of refind-efi 0.6.5-1, refind can auto-detect kernels in /boot, if there are UEFI drivers for the filesystem used by /boot partition (or / partition if no separate /boot is used) in the ESP, and are loaded by rEFInd. To enable rEFInd to detect and load the drivers and /boot kernels you must enable the appropriate options in refind.conf (mainly mention the PATH for the drivers location in the ESP) and also copy your refind_linux.conf to /boot/refind_linux.conf .

Tip: Pass kernel specific commands by copying /usr/lib/refind/config/refind_linux.conf to /boot/efi/EFI/arch/refind_linux.conf. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUUID with your root's PARTUUID

Note: Please notice the difference between the standard UUID and the PARTUUID shown by $ ls -l /dev/disk/by-partuuid/

Apple Macs

In case of Apple Macs, try mactel-bootAUR for an experimental "bless" utility for Linux. If that does not work, use "bless" form within OSX to set rEFInd as default bootloader. Assuming UEFISYS partition is mounted at /mnt/efi within OSX, do

Note: Some UEFI firmwares may not support embedding command line parameters to uefi applications in the boot entries.

It is possible to directly embed the kernel parameters within the boot entry created by efibootmgr. This means that in your BIOS/UEFI you will be able to select Arch Linux directly in the default boot order, and on startup it will boot into Arch directly without any kind of boot selection GUI.

Do (as root):

Install efibootmgr if you haven't already.

# pacman -S --needed efibootmgr

Load the EFI module.

# modprobe efivars

Finally, add the efistub.
WARNING: Make sure you replace the following before running this command:

to verify that the resulting entry is correct. You should also consider reordering the boot options (efibootmgr -o) to place the Arch entry last, which could make the system easier to recover if it fails.

Note: Some firmwares may have trouble with the "initrd path" when using ucs-2 as shown above. In this case, one may put vmlinuz-linux.efi and the initramfs in the root of the ESP and adjust the efibootmgr entry accordingly.

When booting using this method, care must be taken to synchronize the kernel with the ESP following a kernel upgrade but before rebooting. If you fail to do so, your system will not boot until you update the ESP by some other means (e.g. using the installation media to mount your hard drive).

GRUB 2.x

GRUB 2.x contains its own filesystem drivers and does not rely on the firmware to access the files. It can directly read files from /boot and does not require the kernel and initramfs files to be in the UEFISYS partition. Detailed information at GRUB#UEFI_systems_2. For bzr development version try AUR package - grub-efi-x86_64-bzrAUR.

SYSLINUX

Note: Syslinux UEFI support is currently part of version 6.00-preXX or in firmware branch of upstream git repo. It is considered alpha quality by upstream. The below information is provided mainly to enable bug-testing. Please report all issues upstream.

Note: Syslinux UEFI can boot only those kernels that support EFI Handover Protocol. Thus LTS kernels are not supported.

Install syslinux-efi-gitAUR AUR package and copy /usr/lib/syslinux/efi64/* to $esp/EFI/syslinux/ ($esp is the mountpoint of UEFISYS partition) (efi64 is for x86_64 UEFI firmwares, replace with efi32 for i386 UEFI firmwares), and then create a boot entry using efibootmgr in the firmware boot manager.

ELILO

ELILO is the UEFI version of LILO Boot Loader. It was originally created for Intel Itanium systems which supported only EFI (precursor to UEFI). It is the oldest UEFI bootloader for Linux. It is still in development but happens at a very slow pace. Upstream provided compiled binaries are available at http://sourceforge.net/projects/elilo/ . Elilo config file elilo.conf is similar to LILO's config file. AUR package - elilo-efiAUR.

Package Naming Guidelines

UEFI bootloader package(s) should be suffixed with -efi-x86_64 or -efi-i386 to denote package built for 64-bit and 32-bit UEFI respectively. If a single package contains both 64-bit and 32-bit UEFI applications, then -efi suffix should be used in the pkgname.