[Tutorial] Convert to systemd-boot

OK, just for the record I am following @Zesko advice to follow @dalto 's instructions (first post in this thread - important to read) using

Now, updating and rebooting! (Done)

 du -sh /boot
127M    /boot

I have a lot of space!
Next we need to remove grub:

sudo pacman -Rc grub
sudo mkdir /efi
efidevice=$(findmnt /boot/efi -no SOURCE) # save the efi partition location
sudo umount /boot/efi
sudo mount ${efidevice} /efi

To make the mount change permanent, edit /etc/fstab and change where it reads /boot/efi to /efi

<dump>  <pass>
UUID=FDBB-97B1                            /efi      vfat    defaults,noatime 0 2
[limo@lenovo ~]$ 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".

# Edit the file `/efi/loader/loader.conf` and uncomment the "timeout" line.
timeout 3
#console-mode keep

Technically speaking, you have now successfully installed systemd-boot. Congrats!

> kernel-install:

yay -S kernel-install-mkinitcpio

> You can either save the below as a script (I wonder what should I name this script? Where to save it?)
Here is the text of the script which 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)

Well I thought it can be just executed so I did:

[limo@lenovo MyScripts]$ sudo bash dalto.sh

and got lots of stuff With a few warnings about drivers and fonts… I get occasionally, and it ended up with:

=> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [filesystems]
/dev/stdin: line 22: grub-btrfs-overlayfs: command not found
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /efi/2ba377af56ef4fb0898b46fcc244bcb9/5.19.4-arch1-1/initrd-fallback
==> Image generation successful

Which I believe is OK as “==> Image generation successful”
Then

sudo rm -r /boot/efi /boot/grub /boot/initramfs* /boot/vmlinuz*

As @dalto said there

Now you can reboot into your new system. As you install/remove kernels, the whole process should be automated.

Rebooting… hopefully I will be back soon… alive!

i am back… still alive and kicking! :partying_face: :tada: :partying_face: :vulcan_salute:
the greatest of the great distros, and the greatest fo the great community.
Billions of thanks and appreciation to @dalto and @Zesko

2 Likes