Grub missing after Windows upgrade

If you have a dual-boot machine with Linux and Windows and you update your Windows operating system, your machine will likely boot directly into Windows without giving you your familiar grub boot loader screen.  You may panic and wonder if the Windows update wiped out your Linux installation but don't worry your Linux install is safe and sound -- it's just that Windows overwrote the MBR with its own boot loader and you need to re-install grub.  Your initial reaction will be to use a Linux LiveCD and some terminal commands to restore grub but that often requires mounting the hard disk using a bunch of cryptic commands and even then it might not work if you have a RAID setup.  Instead, I recommend you download and burn the Super Grub2 rescue CD (look for the Recommended download link) and then restart your machine to boot into it.  The screens are a bit confusing but the overall process is really simple so I'll just walk you through it:

1. Use the up/down arrows on your keyboard to select the Everything option and hit the Enter key

2. The resulting screen will show all the versions of the Linux kernel that it found on your computer (don't worry if you see a bunch of entries in the list even if you only have one install of Linux)

3.  Use the up/down arrows on your keyboard to select the highest Linux version in the list and then hit the Enter key

4. Your Linux instance should boot up - yay!  Now, you need to restore your grub boot loader.  To get the right command, open a terminal and run the following (note: this is a safe, read-only command that simply checks for the presence of RAID):

if [[ `sudo dmraid -r 2>/dev/null` =~ [^/dev/sda\:] ]]; then echo sudo\ grub-install\ /dev/mapper/`sudo dmraid -r 2>/dev/null | egrep ^/dev/sda | cut -d'"' -f 2` ; else echo "sudo grub-install /dev/sda" ; fi

5. The result should be something like "sudo grub-install /path/to/your/bootable/partition"  Run that command in your terminal to set up the grub boot loader.

6. Remove the CD and then restart your machine to verify it worked.


Post a Comment

Keep it clean and professional...