1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Howtos and FAQs (Moderated)' started by gr1ml0ck, Jun 30, 2009.

  1. gr1ml0ck

    gr1ml0ck New Member

    Messages:
    32
    Likes Received:
    0
    NOTE: THIS GUIDE ONLY APPLIES IF YOUR PRIMARY O/S IS LINUX!!!

    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.

    DONT PANIC!!!

    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:
     sudo grub
    This will take you to the Grub command prompt.

    Then type:

    Code:
     find /boot/grub/stage1 
    This should bring you a result back similar to this:

    Code:
     grub> find /boot/grub/stage1
     (hd0,0)
    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:
     root (hd0,0) 
    Obviously here replacing (hd0,0) with the returned result from the previous command.

    Now type (also at the >grub prompt):

    Code:
     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:
    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
    quiet
    
    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.

    ;)
     
  2. skido

    skido New Member

    Messages:
    22
    Likes Received:
    0
    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.....
     
  3. PhenomII

    PhenomII New Member

    Messages:
    58
    Likes Received:
    0
    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.
     
  4. mechanic

    mechanic New Member

    Messages:
    35
    Likes Received:
    0
  5. Yampress

    Yampress New Member

    Messages:
    36
    Likes Received:
    0
    grub-install /dev/ad0 ...
     
  6. Szputnik

    Szputnik New Member

    Messages:
    1
    Likes Received:
    0
    Very useful post. Thanks!!
    My entry for FreeBSD looks like this:

    Code:
    title           FreeBSD 8.1
    rootnoverify    (hd0,a)
    chainloader     +1
    
    Using chainloader was necessary, as my grub doesn't recognize UFS2.
     
  7. sk8harddiefast

    sk8harddiefast Member

    Messages:
    2,011
    Likes Received:
    5
    Well. I will not use it but I also believe that is a useful post :) Well done!
     
  8. joba1984

    joba1984 Guest

    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