XBOOTLDR systemd-boot 242

Original Reddit Post

TLDR:

Does anyone have info about systemd-boot 242 using –esp-path and –boot-path?
The wiki says the installation section is currently out to date and I cannot find a good guide that uses these options to make a system XBOOTLDR compatible.

EDIT:

After more closely reading this page

There is a different partition type that is needed for XBOOTLDR to work!

In cfdisk there is a type called “Linux Extended boot” which will have a Guid of “bc13c2ff-59e6-4262-a352-b275fd6f7172”

This partition is what should be used in –boot-path=

I’m confused as to what it should be formatted to. According to this it can be anything but the previously mentioned page says:

For systems where the firmware is able to read file systems directly, $BOOT must be a file system readable by the firmware. For other systems and generic installation and live media, $BOOT must be a VFAT (16 or 32) file system. Applications accessing $BOOT should hence not assume that fancier file system features such as symlinks, hardlinks, access control or case sensitivity are supported.

So formatting to fat32 seems to be the safest bet

This method seems to achieve my goal of having the linux kernel somewhere else in case of windows updates because all that is put onto /efi is the systemd.efi which can be easily recovered with a live disk (not the most ideal but better then having to reinstall linux all together)

So the Systemd-boot page should have something along the lines of:

**Using XBOOTLDR:**

create a separate partition of atleast 250Mib labeled "Linux extended boot" (guid of bc13c2ff-59e6-4262-a352-b275fd6f7172) now referred to as $BOOT

Format boot to fat32 mkfs.vfat -F 32 $BOOT

mount the ESP to /mnt/efi and the $BOOT to /mnt/boot

install with pacstrap per usual

in chroot use the command: (not sure it is needed as bootctl looks for this by default but good to specify)

bootctl --esp-path=/efi --boot-path=/boot install

edit /efi/loader/loader.conf to say:

"default arch
timeout 3"

edit /boot/loader/entries/arch.conf to:

"title Arch_Linux_extendedboot
linux /vmlinuz-linux
initrd /initramfs-linux.img
initrd /initramfs-linux-fallback.img
options root=/dev/sdX"

reboot and enjoy

Obviously a rough draft of what should be in the wiki but the fundementals of what to do are there.

Long read:

I am looking into doing a new Arch Linux install.

Since I am a glutton for making things overly complicated I want mount my ESP to something other then /boot (/efi) and use systemd-boot

While also dual booting Windows 10

My goal really is to try and separate linux from windows so in the event of a windows update, windows will not wipe out my linux ESP info,
While also using systemd-boot (I most likely would need to switch to grub or refind to make this possible but I’m still giving it a shot)

From my understanding systemd-boot can only read the partition it is installed on

So if /boot is not used you need to move your linux kernel from /boot to where ever systemd-boot is installed (/efi)

While looking at the wiki for systemd-boot
I notice that it says the installation process is out of date.

It refers that since systemd 242 there are new –esp-path and –boot-path options
This is supposed to make bootctl compatible with XBOOTLDR

So in a VM I have 5 partitions

sda1-4 – Standard Windows Partitions

sda5 – linux file system formated to ext4 (/)

I mount /dev/sda5 to /mnt then mkdir /mnt/efi (I also mkdir /mnt/boot not sure how necessary this is) and mount /dev/sda2 /mnt/efi

Then just run

pacstrap /mnt base linux linux-firmware
fstab genfstab /mnt > /mnt/etc/fstab

So now comes the confusion:

I arch-chroot into /mnt

In the wiki it seems like I would just adjust my bootctl command to something like:

bootctl --esp-path=/efi --boot-path=/boot install

but when I do this I get an error:

“directory “/boot” is not the root of the file system”

doing:

bootctl --esp-path=/efi --boot-path=/ install

gives the same error

Looking at the man page for bootctl it states:

–boot-path=

path to the extended boot loader partition as defined in the boot loader specification if not specified,

/boot/ is checked. it is recommended to mount the extended boot loader partition to /boot/, if possible

So I am not quite sure why I get this error if it defaults to /boot anyways

If I get rid of the the –boot-path option it installs systemd boot to /efi fine

So now I would go though and make the entries required for systemd-boot

/efi/loaders/loader.conf is edited to add:

default arch
timeout 3

and
/efi/loaders/entries/arch.conf is created with the contents being:

title Arch_Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
initrd /initramfs-linux-fallback.img
options root=/dev/sda6

these entries seem wrong because it assumes /boot is the esp and the kernel is kept in the root of said /boot

Doing an ls of /efi gives me 3 folders

A large string of numbers and chars (not quite sure what this is, its empty), EFI (which contains the efis for windows, a systemd and linux folder) and the previously mentioned loader folder

so my loaders entry should look more like:

title Arch_Linux
linux /EFI/Linux/vmlinuz-linux
initrd /EFI/Linux/initramfs-linux.img
initrd /EFI/Linux/initramfs-linux-fallback.img
options root=/dev/sda6

I should then just need to copy data from /boot to this /efi/EFI/Linux directory

cp -r /boot/* /efi/EFI/Linux

I will need to either make a pacman hook to copy these or do a bind mount to keep the kernel up to date
But this method seems to make a bootable Linux system with the ablity to select windows as well

So my Questions are:

1) Following this method am I XBOOTLDR compatible?

2) Am I doing anything “wrong” by doing the process listed?

3) Is the processes listed more or less what should go into the systemd-boot wiki page? if not does anyone have a write up of using systemd-boot with XBOOTLDR compatibility?

4) Why does –boot-path=/boot give me an error?

5) My goal really is to try and separate linux from windows so in the event of a windows update, windows will not wipe out my linux ESP info.
This seems impossible with systemd-boot. So is there really any point to mounting esp to /efi instead of /boot (excluding updates will automatically update the ESP’s kernels)

Reading the technical details on this page

Seems to answer 1 as no but is not really written in a way with windows in mind

Closer reading of this may be needed on my part

Leave a Reply

Your email address will not be published. Required fields are marked *