systemd-boot
Overview
Systemd-boot is a simple UEFI boot manager that is part of systemd. It has several advantages over other boot managers:
- It is uncomplicated and uses simple text file which only contain a few lines
- It is less prone to breakage, easy to troubleshoot and doesn’t require any process to rebuild config files
- It allows each Linux install to manage their own configuration files and doesn’t require detection between different installs
EndeavourOS uses kernel-install with systemd-boot to manage the process. This has a few advantages:
- A more modern approach
- Completely automates the process of entry creation and removal
- Safe for multi-booting since it moves your kernels and images to a installation specific subdirectory
Usage
In general, you shouldn’t need to do anything special to manage systemd-boot in our default configuration as everything should be managed automatically. Here are a few tips and trips to help you along the way.
Understanding reinstall-kernels
The script reinstall-kernels
both regenerate the initrds and create/update the boot entries. It works with both dracut and mkinitcpio as long as you have either kernel-install-for-dracut
(The default) or kernel-install-mkinitcpio
(AUR) installed.
How to modify kernel options
In systemd-boot, it is actually quite simple. You edit the appropriate entry file which can be found on your EFI partition in the loader/entries
directory. Each entry is a boot option on the menu and each has a line called options
. You can modify these entries directly, however, these changes may be overwritten when packages are installed or updated.
To make the changes, instead of modifying the entries, modify the file /etc/kernel/cmdline
which is a one-line file containing a list of kernel options. Then run sudo reinstall-kernels
which will populate the entries and regenerate the initrds.
If you would prefer to use the current kernel options from the running system, you can instead rm
the file /etc/kernel/cmdline
and then run sudo reinstall-kernels
.
How to change the default entry to boot
There is a default
entry inside /efi/loader/loader.conf
that determine the default boot entry.
On a new install, it will look something like this:
default 665eca4ae83246df8ec17d1cbc6a1763*
That first string of characters is you entry token which identifies the install. That is important if you are dual-booting with another Linux, otherwise it can be replaced with *
. That line supports wildcards and so if you want to boot the LTS kernel by default you could use something like this:
default 665eca4ae83246df8ec17d1cbc6a1763*lts.conf
Alternatively, if you want to boot the mainline kernel by default, something like this should work:
default 665eca4ae83246df8ec17d1cbc6a1763-*-arch?-?.conf
These changes will take effect on the next reboot and nothing else is required except modifying the file.
More information
There are a few other good sources of information on systemd-boot.
- Not to forget the Arch-Wiki
- Freedesktop with all basic Information on handling and Options
- General info and links can be found also in Wikipedia
- And the Sourcecode git can come in handy too
- man systemd-boot and man loader.conf for all possible options
—
Tips and tricks:
Save last chosen boot entry:
If set to “@saved” the chosen entry will be saved as an EFI variable on every boot and automatically selected the next time the boot loader starts (see here loader.conf ).
This needs to be added to the /efi/loader/loader.conf
like so:
default @saved
timeout 1
console-mode auto
reboot-for-bitlocker 1
General warning: setting default to saved can cause issues in some cases like if you remove a kernel or boot option or on changes to kernel version too. Where it can happen that the first entry will be loaded instead of the last used.
In this case you will need to manually chose your entry again.
Set default boot entry from command:
https://man.archlinux.org/man/bootctl.1.en
sudo bootctl set-default ID
where the ID is the name of the config you can see with: ls /efi/loader/entries
example:
sudo bootctl set-default f3a772fua46a7181a5d46a5n18899796-6.1.38-1-lts.conf
with this you can change default used boot entry in cas eyou want to change to LTS kernel p.e
setting default with the command will be indicated on boot with the little arrow on the choosen entry.