When you have multiple Linux OS's on the same computer, each installation has its own installation of GRUB, and the most recent installation is usually the one that is used when booting up. The issue comes up when I can no longer remember which is the most recent installation and I want to make modifications to the GRUB menu. How do I figure out which one is in use short of checking each installation individually? Is there a cleaner setup which avoids the problem in the first place by only having one installation of GRUB?
It sounds like you are installing GRUB in the master boot record of your primary hard disk. As hard disks only have one MBR, only one bootloader can reside in it at a time. You also appear to have told all of your operating systems to install a bootloader.
The proper way to handle this (assuming you want to use the MBR) is to stop GRUB from installing itself to the MBR on any operating systems that you don't want to install GRUB from. The most trivial way to do this is probably to remove the grub package.
Another way would be to have your bootloader installed on a partition and boot from there, but that's not as common.
Ideally you should only install
One way to figure out would be to see the monitor when your computer boots up, there is generally a distribution specific message.
Even if that isn't the case you could make the changes in any distro that you are currently using and then update grub, this will update the grub menu after which you could do a
Also this answer tells you how you can find where the different grub stages are.
Ideally, as nikhil says, "you should only install grub once" then "manually add entries for each new distro that you install", or even more ideally, have fresh installs prompt for the location of your grub files and add their own entry; I think some distros can do this.
Unfortunately, it is not always that simple, particularly if you are messing around with trying new distros you are unfamiliar with, etc. etc., and once your MBR is overwritten you must deal with the tedious task of re-installing your old grub. The MBR is the physical first half kilobyte of the disk (aka. the boot sector), loaded and executed by the PC BIOS (read more), and that's where grub starts, but it then loads more stuff from a partition (eg, the stuff you might find in
So, here's a quick hack/shortcut to dealing with the whole issue: before you install a distro, copy your MBR out. Let the installer do whatever it wants without any fuss, then afterward, 1) put your MBR copy back onto the boot sector, 2) add an entry to the appropriate grub menu.
Step #1 is quite simple, and is in fact a good idea whenever you do an install in case something gets screwed up and you just want to go back to where you started. Beware this does not apply to new Windows formatted UEFI/GPT disks. The boot sector containing the MBR is exactly 512 bytes:
"/dev/sda" should be the physical disk the MBR is on. Notice this is not "/dev/sda1", which refers to the first partition on /dev/sda.
Do your install and boot into the new system. You can then mount where ever you put your MBR backup, and:
Presto! Reboot, and it's like that new install never happened. It is still there in its partition, however, and all you have to do is step #2 add a grub menu entry for it to your old grub menu.
Step 2 is the harder bit, because it requires you scrutinize the
Looking at the rest of
So remember to include that definition if you include a reference to it. Don't be too scared of experimenting here, if it doesn't work, you can still boot your old system and start asking more specific questions ;). Worst comes to worst and you completely screw up grub.cfg, boot a live CD and replace it with the back-up copy you made.
I recommend installing a single version of Grub in your boot sector, the one from your most stable distribution. If you have other operating systems, install their bootloader in the first sector of their own partition and chainload it from the boot Grub. That way, you'll always have a bootable system, and all upgrade mechanisms will work as designed.
Grub's setup scripts are capable of detecting kernels from other Linux installations as well. That's a nice extra, but it is prone to break, for example after you've upgraded a kernel but not booted the main operating system. So use that facility only in addition to chainloading.
(But really, who dual boots nowadays? With virtual machines, you can run all your OSes at the same time!)