[Tutorial] Convert to systemd-boot

Update:

problem was with the hdmi connection. When i switched to the display port (over usb-c) and run envycontrol to activate the nvidia card then the laptop boots into xfce. After that also nvidia-settings shows what it needs to show. Furthermore need to adjust the panel to the correct display (eDP in my case (laptop screen) and all is good to go …again.

Rebooting the laptop now keeps all settings and runs back on the nvidia dgpu.

Long search to get this going again but it worked!!

1 Like

I’ve read the guide but I am not sure if I can install this because I can verify properly if I have the correct efi partition. As per the image, would I be able to convert to systemd-boot:

image

Apologies for asking but the don’t want do something to my system that make me reinstall the os.
Thank you for your help and guidance.

It depends on:

  • How much free space you have in the EFI partition now
  • How may kernels you intend to install
  • If you are willing to enlarge the EFI partition
1 Like

Thank you for the response and the points raised. I am not confident enough to do this and will leave my system be.

What is the state of BTRFS snapshots with systemd-boot???

It depends how you use snapshots. There is no issue with taking snapshots with systemd-boot. I use btrfs with systemd-boot regularly.

The issues are:

  • There is not an easy way to directly boot off a snapshot
  • If you restore a snapshot of your root filesystem, you may need to fix the mismatch between the kernel modules and the kernel/initrams if the version has changed between snapshots.
1 Like

You mean by that to just run your script for installing kernels, or use pacman to install it ?
Boot into liveusb and restore a snapshot, and after that? arch-chroot and run your script ?

There are actually a number of ways to resolve the issue.

Re-running kernel-install from a chroot for all your kernels(which is I think what you mean) is one easy way that would work.

2 Likes

Dalto, I followed these steps (for testing purposes): I’m using the dracut mode.

  • Boot to live USB
  • Update mirrors through Welcome app (optional)
CLI
# pacman -Syy (optional)
# pacman -S snapper boost-libs
$ yay -S btrfs-assistant
# mount /dev/sda2 /mnt -o subvolid=5
# cp /mnt/@/etc/snapper/configs/* /etc/snapper/configs
# cp /mnt/@/etc/conf.d/snapper /etc/conf.d/snapper

Then, open btrfs-assistant and restore the snapshot

archchroot and kernel-install
# umount /mnt
# mount -o subvol=@ /dev/sda2 /mnt
# mount /dev/sda1 /mnt/efi
# arch-chroot /mnt
# kernel-install2 #this is the bottom part of Dalto's script, copied to /usr/bin with +x attribute.
exit

It worked, however as we can see in the image below, my boot entries are showing both kernel versions:

Systemd boot entries

image

Fixed my boot entries like this:
cd /efi/91192e68b46945dba4aad45cee594025/
sudo rm -rf 5.19.12-arch1-1
sudo rm -rf 5.19.12-zen1-1-zen/
cd ../loader/entries
sudo rm 91192e68b46945dba4aad45cee594025-5.19.12-arch1-1.conf
sudo rm 91192e68b46945dba4aad45cee594025-5.19.12-zen1-1-zen.conf
sudo kernel-install2 #this is the bottom part of Dalto's script, copied to /usr/bin with +x attribute.

Really thanks :slight_smile: Now I can restore everything in case of a boot problem, using btrfs with dracut.

1 Like

The reason for the duplication is that since those kernels were never uninstalled. kernel-install remove was never run to do the cleanup.

It would be pretty easy to write a script to do that in an automated way.

You would just need the machine id which is in /etc and the argument to pass to kernel-install remove would be the directory names under /etc/<machine-id>.

Of course, it is also pretty easy to do manually as you discovered.

1 Like

Hi @dalto
Thanks for making this tutorial. I have a quick question and I have attempted to search for the answer here and on the forum prior (maybe my keywords were off, apologies if this was answered and I missed it).
Is it possible to do this during initial install of EndeavourOS Nova using this somehow: https://discovery.endeavouros.com/installation/customizing-the-endeavouros-install-process/2022/03/

It would be difficult to do so. At the moment, it would be much easier to do it post install.

Okay, I understand. Thank you. Will do post install.

1 Like

Hey and thank you for the tutorial!
I don’t know if anyone has said it before but systemd-boot is severly faster in decrypting my LUKS partition than grub. So there is a major advantage in using systemd-boot if you will. :wink:

I do not see what is the major advantage.

The kernel resides outside of the LUKS partition, that is why you notice that the kernel decrypts the LUKS partition faster than Grub works alone.

But Grub supports full encryption including any kernels except Grub bootloader by default via Calamares installer. System-boot does not.

If Grub doesn’t need to decrypt any kernel that is outside LUKS partition, you won’t notice speed difference between grub and system boot.

3 Likes

Next kernel release (6.0.1.arch2-1) may not match your /efi/loader/loader.conf.

image

Something like this would work?

default 91192e68b46945dba4aad45cee594025*-arch?-?.conf

It looks like it matches?

Yes, but not like it was before, I mean, *-arch1-?.conf wouldn’t match.
So I changed to *arch?-?.conf, I suppose its going to work.

1 Like

Great work, thanks.

Just two questions:

  1. what about BTRFS?
  2. And btrfs + timeshift?

As far as I know, I’m afraid the answer is negative, but I’m pretty new to this.

Thanks in advance,
Piero

Works fine with btrfs.

There is not an easy way to boot off a snapshot if that is important to you.

If you restore a snapshot, you need to chroot in and re-run kernel-install so that is more work.

1 Like