You are not logged in.
Hi, I would like to ask if it's a good idea to split the esp partition, which always needs to be formatted as obsolete FAT32, into /efi where are the bootloader, fs drivers, config, etc. and then have another /boot partition (XBOOTLDR) where the UKI would be, but this partition would be formatted as ext4?
Last edited by StopkaPeter (2024-09-28 11:37:18)
Offline
first of: you can not "split" the ESP - the ESP is defined as one partition formatted with FAT32
also: it's only the "standard default fallback option that HAS TO be supported" - but your uefi maybe supports additional FS like NTFS or ext4 itself and maybe is able to boot from such - this requirement for the fat32 esp is just the minimal base support any uefi compliant system HAS TO implement - it doesn't say anything about limiting any implementation to just that - every implementor is free to add additional drivers for common FS free house
currently I do have my ESP just for /efi - but it contains 2 bootloaders: grub and windows - and although the implementation of my MSI B550-A PRO seems to be fine with it and able to let me use the uefi boot selector to select between the two - as windows is so dominant and always overrides the fallback in EFI/BOOT/BOOTX64.EFI and one of the boot entries I just use grub as main bootloader and chain windows from it - and at least for me until now it works that windows although adding itself again to the boot order never replaced itself to the first one but respects that grub is set as the primary
I also played around a lot with systemd boot and auto-mount and using an additional XBOOTLDR partition - and although that work well in a qemu kvm it completely breaks on my bare metal which doesn't like that style at all - no matter if linux-only or dual with windows
and although I had /boot on its own partition at some time currently I personal prefer to have /boot as a regular folder on the root partition so it is consistent with the installed kernel and its modules and the ESP just contain grub and grub.cfg along with windows to chose between booting arch or windows
my two cents: give it a try and see if it works on your system the way you want it to - but keep an eye on your fstab to have /boot mounted and booting - or use some hook which mounts it whenever the kernel is updated - otherwise you will end up in a corrupt system where the kernel doesn't match the modules and the system either doesn't boot correctly or not at all
Offline
If you're using a UKI that's the only thing you need on the ESP so there seems little point mounting it under /boot/. I mount the ESP under /efi/ and edit the mkinitcpio kernel preset file to place the UKI at /efi/EFI/Boot/bootx64.efi so I don't need to bother with NVRAM boot entries.
Jin, Jîyan, Azadî
Offline
Hi, thank you for the responses. I just wanted to add that the reason I want to split the esp is because UEFI cannot load from any other file system than FAT32. If it were possible to load the UKI directly from ext4, I wouldn't do this and would only have /efi. My only option remains if I use systemd-boot for booting, where I install drivers for ext4 so that the bootloader can load the UKI from ext4. A question that came to mind, though, is whether I need to create a /boot (XBOOTLDR) partition for UKI with ext4 or if it's enough to just have a /boot directory on the root partition. I’m not sure if this will work if I then use the command bootctl --esp-path=/efi --boot-path=/boot install because systemd-boot automatically finds the UKI only when it’s located at esp/EFI/Linux/.
Last edited by StopkaPeter (2024-09-24 12:45:22)
Offline
If it were possible to load the UKI directly from ext4, I wouldn't do this and would only have /efi
But why not just have the UKI installed to /efi/? Then you wouldn't need to expose the FAT filesystem for anything else.
Using /efi/ with a UKI is best if /etc/fstab doesn't list /efi/ at all because systemd will automount the ESP only when needed, which helps protect the fragile filesystem.
With a UKI you don't need a bootloader or a custom NVRAM boot entry because it boots itself and the relevant kernel command line parameters to find and boot the root filesystem are embedded in the image.
Jin, Jîyan, Azadî
Offline
please stop the formatting - it really hurts the read flow
I don't have much experience with UKIs, bootctl or system-boot - but:
a Unified Kernel Image combines an EFI-stub, the kernel, the init ramdisk and the kernel commandline
it doesn't matter where it's stored - it just have to be stored somewhere where your uefi can load it from
if your uefi is limited to regular FAT32 it doesn't really matter if you mount the esp to /boot or /efi (or /boot/efi) - all that matters is that you have to check and modify the hook which creates the UKI to place it in the correct location as HoaS mentioned
// edit: F5 ...
Last edited by cryptearth (2024-09-24 13:04:11)
Offline
Thank you very much for the useful information. I would like to ask one last thing
If I want the ESP partition to be mounted on /efi and not /boot with a FAT32 file system, during the installation of Arch Linux, the vmlinuz-linux, amd-ucode, and initramfs-linux files are created in the /boot folder of the root partition. However, then I have to edit the configuration according to this guide https://wiki.archlinux.org/title/Systemd-boot file esp/loader/entries/arch.conf like this:
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx rw
but the files are in the /boot directory not in /efi as I expected. Am I missing something? Here is my installation script:
#!/bin/bash
sgdisk -Z /dev/sda
sgdisk -o /dev/sda
sgdisk -n 1:0:+1G -t 1:ef00 -c EFI /dev/sda
sgdisk -n 2:0:+100G -t 2:8304 -c ROOT /dev/sda
sgdisk -n 3:0:$(( $(sgdisk -E /dev/sda) - ( $(sgdisk -E /dev/sda) + 1 ) % 2048 )) -t3:8302 -c HOME /dev/sda
sgdisk -v /dev/sda
sgdisk -p /dev/sda
mkfs.fat -F 32 -n EFI /dev/sda1
mkfs.ext4 -L ROOT /dev/sda2
mkfs.ext4 -L HOME /dev/sda3
mount /dev/sda2 /mnt
mkdir /mnt/efi
mount /dev/sda1 /mnt/efi
mkdir /mnt/home
mount /dev/sda3 /mnt/home
pacstrap -K /mnt base base-devel linux linux-firmware amd-ucode nano
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
bootctl install
Offline
https://man.archlinux.org/man/bootctl.1
OPTIONS
The following options are understood:
--esp-path=
Path to the EFI System Partition (ESP). If not specified, /efi/, /boot/, and /boot/efi/ are checked in turn. It is recommended to mount the ESP to /efi/, if possible.
--boot-path=
Path to the Extended Boot Loader partition, as defined in the Boot Loader Specification[1]. If not specified, /boot/ is checked. It is recommended to mount the Extended Boot Loader partition to /boot/, if possible.again - I'm no expert in bootctl or systemd-boot - but it looks like the default expects the ESP at /efi an an additional XBOOTLDR at /boot - it's somewhat similar to grub expecting its config default at [/boot]/grub/grub.cfg
with grub one can use --boot-directory= to change the starting point from where [x]/grub/grub.cfg is search - example:
grub-install --target=x86_64-efi --efi-directory=/efi --boot-directory=/efithis will hardcode the ESP mounted at /efi to be the starting point from where grub builds its config path to <ESP>/grub/grub.cfg so the config ends up on the ESP as well
otherwise it will look at whatever points to /boot/grub/grub.cfg - which can either be the root partition - or, if used, an additional XBOOTLDR mounted at /boot
as the man exactly states "will look for the XBOOTLDR" I'm not sure if it can be configured to be the ESP itself - maybe like this:
bootctl install --esp-path=/efi --boot-path=/efiusually I would spin up a vm and test it - but currently my zfs array is degraded due to loss of a drive and I wait for replacement - I don't want to stress it
Offline
but the files are in the /boot directory not in /efi as I expected. Am I missing something?
Arch kernel images are always installed under /boot/, mounting the EFI system partition under /efi/ does not change that.
You can only use systemd-boot if the kernel & initramfs images (or UKI) are present on either the same ESP as the systemd-boot EFI loader or on an XBOOTLDR partition. If you use an XBOOTLDR partition for /boot/ it can use any filesystem provided the relevant EFI filesystem drivers are placed in /EFI/systemd/drivers/ on the systemd-boot ESP, as detailed in the FILES section of sd-boot(7).
It is possible to mount the ESP under /efi/ and then use either a UKI or a bootloader that can read any partition (such as GRUB). Following that method means you can keep /boot/ on the root partition and avoid having to create an XBOOTLDR partition.
Last edited by Head_on_a_Stick (2024-09-24 19:24:47)
Jin, Jîyan, Azadî
Offline