[Tutorial] Convert to systemd-boot

Boot off another installed distro or a live ISO, restore the snapshot, chroot in and run reinstall-kernels.

That being said, I can tell you that personally, I have only once restored a snapshot outside of my testing for Brtfs Assistant. Even then, it was only done because I was working with a distro I wasn’t very familiar with(KDE Neon).

In normal operation, I have never restored a snapshot. That being said, I access my snapshots all the time. I am much more likely to restore files from a snapshot than an entire snapshot.

Sorry if this question was already answered, could not find it but as it is a very long topic it can exist already above.
I am running already systemd-boot, installed with mkinitcipio a few months ago, following @dalto tutorial when we faced the grub issue last summer.
Now I’d like to switch to Dracut.
As per my understanding I don’t need to reinstall systemd-boot, all I need to do is the following:

  1. Remove the Mkinitcipio package and install Dracut:
sudo pacman -R kernel-install-mkinitcipio
sudo pacman -S kernel-install-for-dracut
  1. Reinstall Kernels

reinstall-kernels

And … that’s it ? Or do I miss something ? (I also don’t remember having installed a package named “reinstall-kernels” but I assume it comes with the kernel-install-for-dracut, right ?)

If you are using kernel-install-mkinitcipio, all you need to do is:

sudo pacman -S kernel-install-for-dracut
sudo reinstall-kernels

mkinitcpio and kernel-install-mkinitcpio will get removed automatically.

Yes, it is part of both kernel-install-for-dracut and kernel-install-mkinitcpio

3 Likes

Great !!! Thanks @dalto

1 Like

@dalto, got an error while running sudo pacman -S kernel-install-for-dracut
It indeed does try to remove kernel-install-mkinitcpio but gives me also this error:

error: removing mkinitcpio breaks dependency 'mkinitcpio’required by mkinitcpio-openswap

So shall I first remove mkinitcpio-openswap ?
I believe it may break my Swap but at the moment I can live without…

You can safely remove mkinitcpio-openswap. The package basically contains a set of hooks to open swap during boot time.

1 Like

Thanks @anthony93 , it’s clear.

Not familiar with dracut, reading the Github page now. Looks like it would mainly be used for more efficient boot up?

UPDATE: Ahh, I see the latest release has moved from mkinitcpio to dracut (and mkinitcpio maintainer is retiring?) so, I guess I should give this higher priority. Off from work for the week anyways so…tally-ho I guess :wink:

Well I tried and must of missed a step or fat fingered cuz it no booty. No worries, that is why /home is on it’s own partition. Reinstall and run my script to install all the software I use.

I am sure it could have been fixed but I guess reinstalling is one way to fix it.

1 Like

Probably so. Boot just took me to me to the BIOS screen. Reminiscent of when grub had to be reinstalled after update a few months back. The directories looked right but I must of missed something.

Sorry, I’m a bit confused. Is there maybe a mix-up in the initial post? Shouldn’t it be …

sudo rm -r /boot/efi /boot/grub /boot/initramfs* /boot/vmlinuz*
sudo mv /boot/*ucode.img /efi/.

If you remount the ESP partition (which was previously mounted to /boot/efi) to /efi/, two things will happen:

  1. the directory /boot/efi/ becomes empty (because it is no longer the mount point for the ESP partition). Since /boot/efi/ is empty and no longer serves a purpose, you can safely remove /boot/efi/ as stated in the tutorial.
  2. all the contents in the ESP partition now appears inside the /efi/ directory (because /efi/ is the new mount point for the ESP partition). Previously, the initramfs files, etc. are inside /boot/efi/. After the remound, they will all appear inside the /efi/ directory. You no longer need all those files, so you can choose to clean them up by removing them.

Before these steps,

your /boot/efi/ directory will have the grub directory, the initramfs files, the vmlinuz files. After the remount, all thjat stuff will appear under /efi/. The tutorial simply suggests you remove all of them (/efi/grub/, /efi/initramfs*, /efi/vmlinuz*) since you no longer need them.

1 Like

Ehh…it depends where your EFI was mounted in the first place.

I will rewrite that part to make it work regardless. Thanks for pointing it out.

1 Like

I think that should be fixed now. Thanks again.

3 Likes

Nice. You simply performed the clean-up step before the remount, which is what I did at the time I was switching as well. That way it wouldn’t confuse users who choose /boot/ as the new mount point.

1 Like

Nice tutorial; installed systemd-boot on arch. Just a question … Is it possible with timeshift to show the snaps during boot ?
Installed timeshift on cli arch with

yay -S --noconfirm timeshift timeshift-autosnap

.
The thing is with grub the snaps are shown during boot (grub-btrfs) and i like to know if this is also possible with systemd-boot.

You can’t easily boot off snapshots with systemd-boot because of the kernel being outside the snapshots.

I’ve successfully tried this tutorial on VM, and it works fine.
But when I try this on my laptop, the boot entries are somehow hidden. After 3 seconds, it automatically boots into the latest kernel.

bootctl list output:

         type: Boot Loader Specification Type #1 (.conf)
        title: EndeavourOS (6.1.6-arch1-3) (default) (selected)
           id: a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3.conf
       source: /efi/loader/entries/a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3.conf
      version: 6.1.6-arch1-3
   machine-id: a2f05c45b2f0414eaee6f5693c263f16
        linux: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/linux
       initrd: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/amd-ucode.img
               /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/initrd
      options: root=UUID=725b43d6-a6b0-4716-8a10-99d3a9c152a4 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES

         type: Boot Loader Specification Type #1 (.conf)
        title: EndeavourOS (6.1.6-arch1-3-fallback)
           id: a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3-fallback.conf
       source: /efi/loader/entries/a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3-fallback.conf
      version: 6.1.6-arch1-3-fallback
   machine-id: a2f05c45b2f0414eaee6f5693c263f16
        linux: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/linux
       initrd: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/amd-ucode.img
               /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/initrd-fallback
      options: root=UUID=725b43d6-a6b0-4716-8a10-99d3a9c152a4 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES

         type: Boot Loader Specification Type #1 (.conf)
        title: EndeavourOS (5.15.88-2-lts)
           id: a2f05c45b2f0414eaee6f5693c263f16-5.15.88-2-lts.conf
       source: /efi/loader/entries/a2f05c45b2f0414eaee6f5693c263f16-5.15.88-2-lts.conf
      version: 5.15.88-2-lts
   machine-id: a2f05c45b2f0414eaee6f5693c263f16
        linux: /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/linux
       initrd: /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/amd-ucode.img
               /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/initrd
      options: root=UUID=725b43d6-a6b0-4716-8a10-99d3a9c152a4 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES

         type: Boot Loader Specification Type #1 (.conf)
        title: EndeavourOS (5.15.88-2-lts-fallback)
           id: a2f05c45b2f0414eaee6f5693c263f16-5.15.88-2-lts-fallback.conf
       source: /efi/loader/entries/a2f05c45b2f0414eaee6f5693c263f16-5.15.88-2-lts-fallback.conf
      version: 5.15.88-2-lts-fallback
   machine-id: a2f05c45b2f0414eaee6f5693c263f16
        linux: /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/linux
       initrd: /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/amd-ucode.img
               /a2f05c45b2f0414eaee6f5693c263f16/5.15.88-2-lts/initrd-fallback
      options: root=UUID=725b43d6-a6b0-4716-8a10-99d3a9c152a4 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES

         type: Automatic
        title: Windows Boot Manager
           id: auto-windows
       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

         type: Automatic
        title: Reboot Into Firmware Interface
           id: auto-reboot-to-firmware-setup
       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

bootctl status output:

System:
      Firmware: UEFI 2.70 (Phoenix Technologies Ltd. 4660.22136)
 Firmware Arch: x64
   Secure Boot: disabled (disabled)
  TPM2 Support: yes
  Boot into FW: supported

Current Boot Loader:
      Product: systemd-boot 252.4-2-arch
     Features: ✓ Boot counting
               ✓ Menu timeout control
               ✓ One-shot menu timeout control
               ✓ Default entry control
               ✓ One-shot entry control
               ✓ Support for XBOOTLDR partition
               ✓ Support for passing random seed to OS
               ✓ Load drop-in drivers
               ✓ Support Type #1 sort-key field
               ✓ Support @saved pseudo-entry
               ✓ Support Type #1 devicetree field
               ✓ Boot loader sets ESP information
          ESP: /dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c
         File: └─/EFI/systemd/systemd-bootx64.efi

Random Seed:
 Passed to OS: yes
 System Token: set
       Exists: yes

Available Boot Loaders on ESP:
          ESP: /efi (/dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c)
         File: ├─/EFI/systemd/systemd-bootx64.efi (systemd-boot 252.4-2-arch)
               └─/EFI/BOOT/BOOTX64.EFI (systemd-boot 252.4-2-arch)

Boot Loaders Listed in EFI Variables:
        Title: Linux Boot Manager
           ID: 0x0002
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c
         File: └─/EFI/systemd/systemd-bootx64.efi

        Title: EndeavourOS-grub
           ID: 0x0003
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c
         File: └─/EFI/EndeavourOS-grub/grubx64.efi

        Title: endeavouros-1077
           ID: 0x0000
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c
         File: └─/EFI/endeavouros-1077/grubx64.efi

        Title: Windows Boot Manager
           ID: 0x0001
       Status: active, boot-order
    Partition: /dev/disk/by-partuuid/010d4ed7-d50c-411a-b926-f8ab9a2303ce
         File: └─/EFI/Microsoft/Boot/bootmgfw.efi

Boot Loader Entries:
        $BOOT: /efi (/dev/disk/by-partuuid/e91f2238-b09f-0348-ba09-11fb82a4799c)

Default Boot Loader Entry:
         type: Boot Loader Specification Type #1 (.conf)
        title: EndeavourOS (6.1.6-arch1-3)
           id: a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3.conf
       source: /efi/loader/entries/a2f05c45b2f0414eaee6f5693c263f16-6.1.6-arch1-3.conf
      version: 6.1.6-arch1-3
   machine-id: a2f05c45b2f0414eaee6f5693c263f16
        linux: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/linux
       initrd: /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/amd-ucode.img
               /a2f05c45b2f0414eaee6f5693c263f16/6.1.6-arch1-3/initrd
      options: root=UUID=725b43d6-a6b0-4716-8a10-99d3a9c152a4 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES

I have never seen anything like that before. It almost looks like a display issue.

Have you tried using some of the different options for console-mode in loader.conf?