Grub2 won't chainload Haiku

My laptop has a BIOS (pre-EFI). Using systemrescuecd, I partitioned the internal HDD with 2 primary partitions using systemrescuecd, formatted /dev/hda1 as an ext2 boot partition and installed GRUB on it. I downloaded the latest amd64 Haiku ISO and verified the checksum. I downloaded and compiled makebootabletiny. Following the instructions here to the letter, I have copied the iso image to /dev/hda2, using dd. At the GRUB prompt, I type:

set root=(hd0,2)
chainloader +1

Nothing happens. What am I doing wrong?

(I already tried booting from the image on a USB stick. The Haiku bootloader loads, but then says ‘no bootable partition’ and I can’t proceed any further.)

1 Like

The GRUB command should be:

set root=(hd0,2)
chainloader +1

Adding boot is needed for interactive GRUB.

1 Like

Hi @tomkirby and welcome to Haiku!

Let me understand your disk layout. Your partition scheme is MBR with 2 primary partitions: /dev/hda1 with Ext2 filesystem for Linux and /dev/hda2 with BFS filesystem for Haiku. Correct?

I have several ideas on what can be done:

  1. It is not necessary to compile makebootabletiny, this command is included in Haiku Installer and is run at the end of installation process.
  2. Using dd is not a common way to install Haiku. Instead, Haiku has a program named Installer to do this job.
  3. Installer can only detect the suitable partition for Haiku if this partition has the proper type (0xEB) and filesystem (BFS). Both these conditions can be achieved if the partition for Haiku is created using DriveSetup tool from Haiku. It can be launched from Installer.
  4. Grub (is it Grub Legacy or Grub2 ?) enumerate partitions starting with 0, so your first partition is (hd0,0) and the second is (hd0,1). Or, if you use Grub2, you can also write (hd0,msdos1) and (hd0,msdos2), in this case they are enumerated from 1.

So, the best you can do is to just leave some space on your disk for Haiku, then boot from Haiku installation media. Then:

  • Start Installer,
  • From it start DriveSetup,
  • Prepare partition for Haiku in DriveSetup and exit from it,
  • Choose the prepared partition as target in Installer,
  • Press Install and wait for process to finish.

Now, you have to configure Grub to boot Haiku. As it is already mentioned by @coolcoder613 , you can enter in Grub interactive shell within Grub by pressing C key. Here, you have some Bash-like environment to research your partition structure from prespective of Grub and also you can boot Haiku interactively also from here. As soon as you can boot Haiku manually with Grub, you can put the same configuration in your Grub config file.

Honestly, if your partition scheme is MBR, the best is to do the opposite; install Haiku BootManager and chainload grub. For this, you have to install grub on beginning of the partition instead of the beginning of the disk; usually your distribution tools are giving you that choice. The advantages are that you only have to do it once, you don’t have to configure Grub or Grub2, and you can wipe your linux partition, you can still boot Haiku.


Thanks for all the responses.

@alpopa - yes that is my setup.I went for the dd option because booting from a USB drive failed. I have no CD drive so I have to use a USB flash drive. I am using Grub2, not legaacy.

I’ve had another try booting from a USB, but I can’t get past the initial Haiku bootloader screen. In the last 2 lines of the log it says:

getting drive parameters for: 128 failed!
no boot drive!

At the bottom of the menu, it says 'Cannot continue booting (Boot volume is not valid)."

Incidentally after I followed the advice from @coolcoder613 to give GRUB the ‘boot’ command, exactly the same thing happened.

I see how easy the impossibility to boot from removable media can be a problem.

In this case I see 2 possibilities:

  1. Try to boot Haiku in a virtual machine from Linux. Qemu would be sufficient for this. Configure VM to use the downloaded Haiku image as CD and use physical partition /dev/hda2 as a HDD, boot from CD. Of course, in order to access the device, you will need to start virtual machine with root privileges. When Haiku starts, prepare HDD partition with DriveSetup and install Haiku on it with Installer.
  2. Try to bootstrap Haiku from Linux. Unfortunately, I never did this. Basically, you need to clone git repositories for developing Haiku in Linux and then to specify as target the physical partition. Please, do not ask me how to achieve this. My knowledge is very basic on this. I only know it should be possible, but do not know exact details.

P.S. How did you boot systemrescuecd? Or this is the Linux installed on hda1?

That seems like a solid choice to me.
So the command would be:

sudo qemu-system-x86_64 -m 2G -hda /dev/hda -cdrom haiku.iso -boot d -enable-kvm

Then go through the installer as usual, and you should be able to boot haiku from the partition you installed to.
I wouldn’t use -hda /dev/hda2 because then you have to make sure that you do not create a partition table, and format it as a partition.

That’s a bad idea. Just change the permissions on the file so your user has direct access, and change it back afterwards.