Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Fixed Windows - But Now Grub is Gone?

10 Feb 2010   #1

Fixed Windows - But Now Grub is Gone?

Windows Seven Forums addresses topics related to Windows not Linux. However, as a courtesy for those Windows 7 users who may also dual boot with a Linux OS, this thread will briefly show how to easily restore the Linux Grub boot loader after a Windows repair has overwritten Grub.

I will use the Ubuntu 9.10 Install CD to make the repairs. It does not matter what Linux distribution you are dual booting, Grub is a Linux based program and is much the same for all. You can also download and burn the Ubuntu CD and use it as described without altering your Linux disrtibution.

Here's how:

Boot to the Ubuntu CD (or the Linux Live CD of your choice)
You must first select a language:

Name:  grub_fix_01.PNG
Views: 75
Size:  40.0 KB

Then select "Try Ubuntu without any change to your computer"

Name:  grub_fix_02.PNG
Views: 24
Size:  41.0 KB

The Ubuntu Live CD will load and the Ubuntu desktop will appear.
Open a "Terminal"

Name:  grub_fix_03.PNG
Views: 29
Size:  105.9 KB

In the terminal type: sudo fdisk -l (that is a small L for list)

You must find the /dev/sda number of the partition for your Linux OS
In this picture it is /dev/sda7

Next type: sudo mount /dev/sda7 /mnt (use the Device ID for your Linux)

Then type: sudo grub-install --root-directory=/mnt/ /dev/sda (with no number)

Name:  grub_fix_04.PNG
Views: 105
Size:  141.3 KB

When successful, type: exit

Name:  grub_fix_05.PNG
Views: 27
Size:  65.9 KB

Restart and you should have a restored Grub menu to boot from.

Name:  grub_fix_06.PNG
Views: 48
Size:  15.8 KB

As a final step, if necessary, boot into Ubuntu and open the "Terminal".
Type: sudo update-grub

Name:  grub_fix_07.PNG
Views: 45
Size:  24.3 KB

The Grub menu will refresh adding any missing Operating Systems.

My System SpecsSystem Spec
21 Feb 2010   #2

Windows® 8 Pro (64-bit)

Awesome work mate.
My System SpecsSystem Spec
21 Feb 2010   #3


Quote   Quote: Originally Posted by Dinesh View Post
Awesome work mate.
Thank you, Dinesh.
My System SpecsSystem Spec

27 May 2010   #4

Windows 7

Thanks a lot Dinesh, you've saved me untold hours of frustration. Now I can get things done! I was afraid it was a hardware issue. But as your post suggested, perhaps grub was overwritten due to a Windows repair.

Now I'm curious how this happens. First, I did not perform a Windows repair directly before this problem started happening. Second, everything was working fine for 2-3 days; Ubuntu 10.04 and Windows 7 were both installed with no problems. Nothing in my setup, to my knowledge, was altered to effect this change of GRUB.
My System SpecsSystem Spec
27 May 2010   #5

Windows® 8 Pro (64-bit)

Quote   Quote: Originally Posted by dajohnson89 View Post
Thanks a lot Dinesh, you've saved me untold hours of frustration. Now I can get things done! I was afraid it was a hardware issue. But as your post suggested, perhaps grub was overwritten due to a Windows repair.

Now I'm curious how this happens. First, I did not perform a Windows repair directly before this problem started happening. Second, everything was working fine for 2-3 days; Ubuntu 10.04 and Windows 7 were both installed with no problems. Nothing in my setup, to my knowledge, was altered to effect this change of GRUB.
Hi, you should thank isuuee for this, not me.
My System SpecsSystem Spec
27 May 2010   #6


Actually it does matter which version of Ubuntu your using and which version of grub your installing. If you have grub-legacy which is grub .97 which was part of the Ubuntu distributions until Karmic koala where grub2 became the default. As far as I know if you have grub legacy installed and the MBR is overwritten, the grub files in Ubuntu are not. So you have to use a Live CD with grub legacy to set it back up. Consequently if your running Grub2 you would use the appropriate cd karmic or lucid to follow this tutorial.

The instructions are correct for reinstalling grub2. I could be wrong here but the fact that the reinstall method only rewrites the MBR is the key it doesn't rewrite the grub files in Ubuntu.

Here is a grub2 wiki for help. At the Ubuntu forums we run into people that have installed both grub versions this way it is a mess but can be fixed. We also see people who have loaded grub into the MS bootloader bcd in the partion this can be fixed as well generaly with using testdisk. Boot Problems:Boot Sector - bootinfoscript

This problem can also be fixed with running the following commands from a W7 install disk.
You will need to boot with your Vista/Windows 7 installation disk. Hit Enter at the language selection prompt then hit "R" to get to the repair section. You can then select the automatic boot repair tool, but it often will not do any good. Then select the command prompt (console) and type in the following commands:
BootRec.exe /fixmbr skip this if you want to retain grub.
chkdsk /r
BootRec.exe /FixBoot
BootRec.exe /ScanOs
BootRec.exe /RebuildBcd

I suspect most people dual booting are using the latest release of Ubuntu or one with grub2 but if not this method of installing grub2 will leave you in a mess, if you have grub legacy.

The last thing really needed when messing with the MBR and figuring out what may have gone wrong, and finding out the version of grub and where it is installed is this boot script. This script would also help a sole MS install as well.

Additionally if your running Jaunty and update from grub legacy to grub2 you have to do a edit for it to work.

The good thing is though that there are people on this forum and the Ubuntu forums that can help you if you have problems, the main point is don't install grub2 as a reload when you have grub legacy.

My System SpecsSystem Spec
27 May 2010   #7



Thank you for taking time to post this extra detailed information. However, I remind you that as I stated, this thread was in no way intended to be the complete authority on Grub, Ubuntu, or Linux distributions. You were kind enough to post to links of web sites that already serve that purpose.

You make a valid point that one should not attempt to use the instructions provided to reinstall "Legacy Grub". As stated the example provided was from Ubuntu 9.10 which installs Grub2. As "Legacy Grub" is no longer being maintained or supported by anyone, who is going to install a current Linux distribution, including Grub2, then uninstall Grub2 and replace it with "Legacy Grub"? In my opinion, anyone competent enough, or determined enough to do that does not need this thread to repair Grub.

I am sure you will agree with me that it is accurate to say that Grub2 is the same across all Linux distributions that include Grub2? And that this Ubuntu 9.10 CD can be used to reinstall Grub2 even if the installed Linux distribution is not Ubuntu?

Thank you also for posting the "bootrec.exe" commands. Here is a Microsoft link to more info on those commands: How to use the Bootrec.exe tool in the Windows Recovery Environment to troubleshoot and repair startup issues in Windows

However, if restoring the MBR boot code to Windows is the goal, an easier way may be the "bootsect.exe" command as described here: MBR - Restore Windows 7 Master Boot Record

My System SpecsSystem Spec
27 May 2010   #8


I certainly wasn't trying to usurp your instructions they are detailed and correct it is just the different grubs can make a difference.

I have never been able to get the auto repair to work myself when grub has been installed in to the MBR, this doesn't mean it doesn't work though. I recognize that the auto repair runs basically the same commands, or so I have been told, but the chkdsk /r command isn't run, I think, which is actually a good one to run this will clean up stuff.

Actually when I have re-installed the MS bootloader to the MBR with a dual boot of W7 and Lucid the bootrec.exe /fixmbr and fixboot alone have worked with no problems, and the commands you posted to reload grub worked to restore grub2.
But I haven't borked my set up by having the bootloaders in the wrong places just reloading them for test purposes.

What happens sometimes is that without running the bootscript it is a guessing game as to where grub has been installed and so this is a key component to getting to the heart of the matter so to speak.

There is a bug in the Ubuntu install as well, that is a gui that comes up asking where grub goes, and if your not sure install it in a partition or all, this is causing some for people who are not sure about grub to install, it in the bcd of Windows, and partitions in general. The testdisk will fix this, but I am more a fan of just manually restoring the bcd boot loader with the full set of commands then restore grub2 with the commands you provide.

Hey we are all here to help each other so it is all good.
My System SpecsSystem Spec
27 May 2010   #9


For testing purposes, I had 5 OSs including Ubuntu 9.10 installed using VirtualBox. I was able to 'bork' and repair successfully several times using the tools mentioned. However, as there are almost always other ways to accomplish the same things, I appreciate your additional info. IMHO, more info is always better than less!

My System SpecsSystem Spec
29 May 2010   #10

Windows 7
Windows 7 hibernation and Grub2 loss

OK, first I ought to correct the thanks. Thanks to isuuee, not Dinesh.

Second, the method of re-installing GRUB with the Ubuntu (10.04) Live CD is NOT permanent. Just now, my boot sequence got caught up in an infinite loop; never reaching GRUB. Imagine my frustration; it has only been two days since I encountered the problem, searched for a solution and implemented it!

I conjecture that Windows hibernate is a culprit, at least in my case. The first time, and this most recent time, that GRUB was messed up, I had Windows 7 loaded, and my notebook slipped into hibernate mode after several hours of inactivity. Fortunately, one can just do without hibernation. In my case, I just repeated the re-installation of GRUB, and everything works fine. I should add that previous to the occurrence of the problem, shutting down and restarting normally under either OS incurred no problems. It was only after hibernation.
My System SpecsSystem Spec

 Fixed Windows - But Now Grub is Gone?

Thread Tools

Similar help and support threads
Thread Forum
Remove Grub - Restore Windows 7
You are dual booting with a Linux OS, using the Grub bootloader menu, and now you want to remove Linux and Grub and restore your Windows 7 boot manager. Here's how: This screen shot shows Windows XP, Vista, Windows 7, and my Ubuntu 9.10 installed on logical partitions (volumes) in an extended...
Installation & Setup
Dual Boot W7/XP using Grub - Can grub assign letters to partitions?
Hi I am looking at Grub4dos since my recent foray into all things bootloaders. I am gaining a little footing with what I can and can't do (practically!) Although it was definitely trickier than I thought (or I just don't have the same time like I used to... ) Anyhow, I am looking at Grub because...
Installation & Setup
Hi users -please post when your problem is fixed (or even not fixed)
Hi everyone now I don't mind spending some time trying to help people and am glad for the hints and fixes I've got off these sites --but it does seem to me to be a trend with some of the newer users that they post a problem --you reply --and these guys never post a follow up --like it worked or...
Chillout Room
Windows 7's hibernate vs grub
win 7 can't hibernate after install fedora (or the other linux distro use grub). please help me.
General Discussion
windows 7 and ubuntu 9.10 with grub beta 1.9. something
hi, i have windows 7 installed on my computer and i decided to install ubuntu 9.10 karmic koala alongside it. it has its own partition and everything and worked fine with the grub beta bootloader. however, apparently i was just too stubborn so i reinstalled the windows 7 boot loader cuz i find it...
Installation & Setup
how to remove grub.. to have windows 7 alone
Hi, I installed ubuntu 9.10 (i think I also installed latest grub or something).. and tried it a bit.. and decided to remove it. I cleaned up the partitions which ubuntu were installed. I followed an instruction from youtube to recover widnows boot.. but it won't work. (Youtube...
Installation & Setup

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 01:55.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App