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
The first step is to set a FreeBSD kernel variable:
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:
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.