When I installed OpenBSD 4.4 on my Toshiba Satellite 1100-S101 laptop, I purposefully left Windows XP on the drive. I used the free Linux-based live CD to shrink the Windows partition and leave room for OpenBSD on the hard drive.
The reason I’m so comfortable partitioning a hard drive is because I’ve done it between 50 and 100 times. For my first three or so OpenBSD installs, however, I gave the whole drive over to OpenBSD since I didn’t feel confident setting up a dual- or triple-booting system with it.
So if you ARE comfortable dual-booting lots of Linuxes, Linux and Windows, or what have you, and you have managed to install OpenBSD without killing out your other operating systems, you might want to actually run those other systems, right?
On my most recent OpenBSD install on the Toshiba, I wanted to leave Windows XP on the drive and eventually dual-boot it.
I followed the instructions on the FAQ for installing OpenBSD on a PC with Windows already installed, and I intended NOT to install the OpenBSD bootloader. Well, I didn’t do that, but I also managed somehow to kill out the Windows bootloader on the drive’s master boot record. That meant I couldn’t boot anything.
Luckily the OpenBSD FAQ show me how to boot from the floppy I used for the install (I booted from the floppy because the CD drive isn’t working), drop to a shell and install the OpenBSD bootloader. That was easy enough, but I still couldn’t dual-boot.
You theoretically can use the Windows bootloader to dual-boot with OpenBSD, but since I had already killed it out and don’t have a Windows XP disc to restore it, I turned to GRUB, the bootloader I always use with Linux. It’s a package for OpenBSD, and if your system is set up to install packages (with your PKG_PATH in your .profile if you’re going to sudo, or in root’s .profile if you su to root), you can easily install it.
Since I already added my user account to the sudoers list with visudo, I used sudo at my own shell to install the package. If you su to root instead, use the line with the # prompt:
$ sudo pkg_add -i grub or # pkg_add -i grub
After you install grub, you are presented with a path to the Instructions for setting up grub. Those instructions say to do this:
# grub-install –no-floppy hd0
That didn’t work for me. The reason is that pkg_add puts all the grub packages in /usr/local/sbin, and either by accident or design, that isn’t in my path.
So I instead ran:
# /usr/local/sbin/grub-install –no-floppy hd0
That did work. It installed GRUB in the master boot record as my bootloader.
But unlike in Linux, this GRUB installation didn’t create the menu.lst file that GRUB uses to select and boot the various operating systems.
A look through the man and info pages for GRUB plus a little searching on the Web helped me create a menu.lst.
Before I go into that, it’s worth pointing out that while most Linux systems store that file as /boot/grub/menu.lst, in OpenBSD it’s just /grub/menu.lst. There’s no /boot directory. (Instead, boot is an executable in the root directory, the reasons for which both elude me and seem unimportant at this stage.)
Use any text editor you have installed (vi in the base OpenBSD system; or nano or Geany in my system, both of which I’ve previously added with pkg_add) to create /grub/menu.lst.
Once again, since I have sudo set up, I used it and the nano editor in my shell to create the file. As far as partitions go, on my drive, Windows XP is installed first, followed by OpenBSD. To dual-boot with GRUB, here’s how I created menu.lst:
$ sudo nano /grub/menu.lst
.