[Tutorial] Convert to systemd-boot

1 Like

thanks for the replies. Will play around in a VM before testing it on my real systems.

when checking the issue that closed that feature request (https://github.com/systemd/systemd/issues/477) , I would assume that simply not providing a default in config would make it boot the last used entry - but that question was never answered at the end of the issue.

If it still is not that way, I donā€™t understand how grub can offer that function without issues (I use and have used it on many systems over the years and on UEFI systems too) but systemd canā€™t xD

It actually does have issues on grub. Grub writes it to the filesystem. However, since grub canā€™t write every filesystem, that feature doesnā€™t work on many filesystems.

systemd-boot doesnā€™t have filesystem drivers. It writes the data to EFI variables. However, they donā€™t want to write EFI variables every time a boot entry is selected/changed.

Ultimately, grub and systemd-boot are fundamentally different. Neither a superset of the other. If that is a ā€œmust haveā€ feature for you, stick with grub.

1 Like

@dalto I just made the switch from mkinitcpio to dracut. Just to confirm, the kernel-install-for-dracut in eosā€™s repo performs essentially the same function as kernel-install-mkinitcpio described here, right?

Yes, I try to keep them both in-sync. I generally make any changes to both of them at the same time.

1 Like

Thanks for the confirmation. Iā€™m going to go through all the documentations first to get a general understanding of systemd-boot and then perform the steps in this tutorial.

Also, thanks for writing this tutorial. :+1:

1 Like

Successfully converted to systemd-boot from grub. System running without any issues. Chose /boot as the new mount point.

I do have a question, @dalto. Do we actually need the dracut-hook package from eosā€™s repo if we already have kernel-install-for-dracut installed? I currently have dracut-hook installed, and I noticed that my /boot/ directory looks like this:

drwxr-xr-x root root 4.0 KB Thu Dec 22 22:52:04 2022 (machine_id)
drwxr-xr-x root root 4.0 KB Thu Dec 22 22:30:14 2022 EFI
.rwxr-xr-x root root  74 MB Thu Dec 22 22:52:02 2022 initramfs-linux-lts-fallback.img
.rwxr-xr-x root root  16 MB Thu Dec 22 22:51:40 2022 initramfs-linux-lts.img
drwxr-xr-x root root 4.0 KB Thu Dec 22 22:54:24 2022 loader
.rwxr-xr-x root root  10 MB Thu Dec 22 22:51:30 2022 vmlinuz-linux-lts

I suspect that the initramfs images (probably generated by the hooks from dracut-hook package) actually serve no purpose here because according to the files inside /boot/loader/entries/, the initrd files are used by the bootloader, not intramfs.

title      EndeavourOS
version    5.15.85-1-lts
machine-id (machine-id)
sort-key   endeavouros-5.15.85-1-lts
options    root=UUID=8624ed1c-e0b4-45b5-ac9e-045fd9c9df4e rw resume=UUID=f31ea3e9-65f7-4ec0-bda8-a491666debae loglevel=3 nowatchdog nvme_load=YES systemd.machine_id=(machine_id) systemd.machine_id=(machine_id)
linux      /(machine_id)/5.15.85-1-lts/linux
initrd     /(machine_id)/5.15.85-1-lts/initrd

Am I correct to assume that the kernel-install-for-dracut package takes care of all pacman hooks (including the ones responsible for generating kernel images post kernel updates), so I donā€™t really need the dracut-hook package?

No, you should not have that installed. kernel-install-for-dracut is all you need.

Yes

The eos-dracut package in the repo is there to support other bootloaders.

1 Like

Thanks, that explanation cleared up some questions for me too!

2 Likes

@dalto

May I suggest to add these two points into the tutorial as a side note? Might help to clarify a few things for other beginners.

1 Like

Thanks for the advice, I am in the process of making some pretty substantial modifications to it right now.

1 Like

@dalto No problem.

Really? I thought the tutorial is pretty good as it is.

1 Like

I am changing it to match what we do in the installer.

I updated the tutorial to match the current ISO and included the feedback received above.

5 Likes

I want to convert my system to systemd-boot but before I do that I also want to switch to dracut. Is the correct way to first install dracut with pacman and then run the following 2 commands:

# dracut --hostonly --no-hostonly-cmdline /boot/initramfs-linux.img

# dracut /boot/initramfs-linux-fallback.img

At the moment I only have the mainline kernel installed.

After this is done I reboot to check if everything is okay and then proceed to uninstall mkinitcpio and follow this tutorial correct?

1 Like

If you just follow this tutorial and follow the instructions for dracut that will convert to dracut and systemd-boot in a single shot. That would be easiest.

If you would prefer to install and test dracut alone, you should install dracut and eos-dracut. Then remove mkinitcpio and run sudo dracut-rebuild.

So itā€™s as easy as following the tutorial and run

sudo pacman -S kernel-install-for-dracut

when itā€™s mentioned in the tutorial instead of yay -S kernel-install-mkinitcpio?

Yes. kernel-install-for-dracut will remove mkinitcpio and install dracut.

A couple steps later when you run reinstall-kernels that will build your initrds with dracut.

1 Like

Thank you sir!

1 Like

I get the following error when running the script, probably not enough space in my efi partition which is 300mb

dracut: dracut: using auto-determined compression method 'gzip'
cp: error writing '/efi/a463d5e357b443a18f592fa89825f7ee/6.1.1-arch1-1/initrd-fallback': No space left on device
dracut: dracut: creation of /efi/a463d5e357b443a18f592fa89825f7ee/6.1.1-arch1-1/initrd-fallback failed

output of df -h:

EndeavourOSāžœ  /  į…  df
Filesystem      Size  Used Avail Use% Mounted on
dev             7,8G     0  7,8G   0% /dev
run             7,8G  1,3M  7,8G   1% /run
/dev/nvme0n1p2  359G  9,0G  339G   3% /
tmpfs           7,8G  9,9M  7,8G   1% /dev/shm
tmpfs           7,8G   47M  7,8G   1% /tmp
tmpfs           8,0G   36M  8,0G   1% /home/backoff/ramdisk
tmpfs           1,6G   32K  1,6G   1% /run/user/1000
/dev/sda1       293G  172G  118G  60% /mnt/ToshibaHD
/dev/nvme0n1p1  300M  128M  173M  43% /efi

What should I do??