Difference between revisions of "Systemd-boot"

From ArchWiki
Jump to: navigation, search
m (Installing: useless dot)
m (Gummiboot is not a UEFI boot manager. Please don't confuse with boot manager in UEFI spec chapter 3)
(26 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
[[Category:Boot loaders]]
 
[[Category:Boot loaders]]
[http://freedesktop.org/wiki/Software/gummiboot Gummiboot] is a UEFI boot loader written by Kay Sievers and Harald Hoyer. It is simple to configure, but can only start EFI executables, the Linux kernel (with CONFIG_EFI_STUB enabled), grub.efi, and such.
+
[[ja:Gummiboot]]
 +
[http://freedesktop.org/wiki/Software/gummiboot Gummiboot] is a UEFI boot loader written by Kay Sievers and Harald Hoyer. It is simple to configure, but can only start EFI executables, the Linux kernel [[EFISTUB]], UEFI Shell, grub.efi, and such.
  
== Installing ==
+
{{Warning|Gummiboot simply provides a boot menu for EFISTUB kernels. In case you have issues booting EFISTUB kernels like in {{Bug|33745}}, you should use a boot loader which does not use EFISTUB, like [[GRUB]], [[Syslinux]] or [[Bootloaders#ELILO|ELILO]].}}
Install {{Pkg|gummiboot}} and run the following to install gummiboot as your bootloader:
+
  
# gummiboot install
+
{{Note|In the entire article {{ic|$esp}} denotes the mountpoint of the [[Unified_Extensible_Firmware_Interface#EFI_System_Partition|EFI System Partition]] aka ESP.}}
  
This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. If you are not booted via EFI, creating the boot entry will fail. You should however still be able to boot gummiboot as it copies the binary to the default EFI binary location on your ESP ({{ic|/boot/EFI/Boot/BOOTX64.EFI}} on x64 systems). Note that the installation process has to be done only once, updating will happen automatically by the post_install script of {{Pkg|gummiboot}} during package updates.
+
== Installation ==
 +
 
 +
Install {{Pkg|gummiboot}} and install gummiboot in ESP:
 +
 
 +
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars              # required even inside chroot if any, ignore if already mounted
 +
# pacman -S gummiboot
 +
# gummiboot --path=$esp install
 +
 
 +
This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. If you are not booted via EFI, creating the boot entry will fail. You should however still be able to boot gummiboot as it copies the binary to the default EFI binary location on your ESP ({{ic|$esp/EFI/boot/bootx64.efi}} on x64 systems) (unless a non-gummiboot {{ic|$esp/EFI/boot/bootx64.efi}} is already present).  
  
 
{{Note|
 
{{Note|
* The gummiboot command assumes that your EFI System Partition is mounted on {{ic|/boot}}. If your ESP is mounted on {{ic|/boot/efi}} you have to call the following gummiboot install command with the additional {{ic|--path}} switch. This also means that gummiboot will not be able to update itself automatically and you will have to call {{ic|1=gummiboot --path=/boot/efi update}} after every package update. Additionally you will have to make sure that the kernel and initramfs are copied onto the ESP as gummiboot can't load EFI binaries from other partitions. It is therefore strongly recommended to mount your ESP to {{ic|/boot}} if you use gummiboot. The rest of this article will assume that your ESP is mounted on {{ic|/boot}}.
+
* The gummiboot command by default assumes that your EFI System Partition is mounted on {{ic|/boot}}. This means gummiboot in the ESP will not be updated automatically during pkg updates and you will have to call {{ic|1=gummiboot --path=$esp update}} after every package update. Additionally you will have to make sure that the kernel and initramfs are copied onto the ESP as gummiboot cannot load EFI binaries from other partitions. It is therefore strongly recommended to mount your ESP to {{ic|/boot}} if you use gummiboot, in which case updating will happen automatically by the post_install script of {{Pkg|gummiboot}} during package updates.
  
 
* If {{ic|gummiboot}} fails to create a boot entry, check whether all the conditions mentioned [[Unified_Extensible_Firmware_Interface#Requirements_for_UEFI_Variables_support_to_work_properly|here]] are met.}}
 
* If {{ic|gummiboot}} fails to create a boot entry, check whether all the conditions mentioned [[Unified_Extensible_Firmware_Interface#Requirements_for_UEFI_Variables_support_to_work_properly|here]] are met.}}
  
== Configuring ==
+
==Configuration ==
 +
 
 +
=== Basic Configuration ===
  
The basic configuration is kept in {{ic|/boot/loader/loader.conf}}, with just two possible configuration options:
+
The basic configuration is kept in {{ic|$esp/loader/loader.conf}}, with just two possible configuration options:
  
 
* {{ic|default}} – default entry to select (without the {{ic|.conf}} suffix); can be a wildcard like {{ic|arch-*}}
 
* {{ic|default}} – default entry to select (without the {{ic|.conf}} suffix); can be a wildcard like {{ic|arch-*}}
Line 24: Line 34:
 
Example:
 
Example:
  
{{hc|/boot/loader/loader.conf|
+
{{hc|$esp/loader/loader.conf|
 
default  arch
 
default  arch
 
timeout  4
 
timeout  4
Line 31: Line 41:
 
Note that both options can be changed in the boot menu itself, which will store them as EFI variables.
 
Note that both options can be changed in the boot menu itself, which will store them as EFI variables.
  
== Adding boot entries ==
+
{{Note|If no timeout is configured, which is the default setting, and no key pressed during bootup, the default entry is executed right away.}}
Gummiboot searches for boot menu items in {{ic|/boot/loader/entries/*.conf}} – each file found must contain exactly one boot entry. The possible options are:
+
 
 +
=== Adding boot entries ===
 +
 
 +
Gummiboot searches for boot menu items in {{ic|$esp/loader/entries/*.conf}} – each file found must contain exactly one boot entry. The possible options are:
  
 
* {{ic|title}} – operating system name. '''Required.'''
 
* {{ic|title}} – operating system name. '''Required.'''
Line 40: Line 53:
 
* {{ic|machine-id}} – machine identifier from {{ic|/etc/machine-id}}, shown only when multiple entries with same title and version exist. Optional.
 
* {{ic|machine-id}} – machine identifier from {{ic|/etc/machine-id}}, shown only when multiple entries with same title and version exist. Optional.
  
* {{ic|efi}} – EFI program to start, relative to your ESP ({{ic|/boot}}); e.g. {{ic|/vmlinuz-linux}}. Either this or {{ic|linux}} (see below) is '''required.'''
+
* {{ic|efi}} – EFI program to start, relative to your ESP ({{ic|$esp}}); e.g. {{ic|/vmlinuz-linux}}. Either this or {{ic|linux}} (see below) is '''required.'''
  
 
* {{ic|options}} – Command-line options to pass to the EFI program. Optional, but you will need at least {{ic|1=initrd=''efipath''}} and {{ic|1=root=''dev''}} if booting Linux.
 
* {{ic|options}} – Command-line options to pass to the EFI program. Optional, but you will need at least {{ic|1=initrd=''efipath''}} and {{ic|1=root=''dev''}} if booting Linux.
Line 48: Line 61:
 
An example entry for Arch Linux:
 
An example entry for Arch Linux:
  
{{hc|/boot/loader/entries/arch.conf|2=
+
{{hc|$esp/loader/entries/arch.conf|2=
 
title          Arch Linux
 
title          Arch Linux
 
linux          /vmlinuz-linux
 
linux          /vmlinuz-linux
Line 55: Line 68:
 
}}
 
}}
  
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}}.  
+
Please note in the example above that PARTUUID/PARTLABEL identifies a GPT partition, and differs from UUID/LABEL, which identifies a filesystem. Using the PARTUUID/PARTLABEL is advantageous because it is invariant if you reformat the partition with another filesystem. It is also useful if you do not have a filesystem on the partition (or use LUKS, which does not support LABELs).
  
{{Note|Gummiboot will automatically check for binaries of a Windows Installation ({{ic|\EFI\Microsoft\Boot\Bootmgfw.efi}}) or a UEFI Shell ({{ic|\shellx64.efi}}) and display entries for them, so you don't have to create these manually.}}
+
An example entry for encrypted root (dm-crypt with LUKS)
 +
{{hc|$esp/loader/entries/arch-encrypted.conf|2=
 +
title          Arch Linux (Encrypted)
 +
linux          /path/to/vmlinuz-linux
 +
options        initrd=/path/to/initramfs-linux.img cryptdevice=UUID=<UUID>:luks-<UUID> root=UUID=<luks-UUID> rw
 +
}}
 +
 
 +
In the encrypted example, not that the initrd is in options -- this does not appear to be discretionary at this time. Note that UUID is used for in this example. PARTUUID should be able to replace the UUID, if so desired.
 +
 
 +
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}}.
 +
 
 +
{{Note|Gummiboot will automatically check for "'''Windows Boot Manager'''" ({{ic|\EFI\Microsoft\Boot\Bootmgfw.efi}}), "'''EFI Shell'''" ({{ic|\shellx64.efi}}) and "'''EFI Default Loader'''" ({{ic|\EFI\Boot\bootx64.efi}}), and display entries for them if they are present, so you do not have to manually create entries for them. However it does not autodetect other EFI applications (unlike rEFInd), so for booting the kernel, manual config entries must be created as mentioned above.}}
  
 
== Inside the boot menu ==
 
== Inside the boot menu ==
Line 67: Line 91:
 
* {{ic|Enter}} - boot the selected entry
 
* {{ic|Enter}} - boot the selected entry
 
* {{ic|d}} - select the default entry to boot (stored in a non-volatile EFI variable)
 
* {{ic|d}} - select the default entry to boot (stored in a non-volatile EFI variable)
* {{ic|t/T}} - adjust the timeout (stored in a non-volatile EFI variable)
+
* {{ic|-/T}} - decrease the timeout (stored in a non-volatile EFI variable)
 +
* {{ic|+/t}} - increase the timeout (stored in a non-volatile EFI variable)
 
* {{ic|e}} - edit the kernel command line
 
* {{ic|e}} - edit the kernel command line
* {{ic|q}} - quit
 
 
* {{ic|v}} - show the gummiboot and UEFI version
 
* {{ic|v}} - show the gummiboot and UEFI version
* {{ic|p}} - print the current configuration
+
* {{ic|Q}} - quit
* {{ic|h}} - show key mapping
+
* {{ic|P}} - print the current configuration
 +
* {{ic|h/?}} - help
  
 
These hotkeys will, when pressed inside the menu or during bootup, directly boot
 
These hotkeys will, when pressed inside the menu or during bootup, directly boot
 
a specific entry:
 
a specific entry:
 +
 
* {{ic|l}} - Linux
 
* {{ic|l}} - Linux
 
* {{ic|w}} - Windows
 
* {{ic|w}} - Windows
Line 84: Line 110:
 
== Troubleshooting ==
 
== Troubleshooting ==
  
==== Manual entry using efibootmgr ====
+
=== Manual entry using efibootmgr ===
If {{ic|gummiboot install}} command failed you can create a EFI boot entry manually with {{ic|efibootmgr}} utility:
+
 
  # efibootmgr -c -w -d /dev/sdX -p Y -l '\EFI\gummiboot\gummibootx64.efi' -L "Gummiboot"
+
If {{ic|gummiboot install}} command failed, you can create a EFI boot entry manually using {{ic|efibootmgr}} utility:
 +
 
 +
  # efibootmgr -c -d /dev/sdX -p Y -l /EFI/gummiboot/gummibootx64.efi -L "Gummiboot"
 +
 
 +
where {{ic|/dev/sdXY}} is the EFISYS partition.
 +
 
 +
=== Menu does not appear after Windows upgrade ===
 +
 
 +
For example, if you upgraded from Windows 8 to Windows 8.1, and you no longer see a boot menu after the upgrade (i.e., Windows boots immediately):
 +
* Make sure Secure Boot (BIOS setting) and Fast Startup (Windows power option setting) are both disabled.
 +
* Make sure your BIOS prefers Linux Boot Manager over Windows Boot Manager (depending on your BIOS, this might appear under a BIOS setting like Hard Disk Drive Priority).
 +
 
 +
== References ==
 +
 
 +
* http://freedesktop.org/wiki/Software/gummiboot/

Revision as of 16:57, 5 February 2014

Gummiboot is a UEFI boot loader written by Kay Sievers and Harald Hoyer. It is simple to configure, but can only start EFI executables, the Linux kernel EFISTUB, UEFI Shell, grub.efi, and such.

Warning: Gummiboot simply provides a boot menu for EFISTUB kernels. In case you have issues booting EFISTUB kernels like in FS#33745, you should use a boot loader which does not use EFISTUB, like GRUB, Syslinux or ELILO.
Note: In the entire article $esp denotes the mountpoint of the EFI System Partition aka ESP.

Installation

Install gummiboot and install gummiboot in ESP:

# mount -t efivarfs efivarfs /sys/firmware/efi/efivars              # required even inside chroot if any, ignore if already mounted
# pacman -S gummiboot
# gummiboot --path=$esp install

This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. If you are not booted via EFI, creating the boot entry will fail. You should however still be able to boot gummiboot as it copies the binary to the default EFI binary location on your ESP ($esp/EFI/boot/bootx64.efi on x64 systems) (unless a non-gummiboot $esp/EFI/boot/bootx64.efi is already present).

Note:
  • The gummiboot command by default assumes that your EFI System Partition is mounted on /boot. This means gummiboot in the ESP will not be updated automatically during pkg updates and you will have to call gummiboot --path=$esp update after every package update. Additionally you will have to make sure that the kernel and initramfs are copied onto the ESP as gummiboot cannot load EFI binaries from other partitions. It is therefore strongly recommended to mount your ESP to /boot if you use gummiboot, in which case updating will happen automatically by the post_install script of gummiboot during package updates.
  • If gummiboot fails to create a boot entry, check whether all the conditions mentioned here are met.

Configuration

Basic Configuration

The basic configuration is kept in $esp/loader/loader.conf, with just two possible configuration options:

  • default – default entry to select (without the .conf suffix); can be a wildcard like arch-*
  • timeout – menu timeout in seconds. If this is not set, the menu will only be shown when you hold the space key while booting.

Example:

$esp/loader/loader.conf
default  arch
timeout  4

Note that both options can be changed in the boot menu itself, which will store them as EFI variables.

Note: If no timeout is configured, which is the default setting, and no key pressed during bootup, the default entry is executed right away.

Adding boot entries

Gummiboot searches for boot menu items in $esp/loader/entries/*.conf – each file found must contain exactly one boot entry. The possible options are:

  • title – operating system name. Required.
  • version – kernel version, shown only when multiple entries with same title exist. Optional.
  • machine-id – machine identifier from /etc/machine-id, shown only when multiple entries with same title and version exist. Optional.
  • efi – EFI program to start, relative to your ESP ($esp); e.g. /vmlinuz-linux. Either this or linux (see below) is required.
  • options – Command-line options to pass to the EFI program. Optional, but you will need at least initrd=efipath and root=dev if booting Linux.

For Linux, you can specify linux path-to-vmlinuz and initrd path-to-initramfs; this will be automatically translated to efi path and options initrd=path – this syntax is only supported for convenience and has no differences in function.

An example entry for Arch Linux:

$esp/loader/entries/arch.conf
title          Arch Linux
linux          /vmlinuz-linux
initrd         /initramfs-linux.img
options        root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw

Please note in the example above that PARTUUID/PARTLABEL identifies a GPT partition, and differs from UUID/LABEL, which identifies a filesystem. Using the PARTUUID/PARTLABEL is advantageous because it is invariant if you reformat the partition with another filesystem. It is also useful if you do not have a filesystem on the partition (or use LUKS, which does not support LABELs).

An example entry for encrypted root (dm-crypt with LUKS)

$esp/loader/entries/arch-encrypted.conf
title          Arch Linux (Encrypted)
linux          /path/to/vmlinuz-linux
options        initrd=/path/to/initramfs-linux.img cryptdevice=UUID=<UUID>:luks-<UUID> root=UUID=<luks-UUID> rw

In the encrypted example, not that the initrd is in options -- this does not appear to be discretionary at this time. Note that UUID is used for in this example. PARTUUID should be able to replace the UUID, if so desired.

You can also add other EFI programs such as \EFI\arch\grub.efi.

Note: Gummiboot will automatically check for "Windows Boot Manager" (\EFI\Microsoft\Boot\Bootmgfw.efi), "EFI Shell" (\shellx64.efi) and "EFI Default Loader" (\EFI\Boot\bootx64.efi), and display entries for them if they are present, so you do not have to manually create entries for them. However it does not autodetect other EFI applications (unlike rEFInd), so for booting the kernel, manual config entries must be created as mentioned above.

Inside the boot menu

Keys

The following keys are used inside the menu:

  • Up/Down - select entry
  • Enter - boot the selected entry
  • d - select the default entry to boot (stored in a non-volatile EFI variable)
  • -/T - decrease the timeout (stored in a non-volatile EFI variable)
  • +/t - increase the timeout (stored in a non-volatile EFI variable)
  • e - edit the kernel command line
  • v - show the gummiboot and UEFI version
  • Q - quit
  • P - print the current configuration
  • h/? - help

These hotkeys will, when pressed inside the menu or during bootup, directly boot a specific entry:

  • l - Linux
  • w - Windows
  • a - OS X
  • s - EFI Shell
  • 1-9 - number of entry

Troubleshooting

Manual entry using efibootmgr

If gummiboot install command failed, you can create a EFI boot entry manually using efibootmgr utility:

# efibootmgr -c -d /dev/sdX -p Y -l /EFI/gummiboot/gummibootx64.efi -L "Gummiboot"

where /dev/sdXY is the EFISYS partition.

Menu does not appear after Windows upgrade

For example, if you upgraded from Windows 8 to Windows 8.1, and you no longer see a boot menu after the upgrade (i.e., Windows boots immediately):

  • Make sure Secure Boot (BIOS setting) and Fast Startup (Windows power option setting) are both disabled.
  • Make sure your BIOS prefers Linux Boot Manager over Windows Boot Manager (depending on your BIOS, this might appear under a BIOS setting like Hard Disk Drive Priority).

References