Recently in GRUB Category
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 Parted Magic 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
That creates the menu.lst file, into which I typed the following:
default 0 timeout 5title Windows XP
root (hd0,0)
chainloader +1title OpenBSD
root (hd0,1)
chainloader +1
I saved and closed the file (F3 and then ctrl-X in nano) and then rebooted the PC. As yet another aside, here's how I reboot in OpenBSD:
$ sudo shutdown -r now
Upon reboot, GRUB ran and allowed me to choose between Windows and OpenBSD.
I tested both OSes, and both successfully booted.
I'll probably reverse the order so OpenBSD is in the top spot and will boot automatically if I don't purposefully select it. I could also increase the timeout time to have more of a chance to pick one OS or the other, but right now that doesn't seem necessary.
Observations: While documentation in OpenBSD tends to be extremely detailed, it's not always 100 percent correct. The man pages and info pages didn't tell me, for instance, that the grub executables, including grub-install, couldn't be run from the / directory and that the full path to them was needed. I only found that path by poking around in a file manager. Once I did have the path, I was able to use grub-install successfully with the directions as given. Adding the path to the instructions would certainly help others get GRUB working in OpenBSD.
Since both of the OSes on my laptop — Windows XP and OpenBSD have their own bootloaders on their respective root partitions, all GRUB has to do is chainload to the proper partition, after which time the respective systems' bootloaders take over. After using GRUB to dual- and triple-boot GNU/Linux distributions for more than a year, I've discovered that chainloading as much as possible is a very good thing, especially when dual-booting two Linux distros. That way, "automagic" updates to each distro's menu.lst are just about guaranteed to go smoothly.
This technique made things much easier when dual-booting Debian and Ubuntu. When I didn't chainload to one or the other, one of the two OSes never did get the proper menu.lst updates when a new kernel was installed. But by chainloading to all but one of the distros on the hard drive and installing GRUB in all but one of the distros' root partitions, I've avoided countless problems.





Recent Comments
Monstra on CMS and blog software without databases: Monstra CMS is the best flatfile CMS ever! (!) Easy to install, upgr ...
Chris on Running OpenBSD in a live environment with MarBSD-X : Jggimi isn't developing his images anymore. If you want an updated Ope ...
Peter Ljung on Review: DragonFlyBSD 3.0.1 -- the longest DragonFlyBSD review ever -- Part 5: Comparison to OpenBSD 5.0 and closing comments: I have also been fascinated by the Hammer file system and think it wou ...
Anonymous on Review: DragonFlyBSD 3.0.1 -- the longest DragonFlyBSD review ever -- Part 2: My BSDistory: Can you just get to the actual review? ...
Bill Callahan on SugarSync is working on a Linux client, but I'm not unhappy at all with Dropbox: I've been very happy with SpiderOak. It has a native Linux client as w ...
AJ on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: Gnome 2 is still standard in the upcoming SolusOS (Currently at RC 2). ...
Niki Kovacs on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: Since I've moved to Debian stable - with a few tweaks - I've not only ...
Earl on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: I use Mint 12 and LMDE based on Debian testing. Both are plagued by G ...
Alan Rochester on Debian Stable -- set it and forget it -- spoils me for fresh Linux Mint 12 on some very nice ZaReason hardware: "mint does have a separate xfce edition afaik.." The Debian version o ...