Use systemd-boot instead of grub in Arch Linux

Use systemd-boot instead of grub in Arch Linux

Several years ago, I tried to install Arch Linux on my new desktop. I follwed the instructions from Arch Linux - Install Guide. Everything was going smoothly, until I went on installing boot loader.

For the most people, when it comes to installing boot loader, they would choose grub, since most of them are using Ubuntu, and Ubuntu choose grub as their default boot loader. Yes grub is way more familiar than any other boot loader to them, but I just can’t get grub working on my desktop, no matter what.

I was frustrated, so I went on finding other boot loader, and I saw a video Archlinux install in less than 10 minutes on a UEFI system. The man in the video chose to use systemd-boot as the boot loader, not grub, and he successfully installed the boot loader easily.

Till this day, when I install Arch Linux on my new computer, I still use systemd-boot, not grub.

So how to install systemd-boot?

Make sure you run these command in your newly installed environment. Put it simply, run these command after you arch-chroot into the system
First, run as root

1
bootctl install

This command will automatically install loader into /boot folder.

Then, cd /boot and you should see folders EFI and loader
The configuration file we need is in the folder loader, and it’s loader.conf, open it, and you should see something like…

1
2
3
#timeout 3
#console-mode keep
#default c76bcee0030c4d5685874ef9ebb27232-*

These are default values. You want to create your own settings, for example, if I want to choose my default boot option to arch, and set timeout to 4 seconds, then I will need to add these lines

1
2
default arch
timeout 4

Now you are going to create boot loader entries. Notice the folder entries in the loader folder? That’s the folder boot loader entries go to.

Enter the folder, and create arch.conf

A boot loader entry conf would look like this

1
2
3
4
5
title  Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=PARTUUID=<PARTUUID> rw

The linux line would load Linux Kernel into your computer, so your computer can continue booting process, then initrd line is to load some basic files into your RAM, so your computer can have files to perform boot process.

The intel-ucode line is to load Intel microcode updates into your system, it requires the package intel-ucode, for AMD users, the package is amd-ucode, and I think the file is amd-ucode.

The last line options is to tell boot loader where your /(root) is, you need to pass PARTUUID to the root param. For vim users, you can run !r blkid to get UUID information about partitions in your computer. Use this line to find correct PARTUUID, and fill it into <PARTUUID> line.

After these steps, your computer should now be able to boot using systemd-boot, you may see Linux Boot Manager entry in your BIOS, it’s created by systemd-boot. Use that one to boot, then you should see entries you created.

Enjoy your Arch Linux!