How do I prevent two OSes from clobbering grub files?
Solution 1:
You're going to have to tell one OS or the other not to automatically clobber the GRUB boot sector.
All Linux distros that I've seen have some way to prevent their installation CD from clobbering the boot sector, but it's often in some obscure advanced option.
The majority of GRUB's configuration data is not stored in the very small boot sector, which just contains a small loader program and a pointer to where to find the rest. The configuration data is usually stored in a regular directory in a regular partition on the drive (/boot
under many Linux distros). So unless Solaris is actually going in and monkeying with the data on the Linux partition, it's probably not a huge deal... if one OS clobbers the boot sector created by the other, you can easily recover it.
Solution 2:
Grub is a program just like any other. There is a small section at the beginning of your hard drive (the master boot record) which points which program should be used to load operating systems. This is the thing which gets clobbered when you install a new grub. It is possible, however, to choose not to install grub with a new OS (except Windows, which should always be installed first in a multi-boot system). If you choose not to install grub, you must configure the grub of the original system to recognize the new one. In other words, you control the grub of all operating systems from one (in this case, it looks like solaris would be the best choice if it is that aggressive). From within this OS, adding other options to your grub is very easy. In /boot/grub/menu.lst you can add new options and select their order. For example, I run Ubuntu, Windows, and Gentoo to play around with. My menu.lst contains the entries:
title Ubuntu 8.04.1, kernel 2.6.24-18-generic
root (hd1,0)
kernel /boot/vmlinuz-2.6.24-18-generic root=UUID=887466bc-8a0d-4408-
17a-91ec1cfd9f2a ro quiet splash vga=795
initrd /boot/initrd.img-2.6.24-18-generic
quiet
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1
title Gentoo Linux 2.6.25-gentoo-r7
root (hd0,1)
kernel /boot/kernel-2.6.25-gentoo-r7 root=/dev/hdb2
Each of these contains basic information about the system I want to load, including name, hard drive location (disk and partition) and where on that disk the thing to load is. Notice, since Windows wants to load itself, we let grub know that its going to chainload by finding the Windows bootloader on disk 0 partition 0 (right at the beginning), and running that instead. For a linux system, you really only need the name, root drive, and kernel location to add a new on to your grub menu.
If you later install a linux, and do forget to skip grub installation, you can also copy the menu.lst from one to another.