FWIW:
- make a backup of any important data you do not want to risk losing.
- unmount and remove grub’s (THREE!!!) partitions –
BIOSBOOT
,/boot
, and/boot/efi
[1] - create one new ESP, update your /etc/fstab, and mount the ESP at
/boot
[2] dnf install systemd-boot-unsigned
[3]- install sd-boot with
bootctl install --esp-path=/boot --make-entry-directory=yes
[4] - create
/etc/kernel/cmdline
[5] - re-add the kernel to the new boot partition (aka ESP) with
kernel-install add $(uname -r) /lib/modules/$(uname -r)/vmlinuz
The final result might look something like this (your kernel version will be different):
# tree /boot
/boot
├── 2f9473ba6b744ccea0349a09a467f694
│ ├── 0-rescue
│ │ ├── initrd
│ │ └── linux
│ └── 6.8.0-0.rc6.20240227git45ec2f5f6ed3.50.fc41.x86_64
│ ├── initrd
│ └── linux
├── efi
│ ├── boot
│ │ └── bootx64.efi
│ ├── Linux
│ └── systemd
│ └── systemd-bootx64.efi
└── loader
├── entries
│ ├── 2f9473ba6b744ccea0349a09a467f694-0-rescue.conf
│ └── 2f9473ba6b744ccea0349a09a467f694-6.8.0-0.rc6.20240227git45ec2f5f6ed3.50.fc41.x86_64.conf
├── entries.srel
├── loader.conf
└── random-seed
10 directories, 11 files
Of course, the above proceedure is extremely dangerous in that it will leave your system unbootable if you get anything wrong. There are also a few details that you need to know such as that the ESP must be formatted with FAT32 (aka vfat) and that it must have its type code set to EF00
. You also need to specify the permissions (umask and context) as mount options in /etc/fstab since FAT filesystems don’t support unix mode bits or SELinux permissions directly.
Here is what my /etc/fstab looks like:
PARTLABEL=boot@a /boot@a vfat umask=0077,shortname=lower,context=system_u:object_r:boot_t:s0,flush,discard,x-systemd.before=bootbind.service,nofail 0 0
PARTLABEL=boot@b /boot@b vfat umask=0077,shortname=lower,context=system_u:object_r:boot_t:s0,flush,discard,x-systemd.before=bootbind.service,nofail 0 0
My /etc/fstab is more complicated than the typical version would be because my system is configured with mirrored system drives (and ZFS). A more typical example might look more like this (lines containing “boot” are the only ones you should need to edit):
UUID=... / btrfs subvol=root ...
LABEL=boot /boot vfat shortname=lower,umask=0077,context=system_u:object_r:boot_t:s0 0 0
UUID=... /home btrfs subvol=home ...
Note that this configuration aligns closely with the current bootloader specification (Boot Loader Specification | UAPI Group Specifications) and with how other distros such as Arch are likely configured (Talk:Syslinux - ArchWiki) but it is not how the current Anaconda installer will configure a system if you use it to install the sd-boot bootloader. (The current Anaconda implementation deviates from the spec by mounting the ESP at /boot/efi. This is done because the shim package (which sd-boot doesn’t currently use) is hard-coded to place files at /boot/efi/EFI/fedora. I suspect that this sort of deviation from the spec is the sort of thing that will cause many many users great frustration for years (or decades) to come. You can use the correct /boot mountpoint and just let shim place its files there even though the path is wrong (or maybe uninstall that package). Just my 2¢.)
By the way, I’ve been using systemd-boot (with the ESP mounted at /boot) since before Fedora Linux 28 and I’ve only experienced one “significant” issue but that only happened with the upgrade from F28 to F29.
I prefer using sgdisk from the
gdisk
package to manage GPT partitions. You will likely need to runpartprobe
after you’ve finished updating the partition table. ↩︎You will need the
dosfstools
package installed to format the ESP. Use something likemkfs -t vfat -n boot /dev/sda1
to format the ESP with a FAT32 filesystem and set itsLABEL
to “boot”. The label you use here can be used to identify this filesystem in your /etc/fstab. Note that FAT32 labels are limited to 11 characters. The warning about case sensitivity can be ignored (unless you intend to install an old version of MS-DOS on your ESP). ↩︎Needing to install systemd-boot-unsigned is new as of Fedora Linux 38 ↩︎
I forgot to include the
--make-entry-directory=yes
. Older versions of bootctl used to make that directory automatically, but more recent versions require this extra parameter. ↩︎I missed step 5 initially (though it will work without it, at least for a while). Before you run the last step of re-adding the kernel to the boot partition, you should create a
/etc/kernel/cmdline
file containing your current kernel parameters. It will fall back to using whatever the current system was booted with by referencing/proc/cmdline
, but it is best to be explicit about what you want those parameters to be. (You should not include the BOOT_IMAGE=… or initrd=… parameters from /proc/cmdline when creating /etc/kernel/cmdline.) ↩︎