I am replacing GRUB with systemd-boot on a multiboot system with several instances of Ubuntu 20.04 and 22.04 on discrete partitions because the instances are competing for control of the bootloader grubx64.efi and systemd-boot apparently manages this better.
The installation is failed and resisting configuration. In particular, systemd-boot ignores configured boot entries and often the system boots to the grub shell, requiring manual boot.
The process I followed was as recommended. The ESP is /dev/sda1 and by default is mounted to /boot/efi. Boot partitions are /dev/sda2-7, with 2, 4, and 7 the most relevant and the others only provisionally configured. First, I ran:
# bootctl install
I then configured /boot/efi/loader/loader.conf:
# /boot/efi/loader/loader.conf
# systemd-boot configuration file
timeout 5
#default 4fa9a5bf4498415ead7dea7c2724e90a-*
# From man loader.conf, Options, default, at https://www.freedesktop.org/software/systemd/man/loader.conf.html:
default @saved
console-mode keep
I then configured the boot entries in .conf files in /boot/efi/loader/entries, all of which are in the form of:
# /boot/efi/loader/entries/sdx4.conf
# Boot entry configuration file.
title sdx4 - Ubuntu Desktop 22.04
linux ../vmlinuz
initrd ../initrd.img
options root=PARTUUID=9d1de6a4-452c-42d2-bf18-acee90032326 rw
Then, on the recommended reboot, systemd-boot presents a menu with options only for the default boot loader, which boots to the GRUB shell, and to boot into the EFI configuration utility.
Kernel files remain in /boot because linux-update-symlinks creates the symlinks initrd.img and vmlinuz in /boot and FAT32 does not support symlinks.
bootctl status
returns
System:
Firmware: n/a (n/a)
Secure Boot: disabled
Setup Mode: user
TPM2 Support: no
Boot into FW: supported
Current Boot Loader:
Product: n/a
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
✗ Boot loader sets ESP information
ESP: n/a
File: └─n/a
Random Seed:
Passed to OS: no
System Token: set
Exists: yes
Available Boot Loaders on ESP:
ESP: /boot/efi (/dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7)
File: └─/EFI/systemd/systemd-bootx64.efi (systemd-boot 249.11-0ubuntu3.1)
File: └─/EFI/BOOT/BOOTX64.EFI
Boot Loaders Listed in EFI Variables:
Title: ubuntu
ID: 0x0000
Status: active, boot-order
Partition: /dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7
File: └─/EFI/ubuntu/shimx64.efi
Title: ubuntu
ID: 0x0002
Status: active, boot-order
Partition: /dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7
File: └─/EFI/debian/shimx64.efi
Title: Linux Boot Manager
ID: 0x0001
Status: active, boot-order
Partition: /dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7
File: └─/EFI/systemd/systemd-bootx64.efi
Title: UEFI OS
ID: 0x0005
Status: active, boot-order
Partition: /dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7
File: └─/EFI/BOOT/BOOTX64.EFI
Title: ubuntu
ID: 0x0006
Status: active, boot-order
Partition: /dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7
File: └─EFI/Ubuntu/grubx64.efi
Boot Loader Entries:
$BOOT: /boot/efi (/dev/disk/by-partuuid/3aa3442b-045b-4b22-8e8b-6c01a5571ce7)
Default Boot Loader Entry:
title: sdx7 - Ubuntu Desktop 22.04
id: sdx7.conf
source: /boot/efi/loader/entries/sdx7.conf
linux: ../vmlinuz
initrd: ../initrd.img
options: root=PARTUUID=67027db9-885b-471b-9c01-4b2108e6f7e9 rw
tree /boot/efi
returns
/boot/efi/EFI
├── BOOT
│ ├── BOOTX64.EFI
│ ├── fbx64.efi
│ └── mmx64.efi
├── debian
│ ├── BOOTX64.CSV
│ ├── grub.cfg
│ ├── grubx64.efi
│ ├── mmx64.efi
│ └── shimx64.efi
├── Linux
├── systemd
│ └── systemd-bootx64.efi
└── ubuntu
├── BOOTX64.CSV
├── grub.cfg
├── grubx64.efi
├── mmx64.efi
└── shimx64.efi
5 directories, 14 files
This is a disaster. None of the documentation provides a clue, nor does Google. Any constructive thoughst about how to get systemd-boot to work would be appreciated.