Recover The GRUB Menu On A Dual-Boot System
Planning ahead to multi-boot Windows and Linux distributions is the way to do it, but what if you end up erasing your boot menu and losing access to Linux? The FOSSwire blog has you covered.
The open-source fans at FOSSwire detail the use of an Ubuntu live CD to get onto a system that Windows or another boot-hogging system has locked up and get things set back up. It’s similar to how one would use GParted or the System Rescue CD to re-partition, but this guide offers a lot more step-by-step detail in how to restore a boot menu you had working fine before, and using an Ubuntu CD (or USB boot image) is probably a bit more comfortable for many than a pared-down partitioning tool.
Having recently rush-installed a copy of the Windows 7 Release Candidate and needing to get my Ubuntu desktop back, I found this link pretty invaluable. Got another hands-on guide for the suddenly boot-less? Post it up in the comments. Restoring an Overwritten GRUB Boot Loader [FOSSwire]
- Next Post: Negotiate Your Salary More Effectively »
- « Previous Post: Use Your Freezer Efficiently To Save Money (and Food)
Comments (AU Comments | US Comments)
@abhiroop: Are you trolling or serious? If you install Windows after installing Ubuntu GRUB will be overwritten in the MBR with the Windows boot loader.
The Thinker
@kirby822:
Sorry if I misled. Basically, my post is about how to add grub to the boot after the windows master boot record wipes it. To make it easier for people to understand, I used the words "re-install". The FOSSwire post has a grub-install command.
Anyway its not a big deal. Both methods work!
I ended up using this guide which helped out since in the comments a lot of strange issues are addressed and solved
[www.howtogeek.com]
I used a method using a liveCD which on the surface seems easier. On the below post, useful comments demonstrate that finding where your group stage 1 is helps out with knowing where to run what.
[www.howtogeek.com]
In my system these commands worked
sudo grub
find /boot/grub/stage1
(hd 0,5)
root (hd 0,5)
setup (hd 0)
quit
Pretty much any install CD will work, even non-live CD's, since they all usually have a virtual console you can use to run GRUB and set it up.
BrianB
@kirby822: I'm a little confused too... this LifeHacker post says nothing about reinstalling GRUB, rather recovering GRUB.
BrianB
@Wojtek Swiatek: I third Super Grub Disk, burn that puppy to a CD and its an ultra-fast way to recover GRUB.
BrianB
@abhiroop: I'm a little confused, you say you don't need to reinstall grub, but the title of your post is "HOW TO: Re-install GRUB after windows wipes it out"
kirby822
@Wojtek Swiatek: Wojtek beat me to it. I'll second SGD.
Anthony Gold
For dual/multi-booting, the Neosmart utilities are indispensable. EasyBCD for quick changes and repairs rather than the complicated editbcd in Vista/Win7. And iReboot to quickly choose which OS to reboot to.
[neosmart.net]
I've had better luck with the EasyBCD 2.0 beta.
There is a very good tool which helps a lot in those cases (I used it a few days ago during a particularly convoluted Windows 7 install): SuperGrubDisk ([www.supergrubdisk.org])
It allows, among others, to restore an MBR to natively boot Windows.
I'm a little confused why you would need to re-install grub. It does not go anywhere, just needs to be re-initialised.
I detail the steps in my blog...
[ubuntuextreme.blogspot.com]
By far the most satisfactory long-term solution is to take a little time at the start to define a dedicated GRUB partition to support all your installed OSes, including your emergency tiny DSL/Puppy/Knoppix recovery install.
[www.troubleshooters.com]
[www.supergrubdisk.org]
meehawl
The openSUSE DVD comes with a repair tool; it'll automatically detect if the bootloader isn't working (so it also works for corrupted or badly configured bootloaders) and repair it.
Or if you know your way round you can set up GRUB by yourself in the GUI.
shinchan
I have done this many times. What I did, and what worked for me, is to reinstall the OS using the original disc and tell it to install GRUB. It won't mess with the system (because it can tell everything is newer) and will fix the GRUB problem.
Probably the sloppiest way to do it, but it works.
Nonetheless, since Windows does this to me all the time, I'll be adding this page to my Evernote notebook!
jkrell
I've had more trouble getting rid of the Grub in the past than recovering it. For some reason it is much more pervasive than one thinks.
@Kevin Purdy:
I just did this recently the same way the How-To-Geek suggests and it couldn't be any easier. I think the FOSSwire people's way is a lot more complicated.
@Wolverine4444: Sorry for (triple) posting, but I always liked to use GAG (before my linux partition died). I think it's because of the pretty graphics. :)
@neely615: That also works, and I'd certainly give the How-To Geek a big up when I could :) But I find FOSSwire's version a little more simple, compared to manually typing out partition table locations.
@Wolverine4444: Well, this, and the fact that udev has never worked on my system. (That's right, I can't install linux 'cause liveCDs don't get past device detection. It may have something to do w/ my NVIDIA PCI graphics card, but I really have no idea. The udev error messages are always different.)
Hope this isn't too off topic...
@The Thinker: why would I be trolling? All I said was that I had a different method of doing it, which I noted in my blog. I was a little confused by FOSSwire's post, but it seems to work (as I tried it out).
This issue was always the thing that kept me from doing a dual boot. Thanks for posting!
I used this a year ago after installing XP on my Windows box. It was a big help.
CatboyMac's angry girlfriend
If you've had windows & ubuntu on your system before, and you (re)installed windows to the same partition (drive), then all you have to do are:
1. Boot to Ubuntu Live CD, click on 'Places' Menu > Removable Media > (Your Linux Partition).
This will mount the partition to /media/disk.
2. Open a terminal, run the command below:
sudo grub-install --root-directory=/media/disk /dev/sda
This will install grub to the first primary partition (sda0).
Note 1: If you have an IDE drive instead of a SATA one, use /dev/hda instead of /dev/sda.
Note 2: In step one, you can check whether you mounted the right partition by double-clicking the icon which will appear on the desktop. If its the wrong one, unmount (via right-click menu) it and try again. Only mounting one partition at a time will ensure that you mount it to /media/disk. If you mount a second partition, it will mount to /media/disk-1 (I think!) If you choose to do it that way, just replace the value of the 'root-directory' switch in the command with the new mount path.
Ashley Wilson
Somewhat related to this issue: has anyone tried 'upgrading' their Win 7 install, just for kicks? When I did, I was floored at how politely the Windows installer noticed I was dual-booting, and it left grub alone. Granted, the "upgrade" was otherwise frakked and I had to do a complete clean install, but maybe there's a chance we won't need to keep restoring grub in the future...?
If you use wubi, it puts your whole Ubuntu partition in a large file and adds an entry for Ubuntu to the Windows boot menu, so it's preserved acruss Windows upgrades.
Coyote
This post is perfect, exactly what I needed.
I usually use the instructions on here: [microdotsagamedev.wordpress.com] to do this after installing Windows on a dual/multi-boot system...it's saved my skin several times. Obviously, if something bigger is wrong with your system, you might need to completely reinstall GRUB, but that doesn't often seem to be the case.
sylvane
Seriously - SGD is on my swiss-army-software-collection.
GlennSekhmet
This is exactly what I've been looking for and why I havent yet installed Win7 RC1 on my pc. This is ndeed invaluable. Thanks
davebm
If you remembered to back up menu.lst before installing, you could always just add the grub menu to the windows bootloader.
[apcmag.com]
Worked like a charm for me
Greg Early
@tonyshangrila:
I tried upgrading to the RC which worked fine, though it knocked out grub at the same time, however, when I upgraded Ubuntu to the latest version it knocked out my wireless connection at the same time, haven't got around to fixing that yet either. Yay.
sylvane