[Tutorial] Convert to systemd-boot

The entire kernel package doesn’t end up in the ESP. Only the kernel itself, vmlinuz. The bigger issue is the initrd images which are variable in size. 300MB should be fine for two kernels and will probably be fine for 3 kernels depending how big your initrams are.

For reference, I currently have 2 Arch kernels and 6 Fedora kernels and I am using 567M in my ESP. My 2 Arch kernels are taking up 121M of that.

1 Like

How do I find this out exactly?

ls -lh /boot

How’s this look to you?

[scott@EndeavourOS ~]$ ls -lh /boot
total 162M
drwxr-xr-x 3 root root 4.0K Dec 31  1969 efi
drwxr-xr-x 1 root root   84 Aug 27 16:34 grub
-rw------- 1 root root  34M Aug 26 18:06 initramfs-linux-fallback.img
-rw------- 1 root root 8.7M Aug 26 18:06 initramfs-linux.img
-rw------- 1 root root  32M Aug 26 08:16 initramfs-linux-lts-fallback.img
-rw------- 1 root root 8.6M Aug 26 08:15 initramfs-linux-lts.img
-rw------- 1 root root  35M Aug 26 18:06 initramfs-linux-zen-fallback.img
-rw------- 1 root root 8.8M Aug 26 18:06 initramfs-linux-zen.img
-rw-r--r-- 1 root root 5.0M Aug  9 14:43 intel-ucode.img
-rw-r--r-- 1 root root  11M Aug 26 18:06 vmlinuz-linux
-rw-r--r-- 1 root root  11M Aug 26 08:15 vmlinuz-linux-lts
-rw-r--r-- 1 root root  12M Aug 26 18:06 vmlinuz-linux-zen
[scott@EndeavourOS ~]$ 

It looks like each kernel would use about ~60MB right now.

Basically vmlinuz+initramfs+initramfs-fallback+ucode

1 Like

Agree. Here on my system

55   MB	104fd36f1a224baaac5ecfcdf5c204d7/5.15.63-1-lts
59   MB	104fd36f1a224baaac5ecfcdf5c204d7/5.19.4-arch1-1
60   MB	104fd36f1a224baaac5ecfcdf5c204d7/5.19.4-zen1-1-zen
175  MB	104fd36f1a224baaac5ecfcdf5c204d7/
1 Like

Strange that snapshots booting only works with Grub. I tried converting from grub to systemd-boot in a VM over the weekend. The configuration is nice and simple.

This guide worked a treat, zero issues following the guide, thanks!

also systemd-boot feels a bit faster

1 Like

I had the same errors. The issue is that the preset files in /etc/mkinitcpio.d/ still have the old grub path names in it and mkinitcpio therefor does not find the files.

Solution for me was to simply reinstall all kernels and header files. This creates new preset files with the correct pathes.

EDIT: Just saw that my message is obsolete. This was already answered.

2 Likes

As I was one of the victims… I converted to systemd-boot, because as you said

But as far as I understand rEFInd can boot from snapshots.
I made a thread Converting to rEFInd from sytemd-boot

You can find there what I found on how to get rEFInd up and running.
I hope some user(s) who installed rEFInd can give me feed back, before I just try it and I end up unable to boot!

I’m trying to have it setup so that systemd-boot always boots to the mainline kernel, after reboot and ideally even after new kernel updates as well. I know pressing D during boot will set the default kernel choice, but after the new kernel update today, that setting was cleared out. This is not a huge deal of course to reset the option using D again. But doing that after every kernel update might grow a little tiresome I imagine.

Having said that, I’m looking for a more permanent way to always select the mainline kernel by default, kind of like how on grub you can change GRUB_DEFAULT=X in /etc/default/grub. I’m still new to systemd-boot, but I tried something that was suggested already, but I may not have done it right. Also worth nothing, I did the kernel-install method, I did not setup the manual way.

Here’s what I’ve done in my attempts to set mainline kernel as default boot option:

[scott@EndeavourOS ~]$ ls /efi/loader/entries
5f36d8c0aa64460e9be33539d6a364bd-5.15.63-1-lts.conf
5f36d8c0aa64460e9be33539d6a364bd-5.15.63-1-lts-fallback.conf
5f36d8c0aa64460e9be33539d6a364bd-5.19.5-arch1-1.conf
5f36d8c0aa64460e9be33539d6a364bd-5.19.5-arch1-1-fallback.conf
5f36d8c0aa64460e9be33539d6a364bd-5.19.5-zen1-1-zen.conf
5f36d8c0aa64460e9be33539d6a364bd-5.19.5-zen1-1-zen-fallback.conf

So from my understanding I need to add the kernel I want from this list, with an asterisk * to denote version changes I imagine. So I run sudo nano /efi/loader/loader.conf and inside add the kernel I wanted:

  GNU nano 6.4                 /efi/loader/loader.conf                           
timeout 3
#console-mode keep
5f36d8c0aa64460e9be33539d6a364bd*-arch1-*

I saved the file and rebooted, but it just defaults to the top of my kernel selection at the boot screen which is the zen kernel. Did I do the asterisk part right or am I using the wrong command options for this? Appreciate any help, as I might just be a little blind today. :sweat_smile:

Its missing the default…

$ cat /efi/loader/loader.conf 
default 91192e68b46945dba4aad45cee594025*-arch1-1*
timeout 3
#console-mode keep
2 Likes

I just died a little on the inside! I even read that too, but forgot to put that in, totally my fault. Thanks very much for pointing that out :sweat_smile:

@dalto, to avoid it ever selecting the fallback kernel, how should I change it, if at all?

Edit: I just did a reboot and it works perfectly, it defaults to the mainline kernel and thankfully not the fallback kernel. One nice thing about systemd-boot is I don’t have to rebuild the grub after any edits a make, which makes this nicer to deal with.

2 Likes

That is actually pretty hard with the mainline kernel because of how it is named now that I look at it. You might just have to rely on the sort order.

I wonder if there is documentation anywhere on what it accepts as a “pattern”

EDIT: I found the spec. Try this:

default 5f36d8c0aa64460e9be33539d6a364bd*-arch1-?.conf
3 Likes

I would like to try systemd on multiboot but if i have btrfs does it matter if it’s installed on the btrfs set up or other. :thinking:

This is one thing I like about anarchy as you can install with what ever bootloader you want that is in the choices.

If you want to multi-boot with systemd-boot, the easiest way is to convert them all to systemd-boot. You only need to install it once in that case.

Ok, just tested that and I did a reboot and it was a success, so thank you again!

If I wanted to make the LTS or ZEN kernel the default, would they need something special to look like this then as well?

For LTS loader entries:

5f36d8c0aa64460e9be33539d6a364bd-5.15.63-1-lts.conf
5f36d8c0aa64460e9be33539d6a364bd-5.15.63-1-lts-fallback.conf

which becomes 5f36d8c0aa64460e9be33539d6a364bd*-lts?.conf or no?

For ZEN loader entries:

5f36d8c0aa64460e9be33539d6a364bd-5.19.5-zen1-1-zen.conf
5f36d8c0aa64460e9be33539d6a364bd-5.19.5-zen1-1-zen-fallback.conf

which becomes 5f36d8c0aa64460e9be33539d6a364bd*-zen1-?.conf or no?

No, those are both easy. You don’t need the question mark, just:

default 5f36d8c0aa64460e9be33539d6a364bd*lts.conf

The ? means “any single character”.

2 Likes

so, it will always be arch1-?
arch2-? will never happen?

Awesome thanks for pointing those out and for the assistance yet again. I’ve added these to my “Things to do after install” list that I keep track of since my mind has a habit of memory dumping things from time to time. It’s been quite the little experiment switching over to systemd-boot, but once you learn more about things it feels a lot better, especially with some awesome help :pray:

1 Like