Index of /log/Misc/how-to-get-rid-of-grub

Me

Categories

Archives

2007-Oct
2007-Sep
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug

Mon, 04 Dec 2006

How to get rid of GRUB when removing a Linux distribution

A few days ago, I tried restoring my laptop to its original factory state by running the recovery CDs that it came shipped with. This mostly worked fine, but after the recovery Windows wouldn't boot properly, and the laptop would freeze with only the word GRUB on its screen.

A few people are going to say "Well, install Ubuntu then", but that's not the point here. The point is restoring the system properly, so it can boot Windows again. I agree that this is actually a bug in the recovery software, but the same thing happens when you delete your Linux partitions and re-grow your Windows partition (which is what some people want, after trying a distribution for a while).

First, you have to get the system to boot Windows. To do this, you need a bootable CD image with GRUB on it. It can be a tiny CD image, with only GRUB on it (probably the smallest CD you'll ever burn :))
You can create one like this:

$ mkdir -p iso/boot/grub
$ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso

When you boot that CD, GRUB will start up and give you its shell. From this shell you can start Windows like this (change '(hd0,0)' to something else if your Windows installation isn't on /dev/hda1, see the GRUB manual for more on that):

> root (hd0,0)
> chainloader +1
> boot

Windows should now start. It might ask you to complete some steps of the OEM installation (entering your time zone and username, for example), and then reboot. Just re-enter the GRUB stuff to re-start Windows.

Once Windows is done starting, you have to find the I386 installation directory, either on the installation CD, or on C:\I386 as it was on my laptop, and install the Recovery Console by running C:\I386\WINNT32.EXE /cmdcons.

After doing this, you should reboot the system again (using the GRUB trick) and choose the Recovery Console option from the menu that appears. You will get a very limited shell, where you can type 'fixmbr' to fix the MBR on your boot drive, clearing the GRUB bit and allowing you to start the sytem. To do so, remove the GRUB CD from your drive, and type EXIT at the console.

You should now have a properly booting Windows system, without a hanging piece of GRUB.

Martin, will this also solve the issue of broken Access IBM buttons due to linux bootloader installations?

Posted by sivan at Mon Dec 4 21:42:40 2006 from

Good howto. I was in exactly this position over the weekend. My hard drive that housed Ubuntu died so I was left with my Windows drive and a not-so-helpful MBR. I ended up grabbing a Windows 98 boot floppy and doing a fdisk /mbr . I was looking around for the recovery console but couldn't find it. Thanks for the tip.

Posted by LaserJock at Mon Dec 4 21:43:51 2006 from

Sivan, I have no idea about that issue :)

Posted by Martijn at Mon Dec 4 22:02:31 2006 from

Sivan, I don't know how to make the Access IBM button (which is called ThinkVantage on my ThinkPad) boot the rescue partition, but adding the following entry to your grub menu.lst should allow you to boot it from the grub menu.

title IBM Recovery
root (hd0,1)
makeactive
chainloader +1

Posted by Jonas at Mon Dec 4 22:42:18 2006 from

If you really are getting rid of Linux and reinstalling Windows, factory-style, to the drive, wouldn't it be faster (and fewer steps) to boot a Linux CD, such as the Ubuntu Installer LiveCD, and do
"dd if=/dev/zero of=/dev/hda bs=512 count=1"?

This command simply overwrites the boot sector of the drive (which GRUB modified), thereby allowing Windows to see a completely blank boot sector.  Windows will assume the drive is a new disk, and will likely give you a warning telling you such (to prevent accidental overwrites).

The "if" stands for Input File (remember that everything in Linux is a file), and "of" stands for Output File.  Change the drive designator to the correct one for your drive.  You can also write zeros to the entire drive by leaving off the "count" part, thereby performing exactly the same operation as most drive manufacturers' diagnostic low-level formats.  Useful, no?

Posted by Scott at Mon Dec 4 22:45:13 2006 from

Isn't it easier just to erase your Linux partitions, set the boot sequence in your BIOS to CD-ROM and then HDD, put your Windows CD-ROM in the drive and then choose to open the repair console when booting from that Windows CD-ROM? When you have booted to the repair console just do `fixmbr` and your finished. After this you can change the boot sequence back to HDD - CD-ROM.

Posted by Harm Hilvers at Mon Dec 4 22:57:55 2006 from

boot from windows cd.
press R for recovery
Type fixmbr
press enter
reboot

mbr will be overwritten with the windows-bootloader.

Posted by HiddenWolf at Tue Dec 5 00:45:01 2006 from

@Harm and HiddenWolf
Yeah, that would definitely be the way to go if you have a Windows CD-ROM. But my HP and many Dells (at least, there is probably more) don't actually ship Windows CDs. I'm not going to buy Windows discs just so I can fix the MBR. :-)

Posted by LaserJock at Tue Dec 5 01:26:34 2006 from

My recovery CD is actually a set of 3 CDs: 1 with Acer's own version of Ghost (under Windows 98), and 2 with a split ghost image of Windows XP on them.

And that version of ghost doesn't seem to care about the MBR.

Posted by Martijn at Tue Dec 5 07:04:48 2006 from

Excellent help.  I was able to get everything done step by step.  Thanks guys.

Posted by arun at Thu Dec 21 17:22:51 2006 from

Leave a comment



foodfight.org index


Creative Commons Licentie Op dit werk is een Creative Commons Licentie van toepassing.