ArticleDirectory
- Using MS-DOS/Windows 9x boot disk
- Using Windows XP boot disk
- Using Linux
- Dual-boot setup
- Troubleshooting
- Acknowledgments
How to uninstall grub
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 withWindows 9x Startup DiskOrCD& 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-l
Output:
Disk/dev/SDA: 251.0 GB, 251000193024 bytes255 heads, 63 sectors/track, 30515 cylindersunits = 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
Disclating: This document is provided "as is" without warranty. Use at your own risk. In no event shall I be liable for any damage resulting from the use of this work.
This howto applies if:
- Your machine already has windows installed, and you are installing Linux as a second operating system, and
- You want to leave the windows Boot Loader (ntldr) on the MBR (Master Boot Record ). this allows you to continue to Boot Windows with no issues. I 've heard that Windows 2000/Windows XP or anti-virus software may complain if the MBR does not contain the Windows boot loader
You can use either grub or lilo to dual-Boot Windows 2000/Windows XP and Linux. both functionally work fine, but from what I 've ve read, grub requires less maintenance, as lilo requires you to reinstall the Boot Loader (by running/Sbin/lilo) Every time you rebuild the kernel or make changes/Etc/Lilo. conf.
Requirements /Boot Partition
The location of/BootPartition on the hard drive is critical so that you don't get screwed by the infamous BIOS 1024 cylinder limit. The bios of older systems can't access data beyond cylinder 1024, Which is ~ 8.5 GB. A simple way to avoid the BIOS 1024 limit is to create/BootWithin the first 1024 cylinders (~ 8.5 GB) of the hard drive.If you have multiple hard drives (disks),/BootMust be on the same hard drive (probably the first hard drive) that has the Windows boot loader (ntldr) on the MBR.
Here are some options for where to create/BootPartition.
- (What I Did) shrink the Windows partition such that there is 50 MB of unused disk space at the beginning of the drive and lots of space after the Windows partition. you can install the /boot LINUX partition in this first 50 MB and avoid any potential issues with the 1024-cylinder limit entirely.
- shrink the Windows partition such that it does not cross the 1024 cylinder (~ 8.5 GB), and install the /boot partition right after the Windows partition.
- use LBA (Logical Block Addressing ). LBA allows you to boot beyond the 1024 cylinder. in order to use LBA, your BIOS must support it. in addition, for Lilo, you must also add a flag to enable LBA support. grub supports LBA "out-of-the-box"
To non-destructively shrink the Windows partition, you can use the free software program FIPS (please note that FIPS does not currently support NTFS partitions ). another option is the excellent inclucial product partition magic. it has an easy-to-use GUI. unfortunately, the tool that comes with Red Hat 7.2, disk druid, does not have the ability to shrink existing partitions. once you 've shrunk the Windows partition, you can use disk druid during the Red Hat installation to create all the partitions you need for Linux.
Dual-boot setup
Following are the steps to get dual-boot Working With grub; I figured out how to do this by looking at a similar procedure for Lilo. 'I ve verified that this works for Windows 2000 and Windows XP, and this shoshould work on Windows NT (all 3 OSS use the same booting architecture ).
- install grub on the first sector of the /boot partition. do not install it on the MBR! . If you are creating the Red Hat installation, for the "Boot Loader installation" screen:
- select "use GRUB as the boot loader"
- select Install Boot Loader record on "... first sector of boot partition".
- after finishing the Red Hat installation, reboot into Linux. If you don't have a boot disk, try booting in Linux rescue mode
if you already have Linux installed:
- run the following command (e.g. assuming /boot is /dev/hda2 ): grub-install/dev/hda2 . if you don't know which partition contains /boot , run the DF command and check the output.
- edit /etc/grub. conf and make sure there is an entry for your version of Windows. for reference, here is a copy of my /etc/grub. conf file.
- Determine which partition contains/BootPartition by runningDFCommand. You'll see output like this:
Filesystem 1k-blocks used available use % mounted on/dev/hda3 8665372 1639580 6585612 20%/dev/hda2 46636 5959 38269 14%/boot/dev/hda6 513776 189504 324272 37%/ossharenone 256624 0 256624 0%/dev/SHM
From this output, we see that/BootIs on/Dev/hda2.
- Make a copy of the Linux boot sector onto a floppy or onto a FAT32 partition. We'll name this copy Linux. Bin . To make a copy onto a floppy:
- Mount the floppy drive if it's not mounted (assumes/Mnt/floppyExists ):Mount-T msdos/dev/fd0/mnt/floppy
- Run the following command:Dd If =/dev/hda2 of =/mnt/floppy/Linux. Bin BS = 512 COUNT = 1Substitute the path forIf =Parameter (the input file) with the appropriate partition from the previous step. E. g., SetIf =To/Dev/hda2.
To make a copy onto a FAT32 (vfat) Partition:
- Mount the FAT32 partition if it's not mounted yet. If it isn't listed inDFOutput, it hasn' t been mounted yet. Check out steps 3a-3c for mounting a FAT32 partition on the "share partitions howto ".
- Run the following command:Dd If =/dev/hda2 of =/osshare/Linux. Bin BS = 512 COUNT = 1Substitute the path forIf =Parameter (the input file) with the appropriate partition from the previous step. E. g., SetIf =To/Dev/hda2. Substitute the path forOf =Parameter (the output file) with whatever is appropriate for your system. The example here (Of =/osshare/Linux. Bin) Is for copying onto a FAT32 partition calledOsshare.
-
- Reboot into windows
-
- CopyLinux. BinFileC :\
- Run notepad and edit C: \ Boot. ini . Note that C: \ Boot. ini Is a hidden system file, so it probably won't show up in Windows Explorer. to edit the file, try: Start-> RUN And enter: Notepad c: \ Boot. ini . Add the following line at the end: C: \ Linux. bin = "Linux" If your C: Filesystem is NTFS (not FAT32), you must Edit C: \ Boot. ini As a user with administrator-level privileges. To make C: \ Boot. ini Writable, you can either:
- Use Explorer:
- GoTools-> Folder Options-> ViewAnd selectShow hidden files and foldersAnd deselectHide protected operating system files (recommended).
- Right-click on the file, viewPropertiesAnd uncheckRead-Only. You can now edit the file.
- After editing the file, restore the settings to their original state.
- Use the command-line:
- Make the file writable:Attrib-r-s-h c: \ Boot. ini.
- After you 've finished editing the file, put the settings back:Attrib + R + S + H c: \ Boot. ini
For reference, here is a copy of myBoot. iniFile.
-
- Reboot again. You shocould be able to pick either Windows or Linux. Selecting Linux will start grub
Troubleshooting
- When I select Linux from the boot menu, I get a frozen "Grub" (or an "l" in the case of lilo)
-
- Make sure you createdLinux. BinFile correctly withDdCommand. If you think you ran the command correctly, the problem may be that your/BootPartition is beyond cylinder 1024 and your BIOS can't reach it. at system startup, the Windows boot loader lists the choices fromBoot. ini. When you select Linux, the boot loader then loads the 512-byteLinux. BinFile, and then BIOS tries to access/BootPartition to run grub. Some BIOS implementations can only address the first 1024 cylinders of a hard drive, which corresponds ~ 8.5 GB. How do you fix this? Create your/BootPartition before cylinder 1024; I. e. Before ~ 8.5 GB.
- If I select Linux from the boot menu, I get an error message that says "Windows XP cocould not load: The file Hal. DLL (Windows/system32/) is missing or missing upt. please reinstall.
-
- This is usually caused by an error inBoot. iniFile. If you are unable to find and fix the error, check out Kelly Theriot's page that provides varous methods for addressing the problem.
Acknowledgments
-
- Jimmy andriambao: for recommending the link regarding Hal. dll Problems
-
- Leif Roger kolberg: for creating a Norwegian translation of this page
-
- Dirk goepfert: for creating a German translation of this page
-
- Fred van lieshout: for creating a Dutch translation of this page
-
- Rostislav "Udo" galicek: for creating a Czech translation of this page
- Arun Swami: for validating the dual-boot setup with multiple hard drives. Thanks Arun!
-
- Adri án I. Correa: For enthusiastically providing a Spanish translation of this page. adri án said it best: "I love this wonder called the Internet! "
-
- Devesh Mistry: for pointing out the useChroot/mnt/sys/mnt/syimageWhen in Linux rescue mode
-
- Emmanuel Brun: For graciously providing a French translation of this page
-
- Jason Noll: for reporting the Hal. dll problem resulting from error (s) inBoot. ini
-
- Garth Patil: for helping to troubleshoot why grub was freezing and having a great sense of humor
-
- Piete BROOKS: for pointing out that editingC: \ Boot. iniRequires administrator-level privileges and providing the content for making the file editable using Explorer
- Paul Feehan: for providing the commands to makeC: \ Boot. iniEditable for Windows XP
-
- Jan holsen: for reporting thatC: \ Boot. iniIs a hidden System File
-
- Hampus Hedberg hankell: For the following suggestion:I think you shoshould add help for users in despair that already have installed grub on MBR, thus loosing the their ability to boot into Windows XP. procedure for this is, boot from a Windows Start disc and do a fdisk/MBR at least they can reach their windows and this time doing it right
-
- Mark Jordan: for verifying that this works on Windows XP and suggesting the content for copy to floppy
-
- Darryl Eaton: For introducting me to Red Hat Linux