File:  [NetBSD Developer Wiki] / wikisrc / grub2.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Fri Dec 7 23:16:25 2012 UTC (4 years, 1 month ago) by jdf
Branches: MAIN
CVS tags: HEAD
Add a "grub2 on NetBSD" howto written by schreiberstein (

# How to install GRUB2 on NetBSD

This how-to explains the steps needed to install GRUB2 on an existing i386/AMD64
NetBSD-installation. The steps should work on a properly chroot'ed system too.
Tested on NetBSD 6.0 AMD64:

First of all, either download the package, using `pkgin install grub2`, or build 
it yourself from package sources (`/usr/pkgsrc/sysutils/grub2`).

After that, generate a GRUB configuration file, which tells GRUB the positions 
of the operating system(s). The following command will generate such a file, 
while adding your NetBSD system into it's list.

    # grub-mkconfig -o /grub/grub.cfg

Now, install GRUB into your hard drive's master boot record (MBR).
You have to know it's device name for this step (e.g. `/dev/rwd0a`).
Exhange `/dev/rwd0a` with your desired device name, then change `/dev/rXXXa` 
to `/dev/rwXXXd` to access the raw disk, as in the following example:

    Device name :   /dev/rwd0a
    Direct access : /dev/rwd0d

The appropriate `grub-install` command for this drive would be:

    # grub-install --no-floppy /dev/rwd0d

Hopefully, it should return : `Installation finished. No error reported.`
If it does so, simply reboot the system and you should be greeted by a nice
If not, recheck your device names, if that doesn't fix it, search the web for 
the error message.
Even though there aren't that much resources about *GRUB on NetBSD*, you'll
find a lot of information at GNU/Linux-related sites which apply to this 
scenario as well.

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb