Difference between revisions of "Systemd-boot"

From ArchWiki
Jump to: navigation, search
(Adding boot entries)
m (Adding boot entries: Add note)
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
== Installing ==
 
== Installing ==
{{Note|gummiboot 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|gummiboot --path /boot/efi update}} after every package update. It is therefore strongly recommended to mount your ESP to {{ic|/boot}} if you use gummiboot.}}
+
{{Note|gummiboot 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|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}}.}}
  
 
Install {{Pkg|gummiboot}} from [extra] and run the following to install gummiboot:
 
Install {{Pkg|gummiboot}} from [extra] and run the following to install gummiboot:
 
  # gummiboot install
 
  # gummiboot install
This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. However, creating the boot entry requires that you are already running in EFI mode and are running kernel 3.8 which is currently still in [testing]. If you are still running kernel 3.7 or have not booted in EFI mode, 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 installing process only has to be done once, updating will happen automatically as long as your ESP is mounted on {{ic|/boot}}.
+
This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. However, creating the boot entry requires that you are already running in EFI mode and are running kernel 3.8. If you are still running kernel 3.7 or have not booted in EFI mode, 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 installing process only has to be done once, updating will happen automatically.
  
 
== Configuring ==
 
== Configuring ==
  
The basic configuration is kept in {{ic|$esp/loader/loader.conf}}, with just two possible configuration options:
+
The basic configuration is kept in {{ic|/boot/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 19: Line 19:
 
Example:
 
Example:
  
{{hc|$esp/loader/loader.conf|
+
{{hc|/boot/loader/loader.conf|
 
default  arch
 
default  arch
 
timeout  4
 
timeout  4
Line 27: Line 27:
  
 
== Adding boot entries ==
 
== Adding boot entries ==
 
+
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:
{{note|If you have separate partitions for {{ic|/boot}} and {{ic|/boot/efi}}, you '''must''' copy the kernel and initramfs to the EFI partition. Gummiboot does not support loading kernels from other partitions than itself. See [[UEFI_Bootloaders#Sync_EFISTUB_Kernel]] on how to automate this copy.
+
}}
+
 
+
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 37: Line 33:
 
* {{ic|version}} – kernel version, shown only when multiple entries with same title exist. Optional.
 
* {{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+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; 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|/boot}}); 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 47: Line 43:
 
An example entry for Arch Linux:
 
An example entry for Arch Linux:
  
{{hc|$esp/loader/entries/arch.conf|2=
+
{{hc|/boot/loader/entries/arch.conf|2=
 
title          Arch Linux
 
title          Arch Linux
 
linux          /vmlinuz-linux
 
linux          /vmlinuz-linux
Line 54: Line 50:
 
}}
 
}}
  
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}}. 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.
+
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}}.  
 +
 
 +
{{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.}}
  
 
== Inside the boot menu ==
 
== Inside the boot menu ==

Revision as of 06:09, 19 March 2013

Gummiboot is a UEFI boot manager 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.

Installing

Note: gummiboot assumes that your EFI System Partition is mounted on /boot. If your ESP is mounted on /boot/efi you have to call the following gummiboot install command with the additional --path switch. This also means that gummiboot will not be able to update itself automatically and you will have to call 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 /boot if you use gummiboot. The rest of this article will assume that your ESP is mounted on /boot.

Install gummiboot from [extra] and run the following to install gummiboot:

# gummiboot install

This will automatically copy the gummiboot binary to your EFI System Partition and create a boot entry in the EFI Boot Manager. However, creating the boot entry requires that you are already running in EFI mode and are running kernel 3.8. If you are still running kernel 3.7 or have not booted in EFI mode, 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 (/boot/EFI/BOOT/BOOTX64.EFI on x64 systems). Note that the installing process only has to be done once, updating will happen automatically.

Configuring

The basic configuration is kept in /boot/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:

/boot/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.

Adding boot entries

Gummiboot searches for boot menu items in /boot/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 (/boot); 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:

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

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

Note: Gummiboot will automatically check for binaries of a Windows Installation (\EFI\Microsoft\Boot\Bootmgfw.efi) or an UEFI Shell (\shellx64.efi) and display entries for them, so you don't have to create these manually.

Inside the boot menu

TODO: document keybindings from http://freedesktop.org/wiki/Software/gummiboot

Troubleshooting

Transferring to new HDD causes breakage

Twice now I have transferred my installation from one disk to another, ESP included, and both times this broke my gummiboot setup. With a lot of trial and error, I have discovered that gummiboot does not like configuration files that have been tranfserred from one disk to another (I used rsync).

To solve this, delete the $ESP/loader directory and all of its contents, and recreate the necessary configuration files.

Though it has no additional info, here is my relevent forum thread.