Configure Ubuntu Linux GRUB to load FreeBSD

by on March 17, 2006 · 14 comments· LAST UPDATED April 26, 2008

in , ,

Recently my friend emailed me an interesting scenario. He installed FreeBSD 6.0 / 7.0 in the first primary partition (10G). One day he installed Ubuntu Linux. He can boot into Linux but not able to boot into FreeBSD. Now, my friend wanted to boot both FreeBSD and Ubuntu Linux via Grub boot loader.

It is not that hard to configure grub to boot FreeBSD. You just need to add following three lines to grub configuration file (/boot/grub/menu.lst). Boot into Ubuntu Linux and use text editor to edit the file /boot/grub/menu.lst ( Red hat and friends [ Fedora / CentOS ] try /etc/grub.conf file) :
$ gksudo gedit /boot/grub/menu.lst
OR
$ gksudo vi /boot/grub/menu.lst
Append FreeBSD boot Configuration:

title  FreeBSD 7.0
root   (hd0,a)
kernel /boot/loader

Save and close the file. To see changes or to boot into FreeBSD reboot Ubuntu Linux box.
Where,

  • title FreeBSD 7.0 : Start a new boot entry. User always sees this title and hit enter key to boot os.
  • root (hd0,a) : Actual part is to select the correct root partition. The root option set the current root device to the device, then attempt to mount it to get the partition size. In above example - hd0 is your first hard disk i.e. hda in Linux. In grub hda is hd0. Likewise your first, second partition on the first hard disk – hda1, hda2, becomes hd0,0 hd0,1 in Grub. In short, you are asking to use first hard first partition (remember FreeBSD use a,b,c names to represent partition names). If you have installed FreeBSD on third partition then you need to use following root statement:
    root (hd0,2,a)
  • kernel /boot/loader : Use to load the primary boot image. FreeBSD use /boot/loader to load rest of kernel and os.
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 14 comments… read them below or add one }

1 seaman March 17, 2006 at 11:28 pm

If it does not want to boot you can put something like this:

title FreeBSD
rootnoverify (hd0,0)
makeactive
chainloader +1

it realy works

Reply

2 DJ Tux March 18, 2006 at 1:44 am

GRUB loads the kernel directly and FreeBSD’s bootstrap interface sometimes changes heavily so GRUB can’t guarantee to pass kernel parameters correctly. Thus loading it via very flexible loader i.e. /boot/loader is highly recommend.

@seaman,
Your method is good when unsupported operating systems needs booting via GRUB. But for FreeBSD /boot/loader is highly recommend.

Cheers,

DJ Tux

Reply

3 johan January 3, 2007 at 1:24 pm

Hey,
I dont really understand, I got ubuntu and windowsxp,, now when I start my computer I want to be able co choose one of these, what shoud I put to choose windows xp?
have to ask so I dont do anything wrong,
Thank you,
Johan

Reply

4 nixCraft January 3, 2007 at 1:26 pm

johan,

Do you see Windows XP as boot option? If so just select and enter. If you don’t see an option you need to edit grub.conf

Reply

5 Matrixium August 20, 2007 at 6:33 pm

Hi,
I just install ubuntu on top of window xp. I can boot into ubuntu, but I can not boot into window xp.
when I start my computer I was able to choose window xp as one of the choices to boot. But then the windows xp went to a autocheck,and autochecks fails. then the system restarts itself.
can you help to solve the problem?

Thank you

Reply

6 Marco van de Voort October 21, 2007 at 2:04 pm

Note that partition (label) “c” is special and designates the whole disc.

P.s. it is kind of confronting having to type “linux” as antispam word on a FreeBSD topic :-)

Reply

7 cfchris6 April 1, 2008 at 8:46 pm

/boot/loader did not work for me, I think that is mainly because GRUB is not able to handle the disklabels of BSD correctly because /boot/loader may be in ad0s1a but GRUB looks just in ad0s1, so GRUB does not find anything.

root(hd?,?)
makeactive
chainloader +1

works perfectly and gives all the possibilitiys as a bootloader directly installed on MBR.

Reply

8 John Marino April 26, 2008 at 12:18 am

Thanks for this article.

I was not amused tonight. I have FreeBSD on my primary partition of my primary disk. A few months ago I left 24GB free reserved for a Linux testbed and installed Ubuntu 8.04 tonight. Much to my anger, it wiped out my existing bootloader and I couldn’t get back to my primary OS.

This article pointed me in the right direction — true I am now using grub instead of the freeBSD bootloader but at least I can get to FreeBSD now.

Reply

9 talishte July 8, 2008 at 5:01 pm

Thanks U

Reply

10 Ramanathan September 9, 2008 at 10:56 am

To enable FreeBSD 7 in Ubuntu Gibbon,
Appending this following lines helped me.

title FreeBSD 7
rootnoverify (hd0,0)
makeactive
chainloader +1

Thanks

Reply

11 Ramanathan September 9, 2008 at 10:58 am

****************************************************
To enable FreeBSD 7 in Ubuntu Gibbon,
Appending this following lines in /boot/grub/menu.lst helped me.

title FreeBSD 7
rootnoverify (hd0,0)
makeactive
chainloader +1

Thanks

*************************************************

Reply

12 Ramanathan September 9, 2008 at 11:20 am

————————————————–
****************************************************
Partition Detail
—————-
FreeBSD is installed in the First partition of the primary IDE hard disc. Ubuntu is in second partition.

I tried the first option given in this website.
It too worked.

The following lines are appended.

title FreeBSD 7
root (hd0,0,a)
kernel /boot/loader

Thanks Again. :)

*************************************************

Reply

13 Dheeraj Suthar March 27, 2010 at 4:18 pm

Thanks a lot !!
It saved my day.
However I also used this article to restore my filesystem:
http://neosmart.net/forums/showthread.php?t=1823

Reply

14 oriantho November 28, 2010 at 11:56 pm

salut !! i have blowed my system and i ive tryed to restore with alive cd 1010 ..nothing happen,THEN with a 2009 version ,better but when i start i have a strange console saying :shgrub or rescue grub ,mostly i cant send any command ,the pianno don’t play all the letters proppely ..my question :do we have something to load before the live cd to make it work? a grub?linux ? if yes ,how do i empty ALL on that computer to be sure there is nothing at all before the new setting THANKS from France and please to help you for some kind of help i can O.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , ,

Previous post:

Next post: