Discussion:
Changing efi system partition
David Passens
2021-04-10 16:45:14 UTC
Permalink
Hello folks,

I recently installed OpenBSD as a dualboot next to a Linux install.
However, I didn't pay much attention to partitioning and created a new
ESP. This means that my Linux bootloader can't find the OpenBSD
bootloader to chainload it.

Now I want to fix this situation. If I don't reinstall (which I don'
want to), I need to move one bootloader onto the other ESP. Moving the
Linux bootloader seems easier, but I'd like to know if I can do the same
with the OpenBSD one.

I could just try to move the executable but I'm not sure how the
bootloader finds the partition to boot from and how sysupgrade finds the
bootloader to upgrade it (if it does it at all, the man page didn't
mention it).

Does anybody know whether it's safe to just move the bootloader to a
different partition? If so, can I rename it as well? BOOTX64.efi
conflicts with my linux bootloader.

I already tried to find out via boot(8) and boot_amd64(8) but they only
talk about legacy BIOS. At first glance, man -k efi doesn't point to
any useful pages either. I might've overlooked something though, I'm
fairly new to OpenBSD.

Thanks in advance,
David
Parodper
2021-04-10 18:34:43 UTC
Permalink
Post by David Passens
Hello folks,
I recently installed OpenBSD as a dualboot next to a Linux install.
However, I didn't pay much attention to partitioning and created a new
ESP.  This means that my Linux bootloader can't find the OpenBSD
bootloader to chainload it.
Now I want to fix this situation.  If I don't reinstall (which I don'
want to), I need to move one bootloader onto the other ESP.  Moving the
Linux bootloader seems easier, but I'd like to know if I can do the same
with the OpenBSD one.
I could just try to move the executable but I'm not sure how the
bootloader finds the partition to boot from and how sysupgrade finds the
bootloader to upgrade it (if it does it at all, the man page didn't
mention it).
Does anybody know whether it's safe to just move the bootloader to a
different partition?  If so, can I rename it as well?  BOOTX64.efi
conflicts with my linux bootloader.
I already tried to find out via boot(8) and boot_amd64(8) but they only
talk about legacy BIOS.  At first glance, man -k efi doesn't point to
any useful pages either.  I might've overlooked something though, I'm
fairly new to OpenBSD.
Thanks in advance,
David
EFI can boot from any FAT partition on the drive. You can put any
bootloader you want on that partition (usually it is the first) and EFI
will be able to boot from it. Check your mobo documentation, but for me
the BIOS menu includes an «Boot from» option, to select the EFI file
from which to boot. Not knowing the OpenBSD specifics, it should boot
even if you move it.

If you have doubts, try to recreate your setup on a virtual machine and
try there.
David Passens
2021-04-10 20:51:06 UTC
Permalink
Post by Parodper
EFI can boot from any FAT partition on the drive. You can put any
bootloader you want on that partition (usually it is the first) and
EFI will be able to boot from it. Check your mobo documentation, but
for me the BIOS menu includes an «Boot from» option, to select the EFI
file from which to boot. Not knowing the OpenBSD specifics, it should
boot even if you move it.
If you have doubts, try to recreate your setup on a virtual machine
and try there.
Thanks for the help, but unfortunately it doesn't seem to be this easy.
I tried to copy the bootloader onto the other ESP and set my linux
bootloader to chainload it. It seems to boot but it tries to load the
kernel from the wrong partition and complains about a missing
/etc/boot.conf.

This is weird as I don't have this file on my real install. Even if I
had, the bootloader wouldn't be able to read it as I use disk
encryption. I figured that the bootloader was missing CLI arguments so
I tried to find out how to read efi variables from OpenBSD. This led me
to a reddit post from 9 months ago[0], which claims that OpenBSD doesn't
use efi variables and always assumes that it controls BOOTX64.efi.

This means that I'll probably need to change things on the linux side.
Either way, thanks again.

[0] https://www.reddit.com/r/openbsd/comments/haxyey/efibootmgr_openbsd/
Loading...