DUAL BOOTING LINUX & FreeBSD - How to restore grub if Bootmgr wipes it out

Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

DUAL BOOTING LINUX & FreeBSD - How to restore grub if Bootmgr wipes it out

Postby gr1ml0ck » 30 Jun 2009, 05:19


If you have a linux machine and your wanting to try FreeBSD on a separate partion... you may encounter the problem where the bootmgr (if installed) will wipe out your grub boot loader who's menu.lst file is exists on your linux drive.


There is a very simple fix to this problem. The easiest way to do this is to use a live cd/dvd distro (any distro will do)

If your live distro takes you directly to the command prompt then obviously skip this next stop (duh!)

If your live distro takes you to a window manager then load a terminal (duh!?*!)

Code: Select all
 sudo grub

This will take you to the Grub command prompt.

Then type:

Code: Select all
 find /boot/grub/stage1

This should bring you a result back similar to this:

Code: Select all
 grub> find /boot/grub/stage1

This tells us the location (by drive and partion) of the correct drive from which to launch our boot manager.

Now.. still at the grub> prompt, type:

Code: Select all
 root (hd0,0)

Obviously here replacing (hd0,0) with the returned result from the previous command.

Now type (also at the >grub prompt):

Code: Select all
 setup (hd0)

And thats the first part done! Now reboot and your original grub boot loader will be restored!! Yippie!!

But hang about... now you have no entry for your shiny new FreeBSD install?!?!

Simply boot into your Linux O/S and enter a terminal. Then find your menu.lst file (usually located in /boot/grub/).

Edit this file using your usual editing program and add and entry to the the file.

Here is an example for you.. obviously replace the partition number with the correct one that you installed FreeBSD on!!

Code: Select all
title           Ubuntu 9.04, kernel 2.6.28-13-generic (recovery mode)
uuid            f452a305-bdba-4f83-97a3-f87ecfdfc34c
kernel          /boot/vmlinuz-2.6.28-13-generic root=UUID=f452a305-bdba-4f83-97$
initrd          /boot/initrd.img-2.6.28-13-generic

title           Ubuntu 9.04, memtest86+
uuid            f452a305-bdba-4f83-97a3-f87ecfdfc34c
kernel          /boot/memtest86+.bin

title           FreeBSD 7.2
root            (hd0,2)
chainloader     +1

Usually on a generic Linux install it will be the same as above as your main partion will be 0,0 your swap partition will be 0,1 and therefore your FreeBSD partition will be 0,2.

I hope that anyone attempting to move into FreeBSD from Linux will find this How To usefull. I'm still very much a noob at this FreeBSD stuff .. but would like to share my journey with others also wishing to do the same.

"Do or Do Not.... there is no try."
User avatar
Junior Member
Posts: 32
Joined: 30 Jun 2009, 04:07

Postby skido » 15 Apr 2010, 15:51

Thank u. I was searching this all the time. I want to move to FreeBSD too. But I don't have a clue, how to setup my wlan. And how to setup a gnome Desktop. Or the ports.....
Junior Member
Posts: 22
Joined: 11 Apr 2010, 20:31
Location: Bamberg/Germany

Postby PhenomII » 07 Jun 2010, 01:54

Thanks, that's a good post. I went the other way 'round, and installed FreeBSD first. Then plugged in a spare drive and installed Fedora 13 for comparison. Frdora happily installed grub and an entry for Frdora. But I was disappointed to NOT find an entry for the OGIGINAL install on the first harddrive; FreeBSD - which Fedora fully recognized. This led to much unscheduled reading on how to configure grub. :(

Thanks again.

[color="Blue"]8.1-PRERELEASE/amd64 [color="Black"]|[/color] AMD PhenomII X3 440 [color="Black"]|[/color] MSI 880GMA-E45 [color="Black"]|[/color] NVIDIA G98 (8400 GS)[/color]

Junior Member
Posts: 58
Joined: 06 Jun 2010, 18:26
Location: the terminal (console)

Postby mechanic » 19 Aug 2010, 16:08

For those with a more recent Linux distro with Grub2 rather than Grub-legacy, these instructions:
work and are easy to follow.
Junior Member
Posts: 35
Joined: 28 Jan 2010, 11:21
Location: UK

Postby Yampress » 12 Sep 2010, 17:40

[CMD=" "]grub-install /dev/ad0 ...[/CMD]
User avatar
Junior Member
Posts: 36
Joined: 08 Aug 2010, 11:37
Location: PL

Postby Szputnik » 11 Oct 2010, 23:28

Very useful post. Thanks!!
My entry for FreeBSD looks like this:

Code: Select all
title           FreeBSD 8.1
rootnoverify    (hd0,a)
chainloader     +1

Using chainloader was necessary, as my grub doesn't recognize UFS2.
Junior Member
Posts: 1
Joined: 11 Oct 2010, 23:18

Postby sk8harddiefast » 12 Oct 2010, 07:31

Well. I will not use it but I also believe that is a useful post :) Well done!
| -------> [color="Blue"]UNIX[/color]. Live Free Or Die! <-------- |
[color="RoyalBlue"]You can say:[/color] I can't do something because is difficult.
[color="RoyalBlue"]You must say:[/color] I tried a lot before say that I can't.
Never Give up.
[color="Sienna"]I am not an BSD expert. But I really want to help.
Don't afraid to ask me anything. If I can I will help!
Nice wallpapers to make your desktop more hardcore :) ---> [color="DarkOliveGreen"]http://forums.freebsd.org/showthread.php?t=13416[/color]
User avatar
Senior Member
Posts: 1981
Joined: 01 Mar 2010, 00:47
Location: Athens, Greece

Postby joba1984 » 17 Jul 2011, 07:44

Thanks for the post ive just started using linux too so i myself am a bit of a noob but i want to gice freebsd a go so i will print this guide off and keep it next to my computer. many thanks gr1ml0ck
fuck off.
Junior Member
Posts: 1
Joined: 17 Jul 2011, 07:28

Return to Howtos & FAQs (Moderated)

Who is online

Users browsing this forum: No registered users and 0 guests