Convert to systemd-boot with dracut?

I was really glad to see systemd-boot became the default in Cassini.
Currently, I am on BTRFS, Grub, dracut, LTS. KDE Plasma, BTRFS.
I have BTRFS Assistant and snapper installed.

Trying to “follow” the development of EndeavourOS I am thinking of converting to systemd-boot.

I understand if I converted to systemd-boot I will have a menu with a few options to boot to.
What options exactly? Would I have the main two options:

  • Linux
  • linux-lts
    (just in case something breaks I will have another kernel)
    Snapshots will still be working? Is there a way to recover/restore from snapshots?
    I will still be enjoying the main features of BTRFS?
    What is the best way to convert given that I just changed to dracut.

Any special precautions or advice before I do [Tutorial] Convert to systemd-boot ?

Sorry for lots of questions.
Just for my own reference some previous posts/threads:

Not to point out the obvious, but you already did this once and decided to go back to grub because you lost the ability to boot off snapshots and easily restore them.

It isn’t going to be any different with dracut.

Why not just stay on grub?

3 Likes

Well @dalto I know I seem to be naughty and problematic.
The main point is that Cassidy defaults to systemd-boot. If I am doing a fresh install I would follow the defaults but will select BTRFS anyway.

As the developers (whom I trust give us the best) selected systemd-boot as the default, and it was being thought before to move away from Grub, and for me just to follow the “development” going on with EndeavourOS.

So, I feel comfortable now converting to systemd-boot, actually I feel I should.

To summarize:

  • to follow the best thing the developers I trust chose.
  • to be following the development going on.
  • I think boot time with dracut should be much faster than Grub.
  • it is simpler and more stable.

“default” in this case just means that if you just click next, that is what you will get.

grub is still being offered in the installer.

The installer specifically recommends using grub if you want to boot off of snapshots.

Given the stability and no “serious” need to boot from snapshots it is OK, I can give it up, especially if I can have an option to boot from LTS, Linux, and thinking of trying the zen kernel as well. (would I have the three kernels as boot options in systemd-boot?)

Yes, but make sure your ESP is big enough to hold three of them.

I have lot of SSD I believe!
How to be sure and is it really worth it to install zen? I just thought of it for two reasons:

  • to have a third boot option in case things break (alternative to snapshots, sort of)
  • I read it is much faster performance. Though not a main issue actually.

Yes but how large is your ESP(EFI partition)?

Totally up to you. It is easy to install and uninstall so try it out and then decide later. It isn’t a long-term commitment.

ust read performance boost is negligible. So I would better stick to the defaults I have, Linux and LTS. I think those would be enough and safe.
P.S.
I noticed that @Whettingstone at Install dracut? is thinking the same as I am thinking and for the same reasons.
Mainly the developers defaulted to it.

Well, in hope it will be of any help for others, here I am recording exactly what I am doing to convert to sytemd-boot according to [Tutorial] Convert to systemd-boot and my post there (the steps I did then).
1- updating and rebooting! (Done)
2- sudo pacman -Rc grub
3- sudo mkdir /efi
4- efidevice=$(findmnt /boot/efi -no SOURCE) # save the efi partition location
5- sudo umount /boot/efi
6- sudo mount ${efidevice} /efi
7- To make the mount change permanent, edit /etc/fstab and change where it reads /boot/efi to /efi
8- sudo bootctl install

[limo@asus ~]$ sudo bootctl install
Created "/efi/EFI/systemd".
Created "/efi/loader".
Created "/efi/loader/entries".
Created "/efi/EFI/Linux".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/efi/EFI/BOOT/BOOTX64.EFI".
Random seed file /efi/loader/random-seed successfully written (32 bytes).
Successfully initialized system token in EFI variable with 32 bytes.
Created EFI boot entry "Linux Boot Manager".
[limo@asus ~]$ 

9- sudo pacman -S kernel-install-for-dracut and typed “y” to uninstall kernel-install-for-dracut and eos-dracut are in conflict. Remove eos-dracut? [y/N] y
10- Created the scrypt I called dalto.sh

#!/usr/bin/env bash

# Find the configured esp
esp=$(bootctl -p)

# Prepare the efi partition for kernel-install
machineid=$(cat /etc/machine-id)
if [[ ${machineid} ]]; then
    mkdir ${esp}/${machineid}
else
    echo "Failed to get the machine ID"
fi

# Run kernel install for all the installed kernels
while read -r kernel; do
    kernelversion=$(basename "${kernel%/vmlinuz}")
    echo "Installing kernel ${kernelversion}"
    kernel-install add ${kernelversion} ${kernel}
done < <(find /usr/lib/modules -maxdepth 2 -type f -name vmlinuz)

11- sudo bash dalto.sh
12- sudo rm -r /boot/efi /boot/grub /boot/initramfs* /boot/vmlinuz*

Rebooting… hopefully I will be back soon… alive!
Rebooted in 9.061s :partying_face: :tada: :partying_face:VS.

:heart_eyes: :partying_face: :tada: :heart_eyes: :partying_face: :tada:

Please note the following posts.
You should uncomment time out in

sudo nano /efi/loader/loader.conf

Thanks to feedback from @anthony93 and @pebcak
UPDATE:
Rebooted to
[limo@asus ~]$ inxi -Fxxx
System:
Host: asus Kernel: 5.15.85-1-lts arch: x86_64

But, I guess I missed or messed something.
The system boots directly, not actually seeing the systemd-boot menu! (rebooted a few times)
What does this mean?
How can I get the systemd-boot menu?

Did you uncomment timeout in your loader/loader.conf? You have to uncomment the timeout line and change the timeout duration to the duration you want.

I did

sudo nano loader/loader.conf

I got an empty file!

So, it seems this time (following the links above) I missed and messed something.
I will read again and try to figure out!

You could bring it up by pressing Esc while (re-)booting.

Also,

Shouldn’t it be:

sudo nano /efi/loader/loader.conf

?

2 Likes

Not this file…

It’s this file: /efi/loader/loader.conf

Uncomment the timeout line in this file.

Exactly.

Done!
it was

sudo nano /efi/loader/loader.conf

and I uncommented the time out.
Rebooted… and WOW. Working as expected! :partying_face: :tada: :heart_eyes:
As I always do. it was me who messed and missed things.

When I mentioned loader/loader.conf, I sort of assumed that you were still inside the /efi/ directory. So, my bad.

You got an empty file because you tried to open a loader/loader.conf file from a working directory that doesn’t contain that file. So nano creates an empty buffer.

1 Like

I am actually feeling great.
Now it is like I did a fresh Cassini install.
I believe now it is safe, no matter what happens to any kernel I have 2 boot options for each of ‘Linux’ and “LTS” the fall back.
On BTRFS, BTRFS Assistant, Snapper… etc… I can boot to any of the 4 options and restore a previous snapshot.
I hope I am getting it right.

A wonderful distro, a wonderful community, and wonderful developers.
Keep up the great work.
:tada: :partying_face: :heart_eyes: :+1: :heart_eyes: :tada: :partying_face: