EFI bootloader installation

Tested a UEFI x86_64 install on QEMU 9.0.2. There seems to be no option to install the EFI boot loader, so cannot boot a new install.

Tested BIOS x86_64 install on QEMU 9.0.2.
Using GPT , no boot posdible
Using MBR, boots ok.

Also have random KDL when using virtio network instead of emulated e1000.

Select “live mode”, and copy the contents from the install thumb drive to the esp of the new install

1 Like

Thanks, I have heard this before but had forgotten about it. I am guessing it already exist in the backlog to add this to the installer, otherwise we should make a ticket for it. I do not recall this was written in the install/partition instructions provided in the installer.

I updated these instructions recently which may be helpful.

2 Likes

These instructions worked for me, but I had to change the case on some of the commands! Can you change it so that “EFIBOOT” is in all-caps everywhere in the command block, like so:

mkdir -p "/EFIBOOT/EFI/BOOT"
cp "/system/data/platform_loaders/haiku_loader.efi" "/EFIBOOT/EFI/BOOT/BOOTX64.EFI"
2 Likes

Does it matter? Should work with lower caps too!

This part is the label given to the ESP partition. It totally depends on the first system that was installed and created it. Sometimes it contains caps, sometimes not, sometimes it doesn’t even have a label.
So, it’s difficult to give precise instructions that will work for everyone.

2 Likes

@brunobastardi Again, it depends of the system installed. In most cases, the ESP is of FAT type and that file system is indeed not case sensitive. But once the system started, the partition label often becomes the mountpoint name and so goes with the rules of the host file system.
Note also that it can happen that other file systems are used for ESP even if its not frequent.

“EFIBOOT” is in all-caps everywhere in the command bloc.

That worked for me, but if you try to install Windows 11 after, the system partition with EFIBOOT on it is with 64MiB to small to install Windows 11, should be bigger, I tried 200MiB and I could install Windows 11 then, but not sure if it works with refind after install!?

Is there a reason n the installation guide specifies 64mb for this partition? With the haiku boot loader it seems much bigger than needed, even allowing a bit of headroom for later versions.

Changing this later is really annoying if you’ve installed anything. So it’s better to be a bit more gracious with space. Normally I pick about 256mb for those partitions on my system.

And yes, headroom is one idea. Ideally the system will be able to update the efi loader on itms own, and similarily to the rest of the OS allow you to use an earlier version to recover from faults in newer versions.

1 Like

Okay, I did have 16mb when playing about with the nightly but when I did a clean install with the release of Beta5 I took the opportunity to make it bigger (the install guide says “thou shalt allocate 64mb” so I did). I did however have remorse after doing so because the smaller size seemed plenty and I like everything to be elegant.

I also hate wasting disk space like that. So I will use old-fashioned BIOS booting whenever possible. UEFI is Microsoft’s answer to a question nobody was asking.

Still, until it does actually get used as @nephele indicates, could that FAT32 partition provide space for temporary files and so on? Or is it a special kind of partition that must never be mounted and used under any circumstances?

It’s not special as such, however to me it seems a bit dangerous to mount it in a strict risk vs reward thing, there is very little space to use and I might accidentally brick my system when deleting the bootloader.

That beeing said, if you have the skills to fix the bootloader again later on then there is not much preventing you from doing this.

Only potential downside might be something like refind searching the entire esp for efi files, and could potentially be slower on a full esp. But that would likely only slow down the boot slightly.

It solves many problems for operating system and bootloader developers. BIOS is old and quirky, it requires the system to boot in 32 bit legacy mode and then switch to protected and then to 64 bit mode. It requires running an x86 CPU emulator to run the vesa bios code while the os is running. Booting from a CD requires a bootloader that fits on a floppy image stored in the CD and the BIOS will emulate a floppy drive. Typically bootloaders will not need a partition, but just use some hard disk sectors near tho start of the disk and hope you don’t decide to create a partition there and overwrite it.

You don’t get to see all of this as a user, because operating systems worked quite hard to integrate it in a way that makes sense (most of the time). But it’s not uncommon to see boot problems because a partition wasn’t activated, the mbr bootcode was not installed, etc.

UEFI does solve very real problems and makes things simpler for us. Now we have some work to do to forward this simplicity to end-users

3 Likes

for me it makes only troubles as I am not able to choose the booting partition or drive easily!
Never got HAIKU to work with WINDOWS 10 or 11 with UEFI and refind!
If I got it running the next WINDOWS update will erase or alter the UEFI settings!

I’m not a friend of UEFI or EFIBOOT because of this problems!

How to make refind booting allways at start?

Here is how EFI normally decides what to boot:

  1. Check the EFIVars for a nextboot entry
  2. If that doesn’t exist try each configured boot entry in order
  3. if those don’t exist try the fallback entry from the ESP

Now, usually Haiku is installed in a way that we “just” hope step 3 does it for us, but ideally we should have a proper entry in the efivars, using step 2. And that will allow us to have the bootloader in a known place, have it have a user visible name, allow us to upgrade it without removing the old version. Expose the esp with a bootloader as a filesystem to users (because it is a filesystem) etc.

EFI allows us the Operating system to choose the next target to boot, all without ever touching the firmware as a user. Windows uses this “reboot to firmware settings” does that. Haiku simply lacks support for this, this is a we didn’t get around to it problem. Not an EFI sucks problem.

Windows chooses to overwrite the fallback bootloader. If you want to use refind to boot windows then:

  1. install it in some location in the ESP
  2. Create a boot entry in the efivars for it, and set that as a default.

On another note, haiku can be installed like this too, but this (currently) requires the help of another OS. for example linux or windows, to set the proper efivars entries.

3 Likes

These instructions worked for me, but I had to change the case on some of the commands!

Hello @summermusic ; I am unsure what change you wanted to make here. The commands look the same to me. Can you please raise a PR into the web site to make whatever change you think is needed here?

Sounds ok, but where to find and edit the efivars file?

Is it possible to set the fallback bootloader to refind then?

How should edited refind config.efi files should look like to boot HAIKU and WINDOWS?

Are there any HAIKU user here, using refind-boot with HAIKU and WINDOWS?

Does every HDD, SSD or USB-Drive need a UEFI partition?

efivars is not a file. It is a firmware interface and requires specialized OS support to modify. Hence why I said to use linux or windows.

This is the tool to interact with it in Linux: efibootmgr(8) — Arch manual pages

No, the fallback is not set. It is a specific file path. If windows overwrites this with windows-es loader you can’t just put refind there, it will overwrite it again. Instead install refind in it’s own dir, add an entry pointing to it. and maybe customize the config if you want, it is pretty easy to configure since the config has documented every entry what it does.

But normally it should run fine without config too.

rEFInd has all this documented:
Install from linux: The rEFInd Boot Manager: Installing and Uninstalling rEFInd
Install from Windows: The rEFInd Boot Manager: Installing and Uninstalling rEFInd

2 Likes