Configure Ubuntu Linux GRUB to load FreeBSD

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
$ 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.

  • 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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 14 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
14 comments… add one
  • seaman Mar 17, 2006 @ 23:28

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

    title FreeBSD
    rootnoverify (hd0,0)
    chainloader +1

    it realy works

  • DJ Tux Mar 18, 2006 @ 1:44

    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.

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


    DJ Tux

  • johan Jan 3, 2007 @ 13:24

    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,

  • 🐧 nixCraft Jan 3, 2007 @ 13:26


    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

  • Matrixium Aug 20, 2007 @ 18:33

    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

  • Marco van de Voort Oct 21, 2007 @ 14:04

    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 🙂

  • cfchris6 Apr 1, 2008 @ 20:46

    /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.

    chainloader +1

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

  • John Marino Apr 26, 2008 @ 0:18

    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.

  • talishte Jul 8, 2008 @ 17:01

    Thanks U

  • Ramanathan Sep 9, 2008 @ 10:56

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

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


  • Ramanathan Sep 9, 2008 @ 10:58

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

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



  • Ramanathan Sep 9, 2008 @ 11:20

    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. 🙂


  • Dheeraj Suthar Mar 27, 2010 @ 16:18

    Thanks a lot !!
    It saved my day.
    However I also used this article to restore my filesystem:

  • oriantho Nov 28, 2010 @ 23:56

    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 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.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum