About Linux FAQ

Browse More FAQs:

How to uninstall GRUB

Posted by Vivek Gite [Last updated: December 7, 2007]

Q. How do I uninstall GRUB? I need to uninstall everything before sending this hard disk to someone including GRUB. All I need to keep is windows XP.

A. GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to choose which one to run when the computer starts.

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

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Martijn van Vliet Says:

    The command # dd if=/dev/null of=/dev/sdX bs=512 count=1 is correct, but this will also wipe the partition table(!).

    It could use a note that this will get you in troubles if you want to be able to reuse your data.

    the alternative to NOT wipe the partition table is with bs=446 (NOT 466)

    Have a good one,

  2. nixcraft Says:

    Martijn,

    You are correct; I have updated the article.

    Appreciate your post.

  3. Ron Plane Says:

    Thanks for the help very easy to follow

  4. Teemu Pudas Says:

    How do you do it in Vista? I was attempting to install a Linux on an external HD, but apparently the idiotic installer decided GRUB was better off being the only thing to end up the internal drive. This is on a laptop with Vista preinstalled.

  5. Shafin Says:

    For Vista,Try this:
    http://www.sysint.no/Nedlasting/MbrFix.htm

  6. Jereme Says:

    On Fedora Core 6, I had to use /dev/zero instead of /dev/null. Otherwise, this guide worked great. Thanks.

  7. donnie bradley Says:

    i suggest you download the latest version of hiren’s boot cd and use one of the mbr tools to install standard boot code - worked for me

  8. gbacskai Says:

    Hi!

    You can do it under linx:

    0. log in as a root
    1. install lilo (if you do not have)
    2. create a dummy lilo.conf

    like this:

    boot=/dev/hda
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=50
    default=dos

    other=/dev/hda1
    label=dos

    install lilo to MBR
    lilo -M /dev/sda -b /dev/shd
    and uninstall
    lilo -U -M /dev/sda /b /dev/sda

    Regards
    Gergo

  9. P3eggroll Says:

    This only works for XP if you have the administrator password. The way to get around the password is to use the registry editor and go to HKEY_LOCAL_MACHINE, SOFTWARE, Microsoft, Windows NT, Setup and then Recovery Console. Once you get to the Recovery Console part you must change the Security Level and Security Command value’s to 1. You can do this by right clicking and the click modify and then change the values to 1. Then you can reboot to the Recovery Console and the CD and then you can do the FIXMBR command which will fix your MBR…

  10. Ash Says:

    Thanks, great article - removed that pesky GRUB from my drive which decided to boot before my primary one does

  11. Rodney Says:

    Hi:
    I am trying to get rid of this GRUB and Linux partitions but i have windows vista and i cannot enter to that recovery console with the installation disk. Any suggestion?

  12. fluteman Says:

    Hi, I’m having exactly the same problem in trying to remove GRUB. I have an older dual-boot system (XP Pro SP/2 and Ubuntu) and I’m using one of the slave drives from that old system as a primary drive in a new system that I’m building. I installed the drive into the new system and attempted performing a fresh install using XP Pro to delete old repartitions, create a new one, and reformat the entire drive, without considering that I needed to remove the existing GRUB mbr prior to performing the install. So even though XP Pro will perform the entire install without no errors, I still get a GRUB load error on reboot.

    I’ve tried using the recommended XP Pro Recovery Console process of running “FIXBOOT C:” then “FIXMBR” and then “BOOTCFG /rebuild” as well as various other alternatives and nothing works - not even deleting the partition and reformatting!

    Help!

  13. Carey Says:

    You need to use /dev/zero, not /dev/null.

  14. Velibor Says:

    Guys if you have problems with grub in Windows Vista
    this is how you solve it. restore your MBR before u erase the linux partition .

    (Master Boot Record)= MBR

    Put the Windows Vista installation disc in the disc drive, and then start the computer.
    2. Press a key when you are prompted.
    3. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
    4. Click Repair your computer.
    5. Click the operating system that you want to repair, and then click Next.
    6. In the System Recovery Options dialog box, click Command Prompt.
    7. Type Bootrec.exe /FixMbr, and then press ENTER.

    That’s it. Now when you reboot your PC, Vista will load automatically… You can now safely boot using your Ubuntu desktop CD, to use the built in Gnome Partition Manager to remove your Ubuntu partition!

  15. Velibor Says:

    Rodney try to get any Vista instalation just to get in comand prompt and problem solved. Or get a dos boot floppy, USB, or burnt CD. Get to c: and type Bootrec.exe /FixMbr, and then press ENTER.
    Done. Always enter bios setup to boot from the device to get to comand prompt ex: (USB, CD, Floppy etc.)
    Remember to backup all your data before u install any other operating system.
    That way your on the safe side always.

  16. PapasmurfCBa Says:

    A problem and a few questions.

    Problem:
    Older computer was running Fedora C4 great for several months installed from a Corporate DVD that I got from work.
    Decided to install Fedora 9. Downloaded it and ultimately made 3 copies due to unsuccessful installs.
    First:
    Initial attempt wiped the drive and pooped the bed half way through the install. The system would not boot anything (no other media, cd, dvd, usb) until I removed the hard drive from the system, set it as slave in my XP box, formatted the drive, and set it back into the fedora box.
    Next:
    Fedora 9 installed with no errors, looking good so far. Reboot, and all I get is grub (I did not install this with the F9 but I did with the F4 I haven’t played with Linux since RedHat5.2).
    Then:
    Read this string as I was thinking that I don’t need grub if the system is only running one OS anyway. Removed grub using the

    dd if=/dev/zero of=/dev/sdX bs=446 count=1
    (null didn’t work)

    Now:
    When I boot the system stops at
    Verifying DMI Pool Data ……….

    I am guessing that I can fix the MBR using the F9 dvd in rescue mode but I don’t know how.

    Q1: Can I fix this from the Fedora dvd in rescue mode?
    Q2: If so, how do I go about that?
    Q3: Since I have 1 hard drive and one OS, do I need grub?

    Please don’t assume that I know anything, I hate the standard 3 hour search because I am supposed to know where the command/file is located that I don’t know to begin with.

    Thank You for Your Time and Concern,
    Papasmurfcba

  17. PringleZ Says:

    I was having Windows XP and Ubuntu before i went on to install Solaris. I made a mistake of not knowing that Solaris shared the same ’swap’ order as that of UBUNTU. So, after the installation, i got two OS’s in the system (Solaris and Windows), instead of 3 (i wanted XP, Solaris and UBUNTU together) and the GRUB menu got updated to 2.0. The Linux partition dissappeared from the menu.

    Now i just want to get rid off these Solaris and UBUNTU installations by keeping my XP intact.
    I tried the “fixmbr” technique, but i still get to the Solaris GRUB menu.

    So, inorder to directly boot to XP, should i remove (delete) the Ubuntu and Solaris partitions on the harddisk?

    When i tried to remove Solaris, i get an “operating system not found error”. So inorder to get to XP, i need the GRUB menu.

    i want it to be plain old XP…(direct boot)

    hope u guys can help me out here…

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.