There’s a story behind this. I am triple-booting my laptop: Windows XP Media Center 2005, Windows 7 RTM Ultimate, and Kubuntu 9.04. When I installed Kubuntu, GRUB was the boot loader that I chose, and it worked perfectly. However, when I installed Windows 7 RTM, Windows overwrote my GRUB boot loader, so I no longer could boot to Kubuntu.
This is a pet-peeve that I have had with Microsoft’s operating systems for a long time. Linux will happily move things around, so you can boot to either Linux or use the Windows Boot loader to boot up whichever versions of Windows you had installed. Microsoft, however, just writes it’s boot loader over whatever is there—which will break your dual-boot of Windows and Linux (or multi-boots) or Windows and whatever other Operating System (non-Microsoft) you have installed.
I’ve searched the Internet for easy instructions for repairing GRUB—but never really found anything good. Until today, that is. The closest that I found was the Super GRUB Disk or Auto Super GRUB Disk, which didn’t work on Windows 7.
Today, I read an article about the SystemRescueCD releasing their 1.3.0 version. So, I downloaded it and looked for any articles on repairing GRUB with this. I found some very simple instructions, and successfully repaired my GRUB installation. Now I can boot to Windows or Kubuntu with all of the kernels that I had before.
The instructions come from Tutorial on Repairing GRUB. Here they are step by step.
- Boot to the SystemRescueCD or any liveCD for Linux (SystemRescueCD is preferred as it automatically sets you as root). If you booted another Live CD, open a Terminal and either use “sudo” or su to get to the root prompt. The rest of the instructions are assuming that you have a root prompt or will use “sudo grub” to get into the grub program.
- type grub or sudo grub at the prompt (enter your password if necessary)
- At the grub> prompt, type find /boot/grub/stage1
It should return a value such as (hd0,1) or whatever your grub location is (Mine was hd0,3)
At the grub> prompt, type root (hd0,1) or whatever value was returned previously (mine was “root (hd0,3)”)
It should return a value such as filesystem type is ext2fs, partition type 0x83.
At the grub> prompt, type setup (hd0) or whatever the first number in the value you used earlier is.
You should see grub running through some tests then installing itself and your menu.lst file with “Yes” or “Succeeded” depending on the action—then “Done.”.
If you see that it was successful, you can type “Quit” at the grub> prompt.
Something to note. Linux, like most Operating Systems and programs, begins everything from 0—not 1, as you would normally think. So, seeing “hd0,3” would mean the fourth partition on the first physical drive. If you have Grub installed on a second hard drive, it will most likely show up as hd1,x where x is the partition that Grub is installed on.
Typically, your hard drive will have Windows on hd0,0 and then whatever other operating system on hd0,1 or whichever partition it is placed on. In my case, my swap file (Linux’s version of the pagefile on Windows) is on hd0,2, so my actual Linux installation is on hd0,3.
So, if you’re needing to install GRUB or reinstall GRUB, I hope this helps you out.
Have a great day:)