Reset GRUB Default System After OS Installation
From time to time I like to test out a new Linux distribution or just an updated version of my current distribution. I've created extra partitions on my hard drive for these test installations. All of the distributions I've tried so far require a boot loader to be installed to the hard drive as part of the process. This creates the minor problem of the test installation taking over the boot process. I prefer to have my main Linux installation handle the booting process. The following steps will show how to hand boot control back to your main Linux installation with the GRUB 2 boot loader.
Re-install GRUB 2
The solution to this problem turns out to be pretty simple. You just need to boot into whichever Linux installation you want to be the default and then re-install GRUB from there. Once you've booted into your desired default OS you'll need to open a terminal window to complete this process with a few simple terminal commands.
What this process is going to do is install the GRUB 2 boot loader to the Master Boot Record (MBR) of your hard drive. What if you have more than one hard drive? How do you know where to install it?
You probably have your OS installed on the first hard drive, but it's best to check anyway. The following command will list the block devices on your computer. This will include your hard drives.
The output from that command should look similar to this, but will most likely be a little different.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 149.1G 0 disk |-sda1 8:1 0 3.9G 0 part |-sda2 8:2 0 39.1G 0 part |-sda3 8:3 0 9.3G 0 part / |-sda4 8:4 0 1K 0 part |-sda5 8:5 0 86G 0 part /home |-sda6 8:6 0 1.4G 0 part [SWAP] |-sda7 8:7 0 9.3G 0 part
In the output, look for the device where your root file system is mounted, (the line with the / listed under the mountpoint.) I've highlighted the line of interest in bold above. You can see in my example that the root file system is on the sda3 partition. Now it's not the partition that matters, but the device. So in this example, the root file system is on the sda device.
Now that you know the correct device, you can proceed with re-installing the GRUB boot loader to the MBR of that drive.
Now there's just one more step to create the GRUB menu.
That's it. Now reboot your system and you should see your chosen Linux installation listed at the top of the GRUB boot menu.