[Solved] GRUB 2 - failing to recognise Haiku

I could do with a little guidance on GRUB 2, please?

Following is a list of the storage devices on the machine I’m trying to get GRUB 2, to boot Haiku off:

 [handy@madmx ~]$ fs
└─sda2 ntfs   win-spinner      XXXX        /media/win-spinner
├─sdb1 ext4   rootMX17         XXXX        /
├─sdb2 ext4   scratch          XXXX        /media/scratch
├─sdb3 swap                    XXXX        [SWAP]
└─sdb4 befs   Haiku            XXXX                     
├─sdc1 ntfs   System Reserved  XXXX                     
├─sdc2 ntfs                    XXXX                     
└─sdc3 ext4   hiding.from.win7 XXXX        /media/sdd3

As you can see, I have installed Haiku on /dev/sdb4 the Haiku installer told me that it was set bootable, & it obviously is using the befs.

Whilst running MX Linux, the OS that has GRUB 2, installed on it & it’s drive, I’ve added the following to the file /etc/grub.d/40_custom

menuentry "Haiku - on /dev/sdb4" {
    set root=(hd1,4)
    chainloader +1

Which I obviously think is correct (though I can always be wrong & it would seem that I must be!?).

When I run grub-update I get the following:

 [handy@madmx ~]$ sudo update-grub
Generating grub configuration file ...
using custom appearance settings
Found background image: /usr/share/backgrounds/MXLinux/grub/MX-Gold1080P.png
Found linux image: /boot/vmlinuz-4.19.0-1-amd64
Found initrd image: /boot/initrd.img-4.19.0-1-amd64
Found linux image: /boot/vmlinuz-4.15.0-1-amd64
Found initrd image: /boot/initrd.img-4.15.0-1-amd64
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Found Windows 7 on /dev/sdc1

Which tells me that GRUB 2, is not finding the partition that I installed Haiku on. When I call Haiku from the GRUB 2, boot menu I get an error that tells me it can’t find the partition.

So all of that is telling me that I’ve edited the /etc/grub.d/40_custom file incorrectly.

Hopefully one of you viewing will see what I’ve done wrong as plain as day & let me know how to fix it?

Thanks for your time. :slight_smile:

P.S. I did make sure that Haiku did actually get installed in the partition.

In our tutorial on Besly.de we have this:

menuentry “Haiku” {
set root=(hd0,1)
chainloader +1

I guess that you followed this guide and so that you’re system is booting in mbr mode. In this mode, the partition that you want to boot has to be set as active. The installer should have done this for you but check anyway.

Is there a way to install and setup grub2 from windows?

1 Like

Hi @handy and welcome to the Haiku community.

You can use Grub (1 and 2) interactively to debug configuration problems. For this, when boot menu shows, press C to enter in command line. After that try to manually enter all the commands between { and } in your code. Do not forget to press TAB for autocomplete. For example, you can write:

set root=(hd1,

and press TAB. Grub2 will list all filesystems found at that device. If this is desired device, one of them is Haiku partition. Copy its name to the line above.

set root=(hd1,gpt4) # or (hd1,msdos4) etc.
chainloader +1

After entering all these commands (this is not to write in configuration) write


And hit Enter. If at this point Haiku boots, this configuration is correct and can be moved (without boot line) to /etc/grub.d/40_custom.

1 Like

Grub does not need the partition to be active.

The tutorial writer told grub2 in his tutorial, so i need to change this?

Sorry, you are right. My bad.

Thank you all for your reply’s. :slight_smile:

OK, I’ve been running this GRUB 2, install on this machine with MX Linux since early 2018. So I know it works. :wink:

@alpopa I just stepped through using the path I have in my OP - set root=(hd1,4)

& I get error no such partition. From GRUB 2.

So my hd1,4 is my problem.

/dev/sdb4 is where GParted (& other software) says my Haiku install is situated. I obviously don’t know why GRUB can’t find that partition?

Active partition eh?

I’ll probably have trouble trying to do that with GParted, I’ll need a terminal command. I’ll boot into MX & see what I can come up with. (I’m writing this lot from a rpi4)

So I just had a look with GParted, in the Menu > Flags tab, it does not list Active at all. But I did notice that the Boot flag was not set. Even though the install is supposed to do that. So I set the boot flag.

It still won’t boot & gives the can’t find partition error?

I’ll search for active & Linux on the web now & see. Strangely I don’t remember ever having to be concerned with the active flag in Linux (not to say my memory is perfect though). But I do remember it back in the day when I did a lot of Windows work…

Active partition is available for MBR partition scheme and is used only in case no bootloader other than MBR bootcode is used (Windows sets its partition active each time it boots). So, Linux, Haiku, *BSD, Solaris, etc usually do not need an active partition (and logical partition anyway cannot be active).

GParted can set a partition active in these conditions. This is not a partition flag AFAIK.

@handy , did you try to see what partitions reports Grub when pressing TAB to autocomplete partition name?

1 Like

Active & Bootable are the same thing - what I’m reading on the web.

No I didn’t do the Tab thing. It is a good idea, I’ll do now.

The installer doesn’t do that, you have to do it manually from DriveSetup. However, that shouldn’t matter when GRUB is used: it doesn’t care if a partition is active or not, since you already explicitly say which partition you want to boot in GRUB configuration.

I’ve not solved it, but I did find an error:

The Linux system considers the drive that I have Linux (& Haiku & GRUB on) to be /dev/sdb - The BIOS considers the same drive to be drive 0 = hd0 . I have been using hd1.

GRUB says that the partition is "hd0,msdos4: Filesystem type bfs - Label ‘Haiku’, UUID … & so on.

When I try to use:

menuentry "Haiku - on /dev/sdb4" {
    set root=(hd0,4)
    chainloader +1

In my /etc/grub.d/40_custom I’m still getting the can’t find partition error (not in those exact words).

Didn’t you just say it was HD0 not HD1?

1 Like

Thanks for that SamuraiCrow, I copied it from my OP & forgot to edit it. oops

I have re-partitioned, re-installed & retried with my now known “correct” path, & remembered to grub-update, AND I booted into my new install of Haiku for the first time.

Thank you all for your help. The c & tab in the GRUB 2, boot menu was the key that got me there alpopa. :slight_smile:


Now that you have it working, don’t change it, but in the next time this happens, you can tell grub to find the device by the partition label or UUID if you use unique names, instead of having to guess it, with the search command. This is also more stable against partition games and disk changes.

Given the layout in your first post, this should set root to the correct device:
search --no-floppy --label --set=root Haiku


You have 2 open curly brackets.
It should be

menuentry "Haiku - on /dev/sdb4" {
    set root=(hd0,4)
    chainloader +1


menuentry "Haiku - on /dev/sdb4" {
    set root=(hd0,4)
    chainloader +1
1 Like