Low End Unix

OpenBSD Multibooting with GPT and EFI


I acquired a ThinkPad X260 for running low end Unices.

I installed Ubuntu and left half of the disk space for OpenBSD. The partition table is in GPT (GUID Partition Table) and the boot process starts with GRUB EFI.

Now, how do I install OpenBSD (7.2) and setup multi-booting?


OpenBSD FAQ covers multi-booting.

As of this writing, it does not cover the GPT and/or EFI situation, apart from mentioning rEFInd and GRUB.


OpenBSD's fdisk(8) does not appear to support creation of GPT partitions. It can only take over the whole disk with -A.

In addition, at least in my case, OpenBSD installer does not appear to install an EFI boot loader; this has to be done manually.


To create an OpenBSD GPT partition, boot some Linux-based system.

Use fdisk or cfdisk from util-linux to create a partition of type "OpenBSD data".

Once such a partition exists, the OpenBSD installer would recognize it as "OpenBSD area".

Choose it during the installation and the rest of the installation is unchanged.

After we reboot from the installer, we will boot back into the existing OS; time to install an EFI boot loader for OpenBSD.

OpenBSD provides EFI executable for amd64 (and some other architectures).

On most x86-64 systems, download BOOTX64.EFI and put it in the ESP (EFI System Partition); I put it in /EFI/openbsd/BOOTX64.EFI of ESP or /boot/efi/EFI/openbsd/BOOTX64.EFI as mounted in Linux.

To use GRUB chain loading (assuming a Linux-based system), add something like the following to /etc/grub.d/40_custom and regenerate the GRUB config afterwards.

menuentry "OpenBSD" {
    insmod fat
    insmod chain
    search --no-floppy --set=root --file /EFI/openbsd/BOOTX64.EFI
    chainloader /EFI/openbsd/BOOTX64.EFI

/etc/default/grub might also need some adjustments so that the GRUB menu is actually shown during boot.

The "OpenBSD" entry should boot right into OpenBSD after reboot.

Extra: More EFI Options

We really just need a way to execute OpenBSD's BOOTX64.EFI from EFI.

We could use rEFInd as the primary boot loader and chain load OpenBSD using it.

On machines with 32-bit x86 EFI but 64-bit x86 processor, such as some early Intel Macs, BOOTIA32.EFI might be used instead. I have not tested this yet.