Since many years, GRUB has been the default manager of every Linux distribution. This until systemd-boot has born, allowing easier configuration and promising enhanced security for our devices.
Let's see how to install it on the new Fedora 32 or Fedora 34
Take you responsabilities first
I am not responsible for bricked computers, system instabilities, dead cats, thermonuclear war or you getting fired because you lost important work.
Please make a backup of your device or of the data, and make a boot drive in case of necessity. Do some research if you have any concerns about steps documented in this guide.
YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
Check if you are running EFI
Before doing anything, you should check that you are running using EFI.
To do that, you can use the following one-liner:
test -d /sys/firmware/efi && echo EFI || echo Legacy
If the result of the command will be "EFI", you're good to go with this guide.
Move ESP mount to /efi
First of all, we need to move the ESP partition from /boot/efi
to /efi
Let's start by creating the folder for EFI mount point
sudo mkdir /efi
You can use Vim to edit the fstab
file using this command:
sudo cp /etc/fstab /etc/fstab.bak # (Make a backup first if you are unsure)
sudo vi /etc/fstab
Edit the line by enering in "insert mode" by pressing the "i
" button
UUID=xxxx-xxxx /boot/efi vfat umask=0077,shortname=winnt 0 2
to:
UUID=xxxx-xxxx /efi vfat umask=0077,shortname=winnt 0 2
Press the esc
button, followed by ":wq
"
If you edited correctly you should be able to run successfully the following commands:
sudo umount /boot/efi
sudo mount /efi
Install systemd-boot
The firts step is to create a folder in the ESP directory with the machine-id in the name
sudo mkdir /efi/$(cat /etc/machine-id)
If you have Fedora 34, you need to remove GRUB from DNF's protected packages
sudo rm /etc/dnf/protected.d/{grub*,shim.conf}
and then uninstall GRUB related packages.
sudo dnf remove grubby grub2\* shim\* memtest86\ && sudo rm -rf /boot/grub2 && sudo rm -rf /boot/loader
Do not reboot after this
cat /proc/cmdline | cut -d ' ' -f 2- | sudo tee /etc/kernel/cmdline
sudo bootctl install
sudo kernel-install add $(uname -r) /lib/modules/$(uname -r)/vmlinuz
sudo dnf reinstall kernel-core
Now you can reboot, and you should boot normally using systemd-boot
You can verify everything working correctly with
sudo bootctl
Enjoy systemd-boot!
Sources
Thanks to all these people for their guides and tips: