EFI issues

I downloaded the beta (torrent) and since Ubuntu 16.04 is my primary OS I used dd to write it to my flash drive. On reboot, Haiku loaded without any issues except that my USB WiFi dongle does not work but I already knew it wasn’t going to work since that issue has been discussed in these forums. I didn’t have any space prepared on this laptop so I rebooted into Linux and shrunk my Linux home partition by 10 GB. I rebooted with the flash drive inserted, ran Drivesetup to create and format a Haiku partition and ran the installer. The installer finished, I shut down, removed the flash drive and restarted. Of course, there was no entry in the grub2 boot menu so I booted into linux and followed the instructions at the following URL:

Unfortunate;y those instructions contain a reference to “/” that I could not find an explanation for. I also tried modifying the file ‘/etc/grub.d/40_custom’ to be similar to the one in the top post of the thread at the following URL:

My /etc/grub.d/40_custom file now looks like this:

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
# for BIOS systems
menuentry “Haiku R1B1” {
set root=(hd0,9);
chainloader +1

# for EFI systems
menuentry “Haiku R1B1” {
insmod part_gpt
insmod chain
#search --fs-uuid --set=root 22ee31f04410957a
set root=‘(hd0,gpt1)’
chainloader ($root) /EFI/Haiku/BOOTX64.EFI

After running update-grub, rebooting and choosing Haiku, grub displays a message, “Invalid file”. It’s kinda frustrating that Haiku booted from the flash drive effortlessly and installed in five minutes but, I’ve been trying to get grub2 to boot it now for a couple of hours without success.

You don’t need the part for BIOS systems and you have a space between ($root) and /EFI/Haiku/BOOTX64.EFI.

I also recommend using the search instead of hardcoding the disk, because its path can change while UUID does not (I got bit by that previously).

UUID you’re using also looks wrong, FAT partitions have a different format. See https://wiki.gentoo.org/wiki/GRUB2/Chainloading#Dual-booting_Windows_on_UEFI_with_GPT

Thanks! The error has changed to ‘Error file /EFI/haiku/BOOTX64.EFI not found’. I suspect this is a result of set root=‘(hd0,gpt1)’ pointing to the EFI partition when the file in question is in the /boot folder of the Linux root partition. Should the file contain set root=‘(hd0,gpt6)’ instead? Below is a list of my partitions I obtained using gdisk.

Number Size Code Name

1 1024.0 MiB 2700 Basic data partition
2 100.0 MiB EF00 Basic data partition
3 128.0 MiB 0C01 Basic data partition
4 232.9 GiB 0700 Basic data partition
5 8.6 GiB 2700 Basic data partition
6 55.0 GiB 8300 Linux root
7 16.0 GiB 8200 Swap
8 142.0 GiB 8300 Linux /home
9 10.0 GiB EB00 Haiku

The first partition is the EFI partition and the next four are Windows related.

The UUID in the commented out search line was for the Haiku partition. Should it be the UUID for the Linux root partition instead? I copied the file on the EFI partition of the flash drive to “/boot/efi/EFI/Haiku/” on the Linux root partition.

I’m going out for a few hours. Will have to continue this when I get back.

It doesn’t matter that you see it in /boot of your root partition - this is just the mount point of a different partition. In your case it looks like an EFI partition is the second one (code EF00) so it should be ‘(hd0,gpt2)’.

No, it should be UUID of your EFI partition.

Your goal is to put the Haiku EFI loader in your EFI partition and point your EFI grub at it.
It doesn’t matter where Haiku’s EFI loader is… it just needs to be able to find a Haiku partition to boot (on any attached disk)

You could try firing up an EFI shell (which has a DOS-like syntax) and “running” Haiku’s EFI loader as an executable.

The EFI/BOOT/BOOTX64.EFI path provided is the “default” location of the EFI binary your BIOS loads… if you’re using grub, it just needs to execute ours at whatever path you choose “EFI/HAIKU/BOOTX64.EFI” should be fine.

Now… I have no idea what the syntax to chain load Haiku’s EFI loader from grub… it should be possible in theory though.

If you figure it out, let us know! I can document it :slight_smile:

It is documented here: Booting Haiku | Haiku Project

That’s to chainload a legacy bios bootloader, not a uefi bootloader.


# for EFI systems
menuentry "Haiku R1B1" {
	insmod part_msdos
	insmod chain
	search --fs-uuid --set=root <your-efi-partition-uuid>
	chainloader ($root)/<path-to-haiku-loader>


1 Like

If the following line from the “Booting Haiku” page has not changed since I started this thread (Sept. 30), I need to slap myself:

search --fs-uuid --set=root <your-efi-partition-uuid>

The quoted text above could not really be any more clear about which partition is to be set as root.

All these years I have been using Ubuntu and never realized that it mounts the EFI partition at /boot, so when I copied the files from the EFI partition on the flash drive, I was actually copying them to the system EFI partition! That is why one has to be “su” to actually succesfully copy the files!

I would like to suggest that the “Booting Haiku” page be rearranged so that under the heading “Configuring GRUB boot manager”, one section would be for legacy systems and one for EFI systems. Under the heading for legacy systems the example partition layout would apply to both grub legacy and grub2 as shown below:

hd0 – first hard drive

hd0,1 – first partition of first drive (sda1) Ubuntu Linux /
hd0,2 – second partition of first drive (sda2) Ubuntu Linux Swap
hd0,3 – third partition of first drive (sda3) Haiku partition

The second section under the heading “Configuring GRUB boot manager” would then be for EFI systems with a disk layout as shown below or similar:

hd0 – first hard drive

hd0,1 – first partition of first drive (sda1) EFI system partition
hd0,2 – second partition of first drive (sda2) Microsoft reserved partition
hd0,3 – third partition of first drive (sda3) Windows system partition

hd0,n - nth partition of first drive (sda"n") Haiku partition

This I think would better clarify the difference between legacy systems using the MBR partitioning layout and EFI systems using the GPT partioning layout.

Additionally, I recently used a laptop (Dell) which allowed the user to select the desired OS from a list on boot up, by pressing one of the function keys during the POST. This laptop doesn’t really need a boot loader to be able to choose which OS to boot, since the setup screen also allows users to choose which one of the EFI entries to boot as default. This particular laptop has what I consider to be the correct implimetation of EFI and such systems would have a completely different approach, since the ability to choose boot loaders is built into the firmware.

Maybe a little write up on how to set up such systems would help. My guess is that to set up such systems, one would have to mount the EFI system partition after running the installer, create a folder for Haiku and copy Haiku’s EFI loder to it. Ultimately the installer should do it automatically, since the business of having users mounting the EFI sytem partition and writing stuff to it is very risky.

I like: Ultimately the installer should do it automatically, since the business of having users mounting the EFI sytem partition and writing stuff to it is very risky.

I agree! We hacked our EFI loader into the OS image manually at the last moment. One of our developers has a bunch of outstanding work to get the EFI loader into the build system (properly)

Once that happens, we can put the EFI bootloader onto the filesystem via the haiku_loader hpkg, then we can whip up the code to integrate the “EFI installer” into the OS.


I tried my hand at editing the html of the ?Booting Haiku" web page to look like the suggestion I made further up. Who is currently responsible for maintaining the web site? Would the edits I’ve done be helpful in any way? I’d be more than willing to submit them.

send a PR to https://github.com/haiku/website/

guide source is in content/guides/booting.md

Patches Welcome!