Systemd-boot install on Fedora 32 (Updated for Fedora 39) - kowalski7cc

Systemd-boot install on Fedora 32 (Updated for Fedora 39)

Systemd logo
Systemd logo

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 39

If you're planning to install Fedora 39, you can directly configure anaconda to use systemd-boot as bootloader, adding the following argument in the boot command line:

inst.sdboot

you can check the details on the Fedora 39 documentation and the Change on the Fedora Wiki.

This still not covers booting with secure boot enabled, you will need to enroll your own keys. You can use a tool like sbctl to do that.

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*}

install systemd-boot and then uninstall GRUB related packages.

sudo dnf remove -y grubby grub2\* memtest86\* && sudo rm -rf /boot/grub2 && sudo rm -rf /boot/loader
sudo dnf install -y systemd-boot-unsigned sdubby

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

If everyting installs correcry, now you can reboot, and you should boot normally using systemd-boot

You can verify everything working correctly with

sudo bootctl

Enjoy systemd-boot!

systemd-boot running inside GNOME Boxes
systemd-boot running inside GNOME Boxes

Sources

Thanks to all these people for their guides and tips: