Adding Haiku to GRUB2 in Ubuntu 9.10

Tip submitted by Jorge G. Mare on Tue, 11/10/2009 - 19:19
Haiku version: 
Not applicable
Revision number: 
N/A

The recently released Ubuntu 9.10 -- also known as Karmic Koala -- uses GRUB2 by default. This new version of GRUB handles the configuration of the start menu displayed during boot differently. Here is how to add Haiku to GRUB2 in an Ubuntu 9.10 installation.

Adding Haiku to the GRUB start menu

From Terminal, enter the following command to open the 40_custom file:

~$ sudo gedit /etc/grub.d/40_custom

Add the following lines:

menuentry "Haiku" {
    set root=(hd0,1)
    chainloader +1
}

The hd0,1 portion should be changed to match the disk and partition numbers where your Haiku installation is located; in the above case, hd0,1 corresponds to the first partition (identified by the number "1") on the first disk (identified by "hd0").

Then save the file and close the editor.

Making sure the GRUB start menu is enabled

Depending on your installation, the GRUB start menu may not be disabled by default, so you need to make sure that it does appear during boot. To do so, use the following command from Terminal to open the GRUB configuration file:

~$ sudo gedit /etc/default/grub

Then look for the following line...

GRUB_HIDDEN_TIMEOUT=0

...and comment it out if it's not already (there should be a "#" character at the begining of the line; if there isn't one, add it). Finally, save the file and close the editor.

Updating GRUB so that the changes take effect

The last step consists of updating GRUB so that the changes you made take effect and the start menu including Haiku is displayed during boot. For that, simply run the following command from Terminal:

~$ sudo update-grub

You are now set. Reboot Ubuntu, and when GRUB2 displays the start menu, you should now be able to select your Haiku partition to boot from it.

Comments

jeanmarc's picture

tks

Thanks for the tips, I was still booting on the CD to point toward my haiku partition ;)

BTW: you've probably mean: sudo gedit /etc/grub.d/40_custom

Jorge G. Mare's picture

Yep, that's what I meant. :)

jeanmarc wrote:

Thanks for the tips, I was still booting on the CD to point toward my haiku partition ;)

Glad the info was useful. :)

jeanmarc wrote:

BTW: you've probably mean: sudo gedit /etc/grub.d/40_custom

Yep, that's what I meant. :) It's fixed now. Thanks!

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Hi. Thanks for the code. I entered this in Linux Mint 8 and it worked great right away. Then I replaced Mint with ZevenOS 2.0 so the whole computer would be BeOS themed, then I tried to add the Haiku partition to the GRUB. I must have entered it a hundred times always checking the syntax. I explored all the files referenced in grub.cfg. I redid it one more time and Haiku finally came up in Grub. It is now quarter to 4AM and I can go to bed happy. Thanks again. This computer is configured just the way I want it.

-Chris

Jorge G. Mare's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Visitor wrote:

...I redid it one more time and Haiku finally came up in Grub. It is now quarter to 4AM and I can go to bed happy. Thanks again. This computer is configured just the way I want it.

Glad I could help. Enjoy your Haiku computing!

natgab's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Hi, can you help with my Xubuntu 10.04? Its using GRUB2 and I can't get it to show Haiku after following instructions above. My Thinkpad has the following partitions:

dev/sda1 - Windows XP

dev/sda2 - Haiku r2

dev/sda3 - Xubuntu 10.04

dev/sda5 - Home

dev/sda6 - swap

Last 3 partition were made automatically by Xubuntu on install out of free space. Haiku seems to work OK on the USB stick. thanks

Jorge G. Mare's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Hi natgab,

A few things to look into...

Make sure that the "set root=(hd0,1)" line in your 40_custom file is not pointing to the Haiku partition. You can use "sudo fdisk -l" from Terminal to corroborate the path.

Also make sure that you have in fact saved the 40_custom file after you have added Haiku to it and before you run "sudo update-grub" from Terminal.

If that does not work, please post the output of "sudo fdisk -l" and your 40_custom file.

Sirpecangum's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Thanks for your help!

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Jorge,

Let me give you the information, since I can't seem to see where I am messing up. BTW: for those of you interested, I'm using a Thinkpad x40 model #2371-8EU, in case someone want to test it out.

fdisk:

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x21c0a40b

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2568 20627428+ 7 HPFS/NTFS
/dev/sda2 2569 3082 4128705 b W95 FAT32
/dev/sda3 3083 4864 14313915 5 Extended
/dev/sda5 3083 4783 13663251 83 Linux
/dev/sda6 4784 4864 650601 82 Linux swap / Solaris
________
40_custom file:

#!/bin/sh
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.
menuentry "Haiku" {
set root=(hd0,1)
chainloader +1
}

Jorge G. Mare's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Visitor wrote:

Let me give you the information, since I can't seem to see where I am messing up

Since you have Haiku on dev/sda2, that is, the second partition of the first hdd, your set root line should read:

set root=(hd0,2)

Modify the 40_custom file, run sudo update-grub again and see if that does the trick.

Good luck!

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Jorge,

I typed the information into the [set root] line in the [40_custom] file, GRUB2 update and nothing. I checked in Gparted and according to Xubuntu, the dev/sda2 partition is listed as unknown, with a red exclamation point.

I made it FAT32 before this installation, should it be ext3? Does it matter how I format the partition before installing Haiku? I had Puppy Linux in the partition as an ext2 partion and GRUB2 found it perfect.

Windows partition is marked normal as NTFS. Did you do this on a triple boot or Linux/Haiku boot ?

natgab

Jorge G. Mare's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Hi natgab,

Visitor wrote:

I typed the information into the [set root] line in the [40_custom] file, GRUB2 update and nothing.

And by nothing, you mean that Haiku does not appear in the GRUB menu at bootup, right (just making sure)?

Quote:

I checked in Gparted and according to Xubuntu, the dev/sda2 partition is listed as unknown, with a red exclamation point.

GParted does not seem to support BFS (BeOS/Haiku native file system), so this is expected.

Quote:

I made it FAT32 before this installation, should it be ext3? Does it matter how I format the partition before installing Haiku? I had Puppy Linux in the partition as an ext2 partion and GRUB2 found it perfect.

I don't think it matters, as long as you format the partition with DriveSetup prior to installing Haiku (which I assume you did). You can check the Haiku Installation Guide for details:

http://www.haiku-os.org/get-haiku/installation-guide

Quote:

Windows partition is marked normal as NTFS. Did you do this on a triple boot or Linux/Haiku boot ?

I have had this very same setup (Win XP/Haiku/Ubuntu with boot+home+swap) at one point, and it worked OK.

Can you please paste the "sudo update-grub" command output? Maybe that provides some hints.

natgab's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

jorge.mare wrote:

Hi natgab,

Visitor wrote:

I typed the information into the [set root] line in the [40_custom] file, GRUB2 update and nothing.

And by nothing, you mean that Haiku does not appear in the GRUB menu at bootup, right (just making sure)?

---Correct, Haiku does not show up.

Quote:

I checked in Gparted and according to Xubuntu, the dev/sda2 partition is listed as unknown, with a red exclamation point.

GParted does not seem to support BFS (BeOS/Haiku native file system), so this is expected.

---Just wanted to make sure it was not a bad install.

Quote:

I made it FAT32 before this installation, should it be ext3? Does it matter how I format the partition before installing Haiku? I had Puppy Linux in the partition as an ext2 partion and GRUB2 found it perfect.

I don't think it matters, as long as you format the partition with DriveSetup prior to installing Haiku (which I assume you did). You can check the Haiku Installation Guide for details:

http://www.haiku-os.org/get-haiku/installation-guide

---Yes. I put a Haiku CD in my main PC, installed to USB stick. Then used the USB stick to boot from it on my Thinkpad X40, that does not have a CD/DVD (like netbook). So I think I did it right.

Quote:

Windows partition is marked normal as NTFS. Did you do this on a triple boot or Linux/Haiku boot ?

I have had this very same setup (Win XP/Haiku/Ubuntu with boot+home+swap) at one point, and it worked OK.

Can you please paste the "sudo update-grub" command output? Maybe that provides some hints.

---Here it is:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-22-generic
Found initrd image: /boot/initrd.img-2.6.31-22-generic
Found linux image: /boot/vmlinuz-2.6.28-11-generic
Found initrd image: /boot/initrd.img-2.6.28-11-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows NT/2000/XP (loader) on /dev/sda1
done

Screenshot from laptop booting off USB, maybe this will help too:

http://yfrog.com/0ghaikuj

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

same happens to me on ubuntu lucid. i added menuentry to 40_custom as above, run sudo update-grub but in output i don't see any haiku partition. only ubuntu and winblowz

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

after surfing i have found this. maybe it will help:

http://www.haiku-os.org/community/forum/adding_haiku_grub2_menu

Visitor's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Great tip!

After I set this up for a gcc4 installation I wanted to add a gcc2-hybrid partition. I've added a new file for it "50_custom" and copyd and adjusted accordingly for the new partition and added it to the boot list in grub2.
Working like a charm now!

Greetings Begasus

admin's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Glad it was useful Begasus!

natgab's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

Jorge, I want to let you know I finally got Haiku dual booting on my Thinkpad X40 from way back in September (see above). I recently wiped the laptop from the dual XP/Xubuntu 10.04 which I had been running to try to install Windows 7 (no success, but does work for others).

So with a clean slate, I installed Xubuntu 10.10, since it has a better integration of Grub2. Shrank partition and left half of HD formatted to FAT32. Used my Haiku USB to install to HD. Ran your instructions and it worked like a charm on third try. Only problem was I spelled grub, as grab the first two times. Doh!

Just wanted to let you know and let people know that the Thinkpad X40 is a great netbook size Haiku computer.

Jorge G. Mare's picture

Re: Adding Haiku to GRUB2 in Ubuntu 9.10

natgab wrote:

Jorge, I want to let you know I finally got Haiku dual booting on my Thinkpad X40 from way back in September (see above). ...

Glad to know it also worked for you and that you are now enjoying Haiku on your laptop.