Difference between revisions of "Systemd-boot"

From ArchWiki
Jump to: navigation, search
m (Installing)
m (Basic configuration: Do not use a bullet point list for only one element)
 
(240 intermediate revisions by 81 users not shown)
Line 1: Line 1:
 +
{{lowercase title}}
 
[[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.
+
[[de:Gummiboot]]
 +
[[es:Systemd-boot]]
 +
[[ja:Systemd-boot]]
 +
[[ru:Systemd-boot]]
 +
[[zh-hans:Systemd-boot]]
 +
{{Related articles start}}
 +
{{Related|Arch boot process}}
 +
{{Related|Boot loaders}}
 +
{{Related|Secure Boot}}
 +
{{Related|Unified Extensible Firmware Interface}}
 +
{{Related articles end}}
  
== Installing ==
+
'''systemd-boot''', previously called '''gummiboot''', is a simple UEFI boot manager which executes configured EFI images. The default entry is selected by a configured pattern (glob) or an on-screen menu. It is included with {{pkg|systemd}}, which is installed on Arch system by default.
  
{{Note|{{ic|/usr/bin/gummiboot}} requires {{ic|efivarfs}} support in the kernel and requires it to be mounted at {{ic|/sys/firmware/efi/efivars}}. Mounting of efivarfs at this path is done automatically by systemd if the kernel supports efivarfs. LTS kernels do not support efivarfs. In such cases, the user needs to use {{ic|efibootmgr}} to create a boot entry for gummiboot.}}
+
It is simple to configure but it can only start EFI executables such as the Linux kernel [[EFISTUB]], UEFI Shell, GRUB, the Windows Boot Manager.
  
{{Note|If {{ic|gummiboot}} fails to create a boot entry, check for existence of {{ic|/sys/firmware/efi/efivars/dump-*}} files. If they exist, delete them, reboot and retry {{ic|gummiboot}} again. If even this fails, retry {{ic|gummiboot}} after booting with {{ic|efi_no_storage_paranoia}} kernel parameter. If all these fail, try creating the boot entry using {{ic|efibootmgr}} or UEFI Shell v2 {{ic|bcfg}} command.}}
+
== Installation ==
  
Install {{Pkg|gummiboot}} from [extra] and run the following to install gummiboot:
+
=== EFI boot ===
 
# umount /sys/firmware/efi/efivars
 
# modprobe -r efivars
 
# modprobe efivarfs
 
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
 
# gummiboot install
 
  
{{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}}.}}
+
# Make sure you are booted in UEFI mode.
 +
# Verify [[Unified_Extensible_Firmware_Interface#Requirements_for_UEFI_variable_support|your EFI variables are accessible]].
 +
# Mount your [[EFI System Partition]] (ESP) properly. {{ic|''esp''}} is used to denote the mountpoint in this article. {{Note|''systemd-boot'' cannot load EFI binaries from other partitions. It is therefore recommended to mount your ESP to {{ic|/boot}}. In case you want to separate {{ic|/boot}} from the ESP see [[#Manually]] for more information.}}
 +
# If the ESP is '''not''' mounted at {{ic|/boot}}, then copy your kernel and initramfs onto that ESP. {{Note|For a way to automatically keep the kernel updated on the ESP, have a look at [[EFI System Partition#Using systemd]] for some systemd units that can be adapted. If your EFI System Partition is using automount, you may need to add {{ic|vfat}} to a file in {{ic|/etc/modules-load.d/}} to ensure the current running kernel has the {{ic|vfat}} module loaded at boot, before any kernel update happens that could replace the module for the currently running version making the mounting of {{ic|/boot/efi}} impossible until reboot.}}
 +
# Type the following command to install ''systemd-boot'': {{bc|1=# bootctl --path=''esp'' install}} It will copy the ''systemd-boot'' binary to your EFI System Partition ({{ic|''esp''/EFI/systemd/systemd-bootx64.efi}} and {{ic|''esp''/EFI/Boot/BOOTX64.EFI}} – both of which are identical – on x86-64 systems) and add ''systemd-boot'' itself as the default EFI application (default boot entry) loaded by the EFI Boot Manager.
 +
# Finally you must [[#Configuration|configure]] the boot loader to function properly.
  
This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. 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.
+
=== BIOS boot ===
  
== Configuring ==
+
{{Warning|This is not recommended.}}
 +
You can successfully install ''systemd-boot'' if booted with in BIOS mode. However, this process requires you to tell firmware to launch ''systemd-boot'''s EFI file at boot, usually via two ways:
  
The basic configuration is kept in {{ic|/boot/loader/loader.conf}}, with just two possible configuration options:
+
* you have a working EFI Shell somewhere else.
 +
* your firmware interface provides a way of properly setting the EFI file that needs to be loaded at boot time.
  
* {{ic|default}} – default entry to select (without the {{ic|.conf}} suffix); can be a wildcard like {{ic|arch-*}}
+
If you can do it, the installation is easier: go into your EFI Shell or your firmware configuration interface and change your machine's default EFI file to {{ic|''esp''/EFI/systemd/systemd-bootx64.efi}} ( or {{ic|systemd-bootia32.efi}} depending if your system firmware is 32 bit).
  
* {{ic|timeout}} – menu timeout in seconds. If this is not set, the menu will only be shown when you hold the space key while booting.
+
{{Note|the firmware interface of Dell Latitude series provides everything you need to setup EFI boot but the EFI Shell won't be able to write to the computer's ROM.}}
 +
 
 +
=== Updating ===
 +
 
 +
Unlike the previous separate ''gummiboot'' package, which updated automatically on a new package release with a {{ic|post_install}} script, updates of new ''systemd-boot'' versions must now be done manually by the user. However the procedure can be automated using pacman hooks.
 +
 
 +
==== Manually ====
 +
 
 +
''systemd-boot'' ({{man|1|bootctl}}) assumes that your EFI System Partition is mounted on {{ic|/boot}}.
 +
 
 +
# bootctl update
 +
 
 +
If the ESP is not mounted on {{ic|/boot}}, the {{ic|1=--path=}} option can pass it. For example:
 +
 
 +
# bootctl --path=''esp'' update
 +
 
 +
{{Note|This is also the command to use when migrating from ''gummiboot'', before removing that package. If that package has already been removed, however, run {{ic|1=bootctl --path=''esp'' install}}.}}
 +
 
 +
==== Automatically ====
 +
 
 +
The [[AUR]] package {{AUR|systemd-boot-pacman-hook}} provides a [[Pacman#Hooks|Pacman hook]] to automate the update process. [[Install|Installing]] the package will add a hook which will be executed every time the {{Pkg|systemd}} package is upgraded.
 +
 
 +
Alternatively, place the following pacman hook in the {{ic|/etc/pacman.d/hooks/}} directory:
 +
 
 +
{{hc|/etc/pacman.d/hooks/systemd-boot.hook|2=
 +
[Trigger]
 +
Type = Package
 +
Operation = Upgrade
 +
Target = systemd
 +
 
 +
[Action]
 +
Description = Updating systemd-boot...
 +
When = PostTransaction
 +
Exec = /usr/bin/bootctl update
 +
}}
 +
 
 +
== Configuration ==
 +
 
 +
=== Basic configuration ===
 +
 
 +
The basic configuration is stored in {{ic|''esp''/loader/loader.conf}} file and it is composed by three options:
 +
 
 +
* {{ic|default}} – default entry to select (without the {{ic|.conf}} suffix); can be a wildcard like {{ic|arch-*}}.
 +
* {{ic|timeout}} – menu timeout in seconds. If this is not set, the menu will only be shown on {{ic|Space}} key (or most other keys actually work too) press during boot.
 +
* {{ic|editor}} – whether to enable the kernel parameters editor or not. {{ic|1}} (default) is enabled, {{ic|0}} is disabled; since the user can add {{ic|1=init=/bin/bash}} to bypass root password and gain root access, it is strongly recommended to set this option to {{ic|0}}.
  
 
Example:
 
Example:
  
{{hc|/boot/loader/loader.conf|
+
{{hc|''esp''/loader/loader.conf|
 
default  arch
 
default  arch
 
timeout  4
 
timeout  4
 +
editor  0
 
}}
 
}}
  
Note that both options can be changed in the boot menu itself, which will store them as EFI variables.
+
{{Note|The first 2 options can be changed in the boot menu itself and changes will be stored as EFI variables.}}
  
== Adding boot entries ==
+
{{Tip|A basic configuration file example is located at {{ic|/usr/share/systemd/bootctl/loader.conf}}.}}
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 ===
 +
 
 +
{{Note|
 +
* ''bootctl'' 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}}) at boot time, as well as specially prepared kernel files found in {{ic|\EFI\Linux}}. When detected, corresponding entries with titles {{ic|auto-windows}}, {{ic|auto-efi-shell}} and {{ic|auto-efi-default}}, respectively, will be automatically generated. These entries do not require manual loader configuration. However, it does not auto-detect other EFI applications (unlike [[rEFInd]]), so for booting the Linux kernel, manual configuration entries must be created.
 +
* If you dual-boot Windows, it is strongly recommended to disable its default [[Dual boot with Windows#Fast_Start-Up|Fast Start-Up]] option.
 +
* Remember to load the intel [[microcode]] with {{ic|initrd}} if applicable.
 +
* You can find the {{ic|PARTUUID}} for your root partition with the command {{ic|1=blkid -s PARTUUID -o value /dev/sd''xY''}}, where {{ic|''x''}} is the device letter and {{ic|''Y''}} is the partition number. This is required only for your root partition, not {{ic|''esp''}}.
 +
}}
 +
 
 +
''bootctl'' 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.'''
 +
* {{ic|version}} – kernel version, shown only when multiple entries with same title 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|''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 or [[kernel parameters]]. Optional, but you will need at least {{ic|1=initrd=''efipath''}} and {{ic|1=root=''dev''}} if booting Linux.
  
* {{ic|version}} – kernel version, shown only when multiple entries with same title exist. Optional.
+
For Linux, you can specify {{ic|linux ''path-to-vmlinuz''}} and {{ic|initrd ''path-to-initramfs''}}; this will be automatically translated to {{ic|efi ''path''}} and {{ic|1=options initrd=''path''}} – this syntax is only supported for convenience and has no differences in function.
  
* {{ic|machine-id}} – machine identifier from {{ic|/etc/machine-id}}, shown only when multiple entries with same title and version exist. Optional.
+
{{Tip|The available boot entries which have been configured can be listed with the command {{ic|bootctl list}}.}}
  
* {{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.'''
+
An example entry file is located at {{ic|/usr/share/systemd/bootctl/arch.conf}}. The [[kernel parameters]] for scenarios such as [[LVM]], [[LUKS]] or [[dm-crypt]] can be found on the relevant pages.
  
* {{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.
+
==== EFI Shells or other EFI apps ====
  
For Linux, you can specify {{ic|linux ''path-to-vmlinuz''}} and {{ic|initrd ''path-to-initramfs''}}; this will be automatically translated to {{ic|efi ''path''}} and {{ic|1=options initrd=''path''}} – this syntax is only supported for convenience and has no differences in function.
+
In case you installed EFI shells and other EFI application into the ESP, you can use the following snippets:
  
An example entry for Arch Linux:
+
{{hc|''esp''/loader/entries/uefi-shell-v1-x86_64.conf|2=
 +
title  UEFI Shell x86_64 v1
 +
efi    /EFI/shellx64_v1.efi
 +
}}
  
{{hc|/boot/loader/entries/arch.conf|2=
+
{{hc|''esp''/loader/entries/uefi-shell-v2-x86_64.conf|2=
title         Arch Linux
+
title UEFI Shell x86_64 v2
linux          /vmlinuz-linux
+
efi    /EFI/shellx64_v2.efi
initrd        /initramfs-linux.img
 
options        root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw
 
 
}}
 
}}
  
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}}.
+
{{Expansion|Add example on how to boot into EFI firmware setup.}}
  
{{Note|Gummiboot will automatically check for binaries of a Windows Installation ({{ic|\EFI\Microsoft\Boot\Bootmgfw.efi}}) or an UEFI Shell ({{ic|\shellx64.efi}}) and display entries for them, so you don't have to create these manually.}}
+
=== Preparing kernels for EFI\Linux ===
  
== Inside the boot menu ==
+
{{Style|Does not belong here, not specific to systemd-boot.}}
  
TODO: document keybindings from http://freedesktop.org/wiki/Software/gummiboot
+
''EFI\Linux'' is searched for specially prepared kernel files, which bundle the kernel, the initrd, the kernel command line and {{ic|/etc/os-release}} into one file. This file can be easily signed for secure boot.
 +
 
 +
{{Note|{{ic|systemd-boot}} requires that the {{ic|os-release}} file contain either {{ic|VERSION_ID}} or {{ic|BUILD_ID}} to generate an ID and automatically add the entry, which the Arch {{ic|os-release}} does not.  Either maintain your own copy with one of them, or make your bundling script generate it automatically.}}
 +
 
 +
Put the kernel command line you want to use in a file, and create the bundle file like this:
 +
 
 +
{{hc|Kernel packaging command:|<nowiki>objcopy \
 +
    --add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \
 +
    --add-section .cmdline="kernel-command-line.txt" --change-section-vma .cmdline=0x30000 \
 +
    --add-section .linux="vmlinuz-file" --change-section-vma .linux=0x40000 \
 +
    --add-section .initrd="initrd-file" --change-section-vma .initrd=0x3000000 \
 +
    "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "linux.efi"</nowiki>}}
 +
 
 +
Optionally sign ''linux.efi'' now (e.g. using ''sbsigntools'' from AUR).
 +
 
 +
Copying ''linux.efi'' into {{ic|''esp''\EFI\Linux}}.
 +
 
 +
=== Support hibernation ===
 +
 
 +
See [[Suspend and hibernate]].
 +
 
 +
=== Kernel parameters editor with password protection ===
 +
 
 +
Alternatively you can install {{AUR|systemd-boot-password}} which supports {{ic|password}} basic configuration option. Use {{ic|sbpctl generate}} to generate a value for this option.
 +
 
 +
Install ''systemd-boot-password'' with the following command:
 +
 
 +
{{bc|1=# sbpctl install ''esp''}}
 +
 
 +
With enabled editor you will be prompted for your password before you can edit kernel parameters.
 +
 
 +
== Keys inside the boot menu ==
 +
 
 +
The following keys are used inside the menu:
 +
* {{ic|Up/Down}} - select entry
 +
* {{ic|Enter}} - boot the selected entry
 +
* {{ic|d}} - select the default entry to boot (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. It has no effect if the {{ic|editor}} config option is set to {{ic|0}}.
 +
* {{ic|v}} - show the gummiboot and UEFI version
 +
* {{ic|Q}} - quit
 +
* {{ic|P}} - print the current configuration
 +
* {{ic|h/?}} - help
 +
 
 +
These hotkeys will, when pressed inside the menu or during bootup, directly boot
 +
a specific entry:
 +
 
 +
* {{ic|l}} - Linux
 +
* {{ic|w}} - Windows
 +
* {{ic|a}} - OS X
 +
* {{ic|s}} - EFI Shell
 +
* {{ic|1-9}} - number of entry
  
 
== Troubleshooting ==
 
== Troubleshooting ==
  
==== Manual entry using efibootmgr ====
+
=== Manual entry using efibootmgr ===
 +
 
 +
If the {{ic|bootctl install}} command failed, you can create a EFI boot entry manually using {{Pkg|efibootmgr}}:
 +
 
 +
# efibootmgr -c -d /dev/sdX -p Y -l "\EFI\systemd\systemd-bootx64.efi" -L "Linux Boot Manager"
 +
 
 +
where {{ic|/dev/sdXY}} is the [[EFI System Partition]].
 +
 
 +
{{Note|The path to the EFI image must use the backslash ({{ic|\}}) as the separator}}
 +
 
 +
=== Menu does not appear after Windows upgrade ===
 +
 
 +
See [[UEFI#Windows changes boot order]].
  
If {{ic|gummiboot install}} command failed you can create a EFI boot entry manually with {{ic|efibootmgr}} utility:
+
== See also ==
  
# efibootmgr -c -w -d /dev/sdX -p Y -l '\EFI\gummiboot\gummibootx64.efi' -L "Gummiboot"
+
* http://www.freedesktop.org/wiki/Software/systemd/systemd-boot/

Latest revision as of 20:45, 21 January 2018

systemd-boot, previously called gummiboot, is a simple UEFI boot manager which executes configured EFI images. The default entry is selected by a configured pattern (glob) or an on-screen menu. It is included with systemd, which is installed on Arch system by default.

It is simple to configure but it can only start EFI executables such as the Linux kernel EFISTUB, UEFI Shell, GRUB, the Windows Boot Manager.

Installation

EFI boot

  1. Make sure you are booted in UEFI mode.
  2. Verify your EFI variables are accessible.
  3. Mount your EFI System Partition (ESP) properly. esp is used to denote the mountpoint in this article.
    Note: systemd-boot cannot load EFI binaries from other partitions. It is therefore recommended to mount your ESP to /boot. In case you want to separate /boot from the ESP see #Manually for more information.
  4. If the ESP is not mounted at /boot, then copy your kernel and initramfs onto that ESP.
    Note: For a way to automatically keep the kernel updated on the ESP, have a look at EFI System Partition#Using systemd for some systemd units that can be adapted. If your EFI System Partition is using automount, you may need to add vfat to a file in /etc/modules-load.d/ to ensure the current running kernel has the vfat module loaded at boot, before any kernel update happens that could replace the module for the currently running version making the mounting of /boot/efi impossible until reboot.
  5. Type the following command to install systemd-boot:
    # bootctl --path=esp install
    It will copy the systemd-boot binary to your EFI System Partition (esp/EFI/systemd/systemd-bootx64.efi and esp/EFI/Boot/BOOTX64.EFI – both of which are identical – on x86-64 systems) and add systemd-boot itself as the default EFI application (default boot entry) loaded by the EFI Boot Manager.
  6. Finally you must configure the boot loader to function properly.

BIOS boot

Warning: This is not recommended.

You can successfully install systemd-boot if booted with in BIOS mode. However, this process requires you to tell firmware to launch systemd-boot's EFI file at boot, usually via two ways:

  • you have a working EFI Shell somewhere else.
  • your firmware interface provides a way of properly setting the EFI file that needs to be loaded at boot time.

If you can do it, the installation is easier: go into your EFI Shell or your firmware configuration interface and change your machine's default EFI file to esp/EFI/systemd/systemd-bootx64.efi ( or systemd-bootia32.efi depending if your system firmware is 32 bit).

Note: the firmware interface of Dell Latitude series provides everything you need to setup EFI boot but the EFI Shell won't be able to write to the computer's ROM.

Updating

Unlike the previous separate gummiboot package, which updated automatically on a new package release with a post_install script, updates of new systemd-boot versions must now be done manually by the user. However the procedure can be automated using pacman hooks.

Manually

systemd-boot (bootctl(1)) assumes that your EFI System Partition is mounted on /boot.

# bootctl update

If the ESP is not mounted on /boot, the --path= option can pass it. For example:

# bootctl --path=esp update
Note: This is also the command to use when migrating from gummiboot, before removing that package. If that package has already been removed, however, run bootctl --path=esp install.

Automatically

The AUR package systemd-boot-pacman-hookAUR provides a Pacman hook to automate the update process. Installing the package will add a hook which will be executed every time the systemd package is upgraded.

Alternatively, place the following pacman hook in the /etc/pacman.d/hooks/ directory:

/etc/pacman.d/hooks/systemd-boot.hook
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd

[Action]
Description = Updating systemd-boot...
When = PostTransaction
Exec = /usr/bin/bootctl update

Configuration

Basic configuration

The basic configuration is stored in esp/loader/loader.conf file and it is composed by three 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 on Space key (or most other keys actually work too) press during boot.
  • editor – whether to enable the kernel parameters editor or not. 1 (default) is enabled, 0 is disabled; since the user can add init=/bin/bash to bypass root password and gain root access, it is strongly recommended to set this option to 0.

Example:

esp/loader/loader.conf
default  arch
timeout  4
editor   0
Note: The first 2 options can be changed in the boot menu itself and changes will be stored as EFI variables.
Tip: A basic configuration file example is located at /usr/share/systemd/bootctl/loader.conf.

Adding boot entries

Note:
  • bootctl will automatically check for "Windows Boot Manager" (\EFI\Microsoft\Boot\Bootmgfw.efi), "EFI Shell" (\shellx64.efi) and "EFI Default Loader" (\EFI\Boot\bootx64.efi) at boot time, as well as specially prepared kernel files found in \EFI\Linux. When detected, corresponding entries with titles auto-windows, auto-efi-shell and auto-efi-default, respectively, will be automatically generated. These entries do not require manual loader configuration. However, it does not auto-detect other EFI applications (unlike rEFInd), so for booting the Linux kernel, manual configuration entries must be created.
  • If you dual-boot Windows, it is strongly recommended to disable its default Fast Start-Up option.
  • Remember to load the intel microcode with initrd if applicable.
  • You can find the PARTUUID for your root partition with the command blkid -s PARTUUID -o value /dev/sdxY, where x is the device letter and Y is the partition number. This is required only for your root partition, not esp.

bootctl 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 or kernel parameters. 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.

Tip: The available boot entries which have been configured can be listed with the command bootctl list.

An example entry file is located at /usr/share/systemd/bootctl/arch.conf. The kernel parameters for scenarios such as LVM, LUKS or dm-crypt can be found on the relevant pages.

EFI Shells or other EFI apps

In case you installed EFI shells and other EFI application into the ESP, you can use the following snippets:

esp/loader/entries/uefi-shell-v1-x86_64.conf
title  UEFI Shell x86_64 v1
efi    /EFI/shellx64_v1.efi
esp/loader/entries/uefi-shell-v2-x86_64.conf
title  UEFI Shell x86_64 v2
efi    /EFI/shellx64_v2.efi

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Add example on how to boot into EFI firmware setup. (Discuss in Talk:Systemd-boot#)

Preparing kernels for EFI\Linux

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Does not belong here, not specific to systemd-boot. (Discuss in Talk:Systemd-boot#)

EFI\Linux is searched for specially prepared kernel files, which bundle the kernel, the initrd, the kernel command line and /etc/os-release into one file. This file can be easily signed for secure boot.

Note: systemd-boot requires that the os-release file contain either VERSION_ID or BUILD_ID to generate an ID and automatically add the entry, which the Arch os-release does not. Either maintain your own copy with one of them, or make your bundling script generate it automatically.

Put the kernel command line you want to use in a file, and create the bundle file like this:

Kernel packaging command:
objcopy \
    --add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \
    --add-section .cmdline="kernel-command-line.txt" --change-section-vma .cmdline=0x30000 \
    --add-section .linux="vmlinuz-file" --change-section-vma .linux=0x40000 \
    --add-section .initrd="initrd-file" --change-section-vma .initrd=0x3000000 \
    "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "linux.efi"

Optionally sign linux.efi now (e.g. using sbsigntools from AUR).

Copying linux.efi into esp\EFI\Linux.

Support hibernation

See Suspend and hibernate.

Kernel parameters editor with password protection

Alternatively you can install systemd-boot-passwordAUR which supports password basic configuration option. Use sbpctl generate to generate a value for this option.

Install systemd-boot-password with the following command:

# sbpctl install esp

With enabled editor you will be prompted for your password before you can edit kernel parameters.

Keys inside the boot menu

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. It has no effect if the editor config option is set to 0.
  • 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 the bootctl install command failed, you can create a EFI boot entry manually using efibootmgr:

# efibootmgr -c -d /dev/sdX -p Y -l "\EFI\systemd\systemd-bootx64.efi" -L "Linux Boot Manager"

where /dev/sdXY is the EFI System Partition.

Note: The path to the EFI image must use the backslash (\) as the separator

Menu does not appear after Windows upgrade

See UEFI#Windows changes boot order.

See also