You are not logged in.

#1 2022-12-01 10:40:56

meezoarch
Member
Registered: 2022-12-01
Posts: 29

Installing systemd-boot on btrfs fails to boot

I am trying to move from GRUB to systemd-boot
I followed the arch wiki on how to install systemd-boot but after the installation the system fails to boot and I get a systemd-boot message rebooting into firmware interface.

Below are parts of my script.
My Boot directory is /boot/efi and the machine is running on intel so I defined the CPU_Vendor as intel. I formated the system partition as:
mkfs.btrfs -L SYSTEM $SYSTEMPARTITION

mount $SYSTEMPARTITION /mnt
btrfs su cr /mnt/@
btrfs su cr /mnt/@home
btrfs su cr /mnt/@opt
btrfs su cr /mnt/@root
btrfs su cr /mnt/@srv
btrfs su cr /mnt/@tmp
btrfs su cr /mnt/@usr_local
btrfs su cr /mnt/@var_cache
btrfs su cr /mnt/@snapshots
btrfs su cr /mnt/@var_log
btrfs su cr /mnt/@var_spool
btrfs su cr /mnt/@var_tmp
btrfs su cr /mnt/@var_pkgs
umount /mnt


#Mounting the file system
mount -m -o $BTRFSOPTIONS,subvol=@ $SYSTEMPARTITION /mnt
mount -m -o $BTRFSOPTIONS,subvol=@home $SYSTEMPARTITION /mnt/home
mount -m -o $BTRFSOPTIONS,subvol=@opt $SYSTEMPARTITION /mnt/opt
mount -m -o $BTRFSOPTIONS,subvol=@root $SYSTEMPARTITION /mnt/root
mount -m -o $BTRFSOPTIONS,subvol=@srv $SYSTEMPARTITION /mnt/srv
mount -m -o $BTRFSOPTIONS,subvol=@tmp $SYSTEMPARTITION /mnt/tmp
mount -m -o $BTRFSOPTIONS,subvol=@usr_local $SYSTEMPARTITION /mnt/usr/local
mount -m -o $BTRFSOPTIONS,subvol=@var_cache $SYSTEMPARTITION /mnt/var/cache
mount -m -o $BTRFSOPTIONS,subvol=@snapshots $SYSTEMPARTITION /mnt/.snapshots
mount -m -o $BTRFSOPTIONS,subvol=@var_log $SYSTEMPARTITION /mnt/var/log
mount -m -o $BTRFSOPTIONS,subvol=@var_spool $SYSTEMPARTITION /mnt/var/spool
mount -m -o $BTRFSOPTIONS,subvol=@var_tmp $SYSTEMPARTITION /mnt/var/tmp
mount -m -o $BTRFSOPTIONS,subvol=@var_pkgs $SYSTEMPARTITION /mnt/var/cache/pacman/pkg
mount -m $UEFIPARTITION /mnt/$BOOTDIR
when chroot:
package install: ..... intel-ucode ....
echo Configuring Bootloader ...
bootctl install --esp-path=/$BOOTDIR
               #update bootctl using a pacman hook
               mkdir -p "/etc/pacman.d/hooks/"
               cat <<EOT > "/etc/pacman.d/hooks/95-systemd-boot.hook"
[Trigger]
Type = Package
Operation = Upgrade
Target = systemd

[Action]
Description = Gracefully upgrading systemd-boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart systemd-boot-update.service

EOT


               #configure bootlctl
               sed -i 's/MODULES=()/MODULES=(btrfs)/' /etc/mkinitcpio.conf
               sed -i 's/BINARIES=()/BINARIES=(\/usr\/bin\/btrfs)/' /etc/mkinitcpio.conf
               cat <<EOF > /$BOOTDIR/loader/loader.conf
default  arch.conf
timeout  4
console-mode max
editor   no

EOF



               cat <<EOF > /$BOOTDIR/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /${CPU_VENDOR}-ucode.img
initrd /initramfs-linux.img
options root=LABEL=SYSTEM rootflags=subvol=@ rootfstype=btrfs rw

EOF

 
             cat <<EOF > /$BOOTDIR/loader/entries/arch-fallback.conf
title Arch Linux (fallback initramfs)
linux /vmlinuz-linux
initrd /${CPU_VENDOR}-ucode.img
initrd /initramfs-linux-fallback.img
options root=LABEL=SYSTEM rootflags=subvol=@ rootfstype=btrfs rw

EOF

               cat <<EOF > /$BOOTDIR/loader/entries/arch-lts.conf
title Arch Linux LTS
linux /vmlinuz-linux-lts
initrd /${CPU_VENDOR}-ucode.img
initrd /initramfs-linux-lts.img
options root=LABEL=SYSTEM rootflags=subvol=@ rootfstype=btrfs rw

EOF


               cat <<EOF > /$BOOTDIR/loader/entries/arch-lts-fallback.conf
title Arch Linux LTS (fallback initramfs)
linux /vmlinuz-linux-lts
initrd /${CPU_VENDOR}-ucode.img
initrd /initramfs-linux-lts-fallback.img
options root=LABEL=SYSTEM rootflags=subvol=@ rootfstype=btrfs rw

EOF
         
               mkinitcpio -P

This is part of the output of installing the bootloader:

Configuring Bootloader ...

Created "/boot/efi/EFI".
Created "/boot/efi/EFI/systemd".
Created "/boot/efi/EFI/BOOT".
Created "/boot/efi/loader".
Created "/boot/efi/loader/entries".
Created "/boot/efi/EFI/Linux".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
Random seed file /boot/efi/loader/random-seed successfully written (32 bytes).
Created EFI boot entry "Linux Boot Manager".
==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: 'default'
  -> -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts.img
==> Starting build: 5.15.80-1-lts
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-lts.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: 'fallback'
  -> -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts-fallback.img -S autodetect
==> Starting build: 5.15.80-1-lts
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
==> WARNING: Possibly missing firmware for module: ast
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: wd719x
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-lts-fallback.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 6.0.10-arch2-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 6.0.10-arch2-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [kms]
==> WARNING: Possibly missing firmware for module: ast
  -> Running build hook: [keyboard]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
==> WARNING: consolefont: no font found in configuration
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: wd719x
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful

Can someone help me troubleshoot what am I doing wrong here?

Offline

#2 2022-12-01 11:45:25

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Installing systemd-boot on btrfs fails to boot

meezoarch wrote:

My Boot directory is /boot/efi

You mean the mountpoint for the EFI system partition (--esp-path for bootctl). systemd-boot is more limited than GRUB; using /boot makes things easier. See https://wiki.archlinux.org/title/EFI_sy … _partition

With these mountpoints you need the copying outlined in 4.2 Alternative mount points.

Offline

#3 2022-12-01 12:00:39

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: Installing systemd-boot on btrfs fails to boot

Please wrap outputs in code tags  https://bbs.archlinux.org/help.php#bbcode

As mentioned you'd need to mount the ESP to /boot and boot your kernels from there OR mark your root partition with the XBOOTLDR specification and install a btrfs efi driver via https://archlinux.org/packages/community/any/efifs/ and copying that to your ESP  into the /EFI/systemd/drivers dir path: https://wiki.archlinux.org/title/System … g_XBOOTLDR

Online

#4 2022-12-01 13:21:07

meezoarch
Member
Registered: 2022-12-01
Posts: 29

Re: Installing systemd-boot on btrfs fails to boot

Yes the issue was indeed mount at /boot/efi.
I tested the script on a VM and changing the boot directory to /boot fixed the problem.
Out of interest why is: EFI-system-partitions stating that /efi is a replacement for the historical and now discouraged ESP mountpoint /boot/efi?

Offline

#5 2022-12-01 14:53:38

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: Installing systemd-boot on btrfs fails to boot

I'm not sure why that section is making these kind of statements or which kind of "history" the section is refering to (self-answer due to a behaviour of systemd and systemd-gpt-auto generator, I doubt the history here is of much relevance). The mount point of the ESP as an ESP does not matter, what matters is whether your boot loader can access the files it needs to and where they need to be placed so that works correctly. GRUB can easily locate kernels on other partitions that aren't the ESP, systemd-boot couldn't for a long time and while theorethically possible it requires some setup to do it right now.

Last edited by V1del (2022-12-01 14:56:12)

Online

Board footer

Powered by FluxBB