LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Getting rid of GRUB (https://www.linuxquestions.org/questions/linux-software-2/getting-rid-of-grub-595918/)

apachedude 10-30-2007 05:54 PM

Getting rid of GRUB
 
I just built a new computer with Windows XP x64 and thought I might consider dual-booting. After finding that I wasn't ready for the current versions of the distributions I was exploring yet, I thought I'd remove GRUB. Easy I thought... pop in the CD, go to recovery counsel, fixmbr. Boom. Done.

Not quite. I'm using a SATA II hard drive, in case it's relevant. The first partition (/dev/sda1 or C:) is where my Windows installation is located (NTFS). The second, or D:, is a 220 GB FAT32 partition. The third is an ext3 where /boot/grub/ resides, and the fourth is a 2 GB swap.

For some reason, fixmbr doesn't do the job. I tried some bootcfg /rebuild tricks, and it appears what happens is that GRUB is not overwritten. It loads anyways, and if I choose Windows from the GRUB menu, then I go to the Windows boot menu. Which is quite annoying, because I *really* want to get rid of GRUB. Does anyone know what's going on? Where is it hiding?

I'm really worried because if I nuke the partition with /boot/grub/, I don't think I'd be able to load anything.

pixellany 10-30-2007 06:55 PM

Where is GRUB?
It starts in the MBR--as does the Windows bootloader. The later stages--and the config file-- are in /boot/grub on the Linux partition. If you delete this partition, you'll not be able to boot at all.

The few times I have ever done this, fixmbr worked (using win2K). I'm not sure how XP might be different. Have you Googled using--eg--"Windows XP mbr repair".

apachedude 10-30-2007 11:18 PM

Actually, I have done some extensive Googling. I'm not sure where my GRUB is on the hard disk, but I do know /boot/grub/ is in the third partition. GRUB was from a default install of SuSE 10.1 (in text mode), if that helps... as I was just trying to get SuSE to format a large partition as FAT32, and for some reason, I couldn't get Kubuntu or Slackware to do it for my SATA drive.

duryodhan 10-31-2007 12:20 AM

The problem probably is that the Grub changed the winXp partition , removed the bootable flag from it. Try running a liveCD and then show the output of fdisk -l /dev/sda

You probably want to remove bootable flags from all drives other that /dev/sda1. Also, then run fixmbr and then it should work fine.

Windows depends a lot on the bootable flag , while it doesn't matter that much to linux.

duryodhan 10-31-2007 12:22 AM

Quote:

I'm really worried because if I nuke the partition with /boot/grub/, I don't think I'd be able to load anything.
Not true. You will not be able to change anything, but if you nuked the partition, grub would still load, but with no config files. You will have to manually tell it to load windows (which is easily possible from the grub shell).


But anyways , try the solution I gave.

And post fdisk output of /dev/sda

apachedude 10-31-2007 02:53 AM

Quote:

Originally Posted by duryodhan (Post 2943032)
Not true. You will not be able to change anything, but if you nuked the partition, grub would still load, but with no config files. You will have to manually tell it to load windows (which is easily possible from the grub shell).


But anyways , try the solution I gave.

And post fdisk output of /dev/sda

The command you told me to run does indeed show that only /dev/sda3 is bootable (it's on another computer, so I'm not typing it out). I'm going to look up how to make /dev/sda1 bootable, but please let me know if you read this first.

Edit: fdisk says it's reading my hard disk as read-only (SATA issue?), so I don't know what to do. Also, I only have no floppy drive or Win 98 boot CD, so I'm wondering what's the best way to set it to bootable without compromising my data.

Thanks a lot for your help.

apachedude 10-31-2007 02:58 AM

Pixellany, I noticed you were in Pasadena. Would you happen to be at Caltech? (I'm a student.)

saikee 10-31-2007 03:19 AM

Grub can always be overwritten by a Windows' MBR. In the last link of my signature

Tasks B1 & B2 are suitable for all Dos and Windows except Vista

Task B7 is for Vista.

A Dos program like fdisk.exe can fix a Sata hard disk which Dos can't even read. This is because fdisk.exe operate on the hardware by overwritting the first sector of the hard disk with M$'s MBR binary code.

Grub doesn't and can't do anything in a NTFS partition because Grub (and Lilo too) CANNOT read it!


The only bit that is foreign in a MS Windows is its MBR which is occupied by the stage1 of Grub.

If one has 10 operating systems in a box one can nominate any of the 10 boot loaders to occupy the MBR. The MBR is not the sole property of MS systems. Any OS ever invented to run on a PC WILL have instruction how to restore its boot loader there. It is "the" PC standard.

If the OP failed to restore the MBR it is most likely due to an incorrect application of the relevant commands or some special hardware arrangement.

apachedude 10-31-2007 05:06 AM

Saikee, I've read through the link to your signature, and while I appreciate your feedback, I'm pretty sure I've used fixmbr correctly. I've done this several of times without any problems previously, but I've tried to restore the MBR repeatedly to the no avail this time.

I am hoping duryodhan is onto something, and while you mentioned that GRUB probably cannot write to NTFS, is the bootable flag actually in the NTFS portion? Or would it be in the "header" sector of the drive, in which case I might be able to restore my system by changing the bootable flags.

saikee 10-31-2007 05:43 AM

It is true that a MS Windows needs to be "make active" in order to be bootable. You can achieve this by booting any Live CD that has Grub, go into a terminal, get root privilege, invokde a Grub shell and make your sda1 active by command
Code:

grub
root (hd0,0)
makeactive
quit

In fact I would recommend you in any Linux terminal type
Code:

fdisk -l
If sda1 is bootable it will have a "*" attached.

Your statement saying fixmbr did not produce the desirable result and keep getting Grub back tells us your "fixmbr" did not executed successfully on the first boot disk which the Bios boots.

A possibility of this behaviour is you could have implemented a safety feature disallowing the MBR to be altered with the Bios or something to that effect.

Blaming the bootable flag is a long short as it is just a byte in the 16-byte partition table that you can switch on or off with Grub, fdisk (with both the Linux and Dos versions), cfdisk and sfdisk available in Live CD. Linux never uses the damn thing and has no reason to touch it in a Windows partition.

Had fixmbr been implemented you should see no sign of Grub unless the Bios can find it from the second disk.

The role of MS MBR (common to all Dos and Windows except Vista) is to boot whichever one of the 4 primaries that has the bootable flag switched on. You can use Windows MBR to boot up Grub hosted in a data-only active primary partition instead of a MS system!

louieb 10-31-2007 10:18 PM

Just wondering you don't happen to have virus protection turned on in BIOS. Maybe fixmbr isn't writing to the MBR. How many drives? Maybe wrote to a drive that not 1st in boot order. Got to be something simple like that. The boot code in the MBR is only 450 or so bytes long just enought to put a pointer to some boot loader such as grub or ntldr. It not a part of any file system just a bunch of 1 and 0's. Anyway theres more than one way to skin this cat. IDBS Remove/Replace/Uninstal Grub Heres a few of them.

apachedude 11-01-2007 02:53 AM

Saikee, I tried inputting those commands in the grub shell (which I loaded from my SuSE installation on /dev/sda3, rather than from a Live CD), but I got a message that it couldn't write to the partition or something. I'll take a look at a Live CD with GRUB later.

Louieb, I don't think my BIOS has virus protection enabled, but I'll check again later.

I just burned a copy of Ultimate Boot CD, and I'm hoping there's something on there that will allow me to fix my partition (and more importantly, have write access). Does anyone have any experience with that?

duryodhan 11-01-2007 03:30 AM

Saikee!!! I bow to Saikee first cos he has kicked my butt in previous discussion on partitions and booting.

But he is wrong. he is right in what he is saying, but he isn't giving you the simplest solution.

Just boot the comp with a liveCD. Switch the bootable flags OFF on all partition . Then switch the flag ON on ONLY the windows partition. Restart. Check if windows works. If not , boot a Windows XP recovery CD/DVD, run fixmbr, and fixboot. They will fix the problem..


Saikee, maybe the op, had the grub on the MBR as well as the boot sector of the linux partition and the stupid system is now just passing control to the linux partition (fixmbr in windows does that, the MBR in windows just sees the partition with bootable flag and passes control to it. Thats why you can't generally have more than one windows in the primary partitions).

saikee 11-01-2007 07:01 AM

Quote:

Saikee!!! I bow to Saikee first cos he has kicked my butt in previous discussion on partitions and booting
I thought I was licking your toe! Now you are saying it was a butt!

I think I shall let you guys have a bit of fun first but if you find something simpler than the Task B1 and B2 I wrote in "Just booting tips" please let me know.

duryodhan 11-01-2007 12:13 PM

He has said that already for god's sake .. he has done them both .. they didn't work. And I have experienced this exact problem. Unless the bootable flag is set on the windows partition the windows (after a fixmbr) won't boot.

Ofcourse, you could be right in taht he hasn't correctly done fixmbr, but I am assuming he has .. cos it ain't that difficult.



And I wasn't joking when I said I bow to you ... the thread here , is honestly the best thread I have ever participated in. I would recommend it to anyone who is interested in how stuff boots. Erik is also very good in that thread.


All times are GMT -5. The time now is 05:40 AM.