Installing a bootloader

So we’re goin’ down a rabbit hole: a file can contain a partition; a partition in a file is mountable. Maybe I meant “down a wormhole”?

Or, as you may have heard, everything is a file. What’s the problem with that? If that blows your mind, try the other way, again with screenshots in the same message: boot haiku and instead of clicking “install”, click “try”. From there mount the ESP partition and get the efi bootloader.

I’m not sure where you get that idea from, copying data from one partition to another is not a problem.

I’m not sure where you get that idea from either, for Linux, reading from BFS partitions is supported natively (you can’t write, but you can read), and for Windows there is a tool to do it: GitHub - HaikuArchives/ReadBFSWindows: Read a drive with the BeFS file system on it from a Windows PC.

So that’s at least 3 ways to do it: from Haiku, from Linux, and from Windows. surely, one of them can work?

Yes, you can, what’s the problem with that? From a running Haiku install, copy the file from the ESP or from the haiku_loader package (it’s provided in both to make this easier). Once Haiku is booted, if you can’t find it from the EFI partition, get a copy of it from /boot/system/data/platform_loaders.

If you don’t know how to copy that to your EFI system partition from Haiku, copy it elsewhere: on an USB stick, send it to yourself by email, upload it to googledrive, I don’t know, however you usually move files from one system to another?

Then reboot to Linux or Windows and you can finalize the install from there if you’re more comfortable with that.

Your DriveSetup screenshot being scrolled all the way to the right, we can’t see the useful part of the info (which is the left column with the device paths). But there are at least 3 partitions that are “EFI system data”. If in doubt, just copy the bootloader to all 3 of them? As long as you don’t replace any other file, this shouldn’t break anything, and surely one of them will be the right one.

2 Likes

Novel idea, replace grub with haiku bootloader, make life easier, I’ve triple booted haiku windows and linux with haiku boot loader, haven’t set a system up like that in a while, but used to be possible

1 Like

Which one is that? Is it BootManager ? Then apparently it cannot handle EFI boot.

Set efi to legacy boot

Please actually read the topic before replying, the OP is already dual booting with atleast two operating systems.

Grub is not that great but perfectly capable of chainloading an efi file, that is the easy and obvious solution. Not “lol reinstall your entire computer if you want to run haiku”

2 Likes

Got a new screenshot so you can see the drive layout.

I’m still trying to understand where the efi file is on the install media vs. an istalled Haiku.

The install media is an installed Haiku in that media.

The place where you can find the EFI bootloader in install media has already been detailed in previous posts.

  • If you are already running Haiku, you can find it in /boot/system/data/platform_loaders.
  • Whether in Haiku or elsewhere, you can mount the second partition found in the iso and find it there in EFI/BOOT.

As for your system, I don’t really know what you have there. Last screenshot shows at least four drives.

  • A 2.73 TiB drive where you have a 5 GiB haiku partition you are booting from. For whatever reason, there are two EFI partitions in that drive (both FAT32 partitions show EFI system data type in a previous screenshot), the first one already mounted in /no name. Only you can know which one you have setup your firmware to boot from, if any. If in doubt, as already said, try them all. But then, if you are already booting from it, what’s the problem?
  • A DVD drive.
  • A 28.91 GiB drive which seems to be that Ventoy thing. If the problem is booting through that you’ll have to read their instructions. Might not be supported at all.
  • A 14.61 GiB drive of which the details are not shown.

And in a previous screenshot there was yet another drive, of 465.76 GiB, with a 100.00 GiB Haiku installation you were booting from. So again you could already boot it?

The problem is, I can’t boot from the system on my hard drive. Also, I’m unsure where /boot/system (where Haiku’s efi file is) is. Also, this is a strange OS I’m dealing with.

Think I’ve done it; I’m going to reboot and see if it works.

Sort of. When I choose Haiku from Grub, I get the message “Cannot find command: drivemap.”

That’s from your grub config, where I doubt you should be using a drivemap command, if you are booting from EFI. If anything, you’d use that for DOS-like systems.

That’s what I get for not really knowing what I’m doing. I just added some entries with Grub Customizer.

Tried editing /etc/grub.d/40_custom manually, only to be told that Grub can’t find the partition.

Saying you changed something without detailing what you have won’t help anyone trying to help you.

At this point your problem is with grub, not with Haiku. I guess that, despite being your boot manager, you don’t want to learn about it and how to configure it. All you need is to give the chainloader command the path to Haiku’s EFI bootloader, wherever you have put it.

This is a simplified entry from my configuration:

menuentry "Haiku" {
  insmod part_gpt
  insmod chain
  search --no-floppy --fs-uuid --set=root B456-1ADF
  chainloader ($root)/EFI/Haiku/BOOTX64.EFI
}

You may not need the insmod lines, and even the search one if the root variable is correctly setup. I got the B456-1ADF in that line from another entry, but you can get it from lsblk in Xubuntu, it’s the filesystem UUID of wherever you have put the booloader:

# lsblk -o NAME,MOUNTPOINTS,UUID
NAME        MOUNTPOINTS
                      UUID
zram0       [SWAP]    
nvme0n1               
├─nvme0n1p1           A544-D3FB
├─nvme0n1p2           e42d229f-bb34-460b-80cc-4b50fcdf1754
├─nvme0n1p3 [SWAP]    3021cbd8-230e-4c61-8f2a-6faeb8fd6b5f
├─nvme0n1p4           4a2e9c7b3a237549
├─nvme0n1p5 /boot/efi B456-1ADF
├─nvme0n1p6 /boot     d325b9e5-af86-42c4-a662-cd2d169c32c0
├─nvme0n1p7 /home     6acd2eeb-14b1-4dfe-ad4c-8423204b5daf
│           /         
└─nvme0n1p8           35b15a7c-df21-4993-b34d-c76a01e17b76

Are you saying I *don’t * have to copy files every which way? And how do I know whether the root variable is properly set up? What is the root variable?

What I’m saying is that you just have to tell grub where you put the file. Which means you put it somewhere. Which means you copied it.

The root variable is is just that, a variable. For grub, with grub. I have just told you how to set it up: the search command giving it the correct UUID of the filesystem where you copied Haiku’s EFI bootloader. And of course the path to the chainloader command is the path of said bootloader, for which you may have chosen something different from what I have. Really, all that’s left is that you send me your computer and disks and I type it for you.

You don’t need to be sarcastic. I have Asperger’s; abstract concepts like partitions, modules and so on are hard for me to grasp.

Here’s my grub entry:

menuentry "Haiku (local)"{
        set root='(hd0,7)'
        search --no-floppy --fs-uuid --set 44aa2a307fb7d887
        set root='(hd0,gpt7)'
        chainloader /EFI/Boot/haiku_loader.efi
}


Without the quotes around (hd0,gpt7), I think?

menuentry "Haiku (local)"{
        set root=(hd0,7)
        search --no-floppy --fs-uuid --set 44aa2a307fb7d887
        set root=(hd0,gpt7)
        chainloader /EFI/Boot/haiku_loader.efi
}

Hi @jorin. I believe it is more important for you to understand what exactly GRUB has to do and how to achieve this than to strictly follow instructions.

  1. Grub cannot natively load Haiku kernel into memory, so it passes the control to Haiku bootloader, which is /EFI/Boot/haiku_loader.efi. Please check the name, path and partition where it resides, it should be on EFI partition together with other *.efi files. This one is achieved by the last line:

chainloader /EFI/Boot/haiku_loader.efi

  1. All the rest is searching the right partition. This partition should be assigned to root variable. You can set it explicitly as:

set root=(hd0,7)

which is equivalent to

set root='(hd0,7)'

In this case it is 8th partition in whatever partitioning schema (MBR or GPT) because GRUB2 starts counting with 0. Or you can specify to search GPT partition as:

set root=(hd0,gpt7)

which is equivalent to

set root='(hd0,gpt7)'

But attention: this time you set the 7th partition as root. So, (hd0,7) = (hd0,gpt8) in GPT partitioning and (hd0,6) = (hd0,gpt7). You may let GRUB to search the right partition for you by its UUID. In case your EFI partition (not Haiku partition) UUID is 44aa2a307fb7d887, the code is:

search --no-floppy --fs-uuid --set=root 44aa2a307fb7d887

This code searches the partition with filesystem UUID 44aa2a307fb7d887 except on floppy and sets this partition to root variable. So, do not forget to use --set=root, not just --set.

Finally, you can use GRUB capability to find out the right partition for you. When you see GRUB menu, press C for GRUB shell. Inside this shell you can write all the same commands as in configuration file between { and }. So, you can write:

set root=(hd0,gpt<TAB>

By pressing <TAB>, GRUB tries to autocomplete, and lists all partitions it sees on your disk. Take a note of them, identify EFI partition and write down its UUID or its name. Complete the command for setting the root. Next, write:

chainloader /EFI/Boot/haiku_loader.efi

Anytime writing the path you can press <TAB> to autocomplete it. If the GRUB is capable to autocomplete, you are on the right track. After this, inside GRUB prompt write (this is necessary in prompt, but not in configuration file):

boot

And <ENTER>. Haiku should boot this way. When you started Haiku from GRUB interactively, you now can write the configuration:

menuentry "Haiku (local)" {
        set root='(hd0,7)' # This is the 8th partition on whatever partitioning schema
        chainloader /EFI/Boot/haiku_loader.efi
}

Or:

menuentry "Haiku (local)"{
        set root='(hd0,gpt7)' # This is the 7th partition on GPT partitioning scheme
        chainloader /EFI/Boot/haiku_loader.efi
}

Or:

menuentry "Haiku (local)"{
        search --no-floppy --fs-uuid --set=root 44aa2a307fb7d887 # This is partition with UUID = 44aa2a307fb7d887
        chainloader /EFI/Boot/haiku_loader.efi
}

In case of troubles, do not hesitate to PM me.