Installing GRUB on FreeBSD
25 February 2008
Installing GRUB onto a FreeBSD system isn’t that hard - if you know how.
If you just run grub-install as root - which should normally work - you might see an error like this:
# grub-install hd0
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> root (hd0,1,a)
Filesystem type is ufs2, partition type 0xa5
grub> setup –stage2=/boot/grub/stage2 –prefix=/boot/grub (hd0)
Checking if “/boot/grub/stage1″ exists… yes
Checking if “/boot/grub/stage2″ exists… yes
Checking if “/boot/grub/ufs2_stage1_5″ exists… yes
Running “embed /boot/grub/ufs2_stage1_5 (hd0)”… failed (this is not fatal)
Running “embed /boot/grub/ufs2_stage1_5 (hd0,1,a)”… failed (this is not fatal)
Running “install –stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/menu.lst “… failed
Error 29: Disk write error
grub> quit
The first step is to set a FreeBSD kernel variable:
sysctl kern.geom.debugflags=16
This will make the master boot record (MBR) writable, which is normally where the boot record is installed. Unless you do this, you will receive the error above.
Once the variable is set, the program grub-install should work fine with your chosen drive. The menu is in /boot/grub/menu.lst; here is a starter example for FreeBSD:
title FreeBSD
root (hd0,0,a)
kernel /boot/loader
The loader is the “kernel” in this case, as it will load the FreeBSD kernel anyway and it allows you the ability to drop into the boot console if you want.
7 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
FreeBSD vps | 26 February 2008 at 11:27 am
Good info — GRUB is pretty cool since it is so flexible. Also it is needed to run FreeBSD under Xen virtualization due to real mode/protected mode issues with the default bootloader.
2.
ddouthitt | 26 February 2008 at 3:51 pm
Another thing that I noticed - it reconfigures the screen to 640×480 - which means my FreeBSD boot splash now fills the screen! Nice…. I’d been trying to do that.
3.
FreeBSD News - quick link&hellip | 19 April 2008 at 2:50 pm
[...] Installing GRUB on FreeBSD [...]
4.
ddouthitt | 21 April 2008 at 8:48 am
Update: grub apparently didn’t do what I thought. Something in my BIOS or video card must be not be set or reset during bootup; now the boot splash is back to its normal “squeezed”" size (rather than the full screen size). Same display - same physical resolution (pixel count) - different physical size. Sigh.
It still comes out alright (kdm fills the screen, as does X) but still, its an annoying niggle.
5.
locky | 1 May 2008 at 7:45 am
Thank you very much.
You really help me.
6.
monsun | 4 May 2008 at 3:19 pm
Thanks a lot, it works
7.
GRUBówka « Blogavo&hellip | 4 May 2008 at 5:40 pm
[...] Blogavo Opis zasadniczo nic nie zawiera « Majufka GRUBówka maj 5, 2008 GRUB się skompilował. Trzeba było zmienić dwie deklaracje w main.c (linie 57 i 59 o ile pamiętgam), usunąć static. GRUB się zainstalował, hint dot. jego współpracy z FreeBSD jest tutaj. [...]