How to uninstall GRUB ie Installed by Ubuntu Installer

You can overwrite MBR with standard dd command. You can also use old good MS-DOS fdisk command to overwrite MBR.

Using MS-DOS/Windows 9x boot disk

In order to remove the GRUB bootloader from a Linux and Windows XP machine, boot with a Windows 9x startup disk or CD and execute the MS-DOS command:
fdisk /mbr

Using Windows XP boot disk

Boot computer using Windows XP (Windows 2000) setup disc / CD / DVD. Next, type the following commands:
# fixmbr
# exit

Using Linux

You can also use dd command from Linux itself (it removes partition table):
# dd if=/dev/null of=/dev/sdX bs=512 count=1
Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1
Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -lOutput:
Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       30384   243955057+  83  Linux
/dev/sda3           30385       30515     1052257+  82  Linux swap
========================================================================

Fix Windows MBR (remove GRUB)


Since I publish information for reinstalling GRUB I assume may be useful information also for reinstalling Windows MBR.

A) Using a DOS or Windows 9x/ME Boot Floppy

In case you have DOS or Windows 9x/ME on your system, you can use fdisk for this purpose. Create a rescue disk in DOS or Windows 9x/ME, use it to boot the computer, and execute fdisk as follows:

fdisk /mbr

The MBR will be rewritten and GRUB will be uninstalled.

B) Using Windows XP

In Windows XP, you can uninstall GRUB as follows:
Boot from the Windows XP CD and press the "R" key during the setup in order to start the Recovery Console. Select your Windows XP installation from the list and enter the administrator password. At the input prompt, enter the command "FIXMBR" and confirm the query with "y". The MBR will be rewritten and GRUB will be uninstalled. Press "exit" to reboot the computer.

C) Using Windows 2000

In Windows 2000, you can uninstall GRUB as follows:
Boot from the Windows 2000 CD and press the "R" key during the setup and then the "K" key in the following menu in order to start the Recovery Console. Select your Windows 2000 installation from the list and enter the administrator password. At the input prompt, enter the command "FIXMBR" and confirm the query with "y". The MBR will be rewritten and GRUB will be uninstalled. Press "exit" to reboot the computer.

E) Using Freedos

If none of the above-mentioned boot media is available, a floppy or CD image from a free DOS system can be downloaded from http://freedos.org/freedos/files/. You can create the CD image with any burning program on any operating system. Just make sure not to create a data CD but a CD image.
Creating the floppy image with Linux:
Enter the following command (or equivalent) in a root shell:

dd if=/tmp/fdos1440.img of=/dev/fd0

Creating the floppy image with Windows:
The directory /dosutils/rawrite/ on the first CD/DVD includes the program rawrite.exe that can be used to write the image to a floppy. Copy this program to the directory containing the file fdos1440.img.
Insert a floppy in the drive and start rawrite.exe. Enter the file fdos1440.img as the source file and confirm with Enter. Then enter the name of the floppy drive (usually "A") as the write medium. The image will be written to the floppy.
Boot from this CD/floppy and select "1" for "Boot FreeDOS Setup" first and then

"3 - Clean Boot" from the start menu. Start fdisk with:

fdisk /mbr

By doing this, the boot loader GRUB will be overwritten.
================================================
Method 2: Use a Windows XP installation CD/DVD
Grab a Windows XP installation CD and boot from the CD with the hard drive attached and select the “Repair” (choose “R”) option when it is presented to you. After that you will taken a common prompt. Once you get to the command prompt give the following command after selecting “1″ for :
1) C:\WINDOWS
and now type the following commands:
C:\WINDOWS> CD ..
C:\> FIXBOOT C:
C:\> FIXMBR
C:\> BOOTCFG /rebuild

The last command (BOOTCFG) will rebuild your boot.ini as per your hard drive partition table and will put appropriate entries for Windows XP. Also this command will most likley add a new entry to your Windows XPboot menu. You can easily delete the old entry by modifying the C:\boot.ini file once you successfully boot into Windows using the newly created entry.
Note: You will need to know the “Administrator” password before you can enter into the command prompt. If you don’t have one, just press “Enter” key.
Method 3: Use Linux dd command
Lastly you can use the powerful “dd” comamnd in Linux. For this the best thing to do is to boot from a LiveCD with your hard drive attached and give the following command:
# dd if=/dev/null of=/dev/sdX bs=446 count=1
Where
X = Your hard drive device name
You can use the following command to find your hard drive letter:
# fdisk -l
Output:
Disk /dev/sda: 750.1 GB, 750155292160 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x90ee8262

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       18237   146488671    7  HPFS/NTFS
/dev/sda2           18238       67366   394628692+   5  Extended
/dev/sda5           18238       66880   390724866   83  Linux
/dev/sda6           66881       67366     3903763+  82  Linux swap / Solaris
That’s it. Hopefully by using any one of the above 3 methods you should be able to get your Windows booting back.



1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete