# Manjaro with systemd-boot (sd-boot)

This article describes how to remove the grub boot manager and use systemd-boot as boot loader/manager on an (U)EFI system with Manjaro being the only operating system installed.

Usually, the ArchWiki is a very good source of information, when it comes to Linux in general and Manjaro in particular, since it is based on Arch. Unfortunately in this case, the approach is not exactly the same as with Arch, since Manjaro handles the Linux boot images a little bit differently.

## Requirements

• Your system needs to support (U)EFI and the system needs to be installed in EFI-Mode. On the running system, the path /sys/firmware/efi should exists.
• The file system table of the SSD or HDD, containing the EFI system partition (ESP), needs to be GPT.
• The ESP should currently be mounted to /boot/efi, since this is the default when installing Manjaro on an (U)EFI system. Check this with cat /etc/fstab or mount.
• The EFI System Partition (ESP) need to be large enough, to hold the currently installed kernel images. Check the actual size with du -sh /boot. Maybe you want to clean up the installed kernels first. I usually have the latest LTS kernel and the latest stable kernel installed. My ESP is 200 MiB, which works fine with that. For a new ESP I would recommend 512 MiB, just to be on the safe side.

## Basic procedure overview

• Identify the ESP and its size on your SSD/HDD.
• Change the mount point of the ESP from /boot/efi to /boot.
• Update /etc/fstab.
• Install systemd-boot into the ESP.
• Install the systemd-boot-manager (sdboot-manage).
• Generate boot menu entries, depending on the kernels installed.
• Uninstall and remove grub.
• Reboot.

## Create backup boot media

Create a bootable USB-drive or disc, ideally made from the latest Manjaro image. So if anything goes wrong, you still can boot from the external drive and fix the issue. Everything should work fine without any data loss, but in any case, always make sure to backup your data first!

## Change the mount point of the ESP

Since systemd-boot only supports FAT file systems, it is not possible to put the kernel images on a ext2/3/4 volume or any other file system, for that matter. The easiest and most of the time recommended way, is to simply point the /boot mount point directly to the ESP partition, which is formatted with FAT16 or FAT32 anyway.

The ESP was created during the Manjaro installation and is usually the first partition of the first drive (SSD or HDD). Use fdisk, gdisk or lsblk to find out which partition it is exactly.

$lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT [...] sda 8:0 0 931,5G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 80G 0 part / └─sda3 8:3 0 851G 0 part /home sdb 8:16 0 3,6T 0 disk ├─sdb1 8:17 0 3,6T 0 part /data └─sdb2 8:18 0 4G 0 part [SWAP] sr0 11:0 1 1024M 0 rom sr1 11:1 1 44,6G 0 rom In this case it’s /dev/sda1, which is still mounted to /boot/efi. The existing /boot folder and its contents are usually part of your root file system (“/“). The content of the /boot folder needs to be copied to the ESP’s root directory. The files can then be deleted from the root file system’s /boot folder (since it will be hidden by the new mount point anyway). $ sudo su
# umount /boot/efi
# rmdir /boot/efi
# mkdir -p /tmp/bootdir
# cp -r /boot/* /tmp/bootdir/
# rm -rf /boot/*
# mount /dev/sda1 /boot
# cp -r /tmp/bootdir/* /boot/
# rm -rf /tmp/bootdir
# exit

## Install systemd-boot

systemd-boot comes with the systemd package, which means, that it is already present on the system. Install its files to the ESP with

$sudo bootctl install This will create/copy multiple directories and files into the /boot / ESP partition, like configuration files and also create a new entry in the EFI boot menu of your machine (and also set it as the first entry in the boot order list). You can check this with efibootmgr -v. Depending on the actual system, there maybe only a few entries or a whole bunch of them. You can remove entries with efibootmgr -b <4-digit-number> -B, like for past OS installations, long gone, but still present in this menu. If in doubt, keep it as it is! ## Configuration Usually, one would now edit the /boot/loader/loader.conf file and create the different loader configuration files in the /boot/loader/entries folder, like it is described in detail in the ArchWiki article about systemd-boot. These entries would then point to the different Linux boot images, stored in the /boot folder. But since Manjaro uses version numbers in the names of the images, these boot menu entries would need to be changed every time a kernel gets installed, upgraded or removed. Fortunately, there is already a very convenient tool in the package repository, that handles the automatic generation or deletion of these entries. It also adds the CPU microcode images automatically, if they are installed and updates sd-boot automatically, when a new systemd version is installed. So let’s install the “systemd-boot Manager for Manjaro” first. Please don’t get confused here! This is actually a manager for the systemd-boot manager, as mentioned above, systemd-boot itself is already installed. $ sudo pacman -S systemd-boot-manager

After the installation finishes, check out the manager’s configuration file /etc/sdboot-manage.conf and change the options as you prefer.
If unsure, simply keep the file as it is, for now.

After that, generate the menu entries with this command:

$sudo sdboot-manage gen To make sure everything worked, check the /boot/loader/entries folder for the generated files. $ ls -l /boot/loader/entries/

There should be two files for every kernel version installed.

## Removing grub

Simply use pacman,

$sudo pacman -Rn grub$ sudo rm -rf /boot/grub

to remove grub and the grub folder in /boot.

## Reboot

Now hold on to your bootable USB-drive and hope that you don’t need it. Restart your system.

If everything worked, the system should startup normally.

If you get a message like

No loader found. Configuration files in \loader\entries\*.conf are needed.

note, that this is a pretty generic error message, that even shows, when the files in entries/ are actually found, but something inside of them produces an error. Since sdboot-manage creates these entries for you, this shouldn’t happen. If it does, use the boot media creates previously, mount the system and ESP partition and check again, using the description above. Are the Linux image files with the exact names actually present?

If you don’t get even the message above, try to check if the UEFI is selecting the right boot entry? Use efibootmgr -v to check the path of the actual boot loader (and if it exists in the file system) and the name of the menu entry. Try to select this entry manually on startup (some systems use the F11 or F12 key for this menu).

### 3 Replies to “Manjaro with systemd-boot (sd-boot)”

1. Indira D'Souza says:

Thank you. Followed your guide and now successfully running it without any problems.
One thing, sudo systemd-boot install didn’t work.
But #bootctl install did.
Great article, helped this noob out a lot.

1. cf says:

Thank you for your comment! The command was indeed wrong and I’ve corrected it — thanks again!

2. Fernando says:

Thanks! I had troubles with “sdboot-manage gen” don’t recognizing the kernel image from /boot because it was on /boot/efi, and didn’t know if it was a good idea to move the ESP partition to /boot. Now everything works!