Click to See Complete Forum and Search --> : GRUB/MBR issues


Jaymo
08-16-2004, 02:23 AM
I've been having a few issues booting my PC, I also posted this on a few of my local forums but no-one seems to have replied, here is what I said on them:

Heres my story:
I felt like installing Linux on my desktop, so I resized my Windows partition with Partition Magic 8.0, I resized the windows partition on my WD SATA Raptor 36gb to about 28 gigs.
Then I installed Fedora, it was pretty much a breeze except that a dialog box came up during install saying something along the lines of like "You have used something to change partition tables, there may be errors in boot loader, but it is fixable after install" plus something to do with BIOS, so I thought, should be easy, just change a few things once I get to bootloader.

So after the install I fire up my comp thinking that I can just change a few things in Grub, but how wrong I was. I got a "Geom Error" before it got into grub.

Here are a few extra notes:

I have 3 hard drives, the one I wish to install it on is SATA and is hde. The other 2 drives are on the primary ide channel.

I tried installing Mandrake 10 after, just to see if I would have the same problems, I did. Then I re-installed Fedora Core 2 after

Oh, and Im using Knoppix 3.4 to post this.

edit: I just updated my BIOS, now when I fire up anything, as soon as it gets to showing anything graphical it hangs, be it Knoppix or Fedora installer, it hangs and does that flashing underscore thing.
The Geom error is gone but now when it goes to boot GRUB it says "Grub" on the thing after POST and just stays there, doesnt do anything.

edit2: ah, back to the basics, Geom error once again .
I disconnected the SATA drive and fired up windows xp disc, did fixmbr (my mbr seems to be on hda - the ide master drive). Then I re-installed Fedora.

edit3: hmm... seems to have gone back to what I said in the first edit :| Cant boot anything unless I disconnect the SATA HD. Cant even run Knoppix or an Installer with it, after I press enter to launch the installer/os it just hangs.
All the data is still on the harddrives, I only want to format in a very last case scenario as this is my only PC with a SATA controller.

saikee
08-16-2004, 04:35 AM
I lost track of what you want to do but installing Linux, then removing a drive or adding a drive can upset the installed software.

One thing is clear it shouldn'r have anything to do with the bootloader, be it Grub or Lilo. I feel there is an obligation for me to defend them as both are doing a decent job to boot my 15 Linux and XP in my hard drive. Knowing where they are win you half the battle.

Suppose you install Mandrake first. In order to boot you put its boot loader into MBR and that should work fine as you should have both Windows and Mandrake as the booting choices. Now in adding Fedora you could overwite Mandrake's bootloader in MBR. If Fedora doesn't boot you lose the mechanism to boot Mandrake too.

It should be easy to resolve the situation if we keep SATA problem separately because it may not be supported by kernel below 2.6.

You can use Knoppix working as a LiVe CD to chroot into Mandrake and install its bootloader in the MBR, or/and it partition, or/and in a floppy, using command. In MBR Mandrake's bootloader manages the booting for you, in its own partition will enable Mandrake chainloaderable by any Linux and in a floppy you can call it back any time you want. You can install the bootloader in all three alternative but I always recommend a Linux should have its bootloader at least in its own partition, otherwise it cannot be chainloaded. The standard method both Lilo and Grub boot each other is by chainloading.

grub-install /dev/XXX, where XXX =hda for MBR, XXX=hda2 if Mandrake in hda2 or XXX=fd0 for a bootable floppy. If you manage to get Mandrake and Windows working normally then the SATA problem may be easier to overcome.

To chroot from Knoppix, you create a temporary directory in Knoppix, mount it and chroot into Mandrake's root. Look up my other thread if you need the command instruction as I have repeated it so many times.

Jaymo
08-16-2004, 07:04 AM
Back to the Geom error, I figured out what wsa making everything halt, it was my flash card reader, heh.
I wanted to get back into windows to back up my files so I could start fresh so I fired up recovery console and did fixboot and fixmbr thinking it would at least give me access to windows, how wrong I was, it now gives me some error saying "OS error" or something.
I wish to get back into windows so I can fix up a few things, any way that is possible?
All the data is still on the drive, I checked from Knoppix.

leonpmu
08-16-2004, 08:16 AM
Is your windows partition NTFS or Fat32?? If it is Fat32 then you need not worry, if it is NTFS you only have read only access..... so be careful.

Perhaps try and reboot with your windows XP cd and do a system repair/restore

saikee
08-16-2004, 09:40 AM
The NTFS data is not lost or damaged and can be copied to a partition Linux can write, say with a FAT32 file system which can be read by Windows too.

Linux can't write on a NTFS partition and I think it is a good thing. But it can read its content and copy the content out to another partition.

I am a bit uneasy of altering the BIOS after the Linux has been installed. Any geomerty problem is more likely a result of the BIOS changes.

I have suggested to use the chroot command to access the Linux that fail to boot. That may be able to tell you if your Linux systems are good for booting after the BIOS change. If the Linux allows the bootloader installed then you should get your system back.

Jaymo
08-16-2004, 11:37 AM
Sorry dudes, couldnt go to the net for a while as there was a bit of an outage.
Well, I backed up all my stuff onto a DVD-R from Knoppix and then did a full format of my SATA drive, and got rid of my windows and linux stuff.
Now here is an issue, it appears Fedora seems to have mucked around with my IDE drives and added it's own MBR on them, I get an Operating System error when I boot up with them connected.
Anyone know a boot diskette which I can use to get rid of the mbr (They dont have an OS on them, just storage, I guess they would have a Boot sector though, right?) on the drives?

I'm gonna give it a second shot as I hear that Partition Magic actually has a dedicated tool for modifying partitions to allow additional OSes to be installed. I wish I knew about that before I used the standard partition resizer :o .

Anyone know a way I can get rid of the MBRs on the two storage IDE drives without losing my data?

Jaymo
08-16-2004, 11:38 AM
Oh, by the way, I dont have any of the IDE drives set up as booting drives in BIOS, so they shouldnt be interfering when connected.

XiaoKJ
08-16-2004, 12:14 PM
for windows/dos use the old code fdisk /mbr or maybe just FIXMBR in the winxp recovery console.

for linux, just dd if=/dev/zero of=/dev/hdX bs=512 count=1

Using the linux one is better, but you must jot down your original partitioning scheme to save any info from it. jot down the sizes too.

saikee
08-16-2004, 12:47 PM
I personally don't think Fedora has put a bootloader on your IDE disk unless you have instructed it to. Even if you have done it by mistake the bootloader cannot possibly surface unless the IDE has been used as a booting device, which according to your description it doesn't.

It does not sound possible a bootloader on you data hard disk, which is not bootable, should have anything on your booting process. I suspect the error is from your current bootable hard disk.

Some distros can be rigid about the hard disk set up and can have entries in the fstab and mtab files to load the devices that you have given a green light during the installation. For example some Linux systems could not tell if a NTFS partition is a Window or just data partition and attempts to load it for you. You can examine the entries in /etc/fstab and /etc/mtab and delete the references if they bother you.

XiaoKJ
08-16-2004, 12:54 PM
for being rigid, lilo comes to mind. :D

Jaymo
08-17-2004, 05:07 AM
Originally posted by XiaoKJ
for windows/dos use the old code fdisk /mbr or maybe just FIXMBR in the winxp recovery console.

for linux, just dd if=/dev/zero of=/dev/hdX bs=512 count=1

Using the linux one is better, but you must jot down your original partitioning scheme to save any info from it. jot down the sizes too.
ok, so uhm, how do I restore these partitions?
I just got blobs of unpartitioned harddrive space at the moment. I used the linux commands.
The data isnt completely lost is it? I had a few one-off files on them HDs :(. I saw that it only deleted a few kilobytes so I thought it was only the bootable sections, it turns out I can access them from the windows recovery console either, so I cant do anything like a fixmbr (restores the windows mbr stuff).

edit: Main OS drive restored thanks to Partition magic boot disks :). Restoring the other partitions as we speak.
Lets see where this lands me.

saikee
08-17-2004, 08:45 AM
I could be wrong but using Windows software like Partition Magic to restore Linux files is not a practice a Linux user would go as it is much superior to use Linux. I don't know the consequence of it but in Linux there must be a mounting point to start the file structure.

Generally if you just copy the files across the bootloader will be missed out as it isn't a file although you can always reinstall the bootloader back as long as the Linux runs.

If the original partition was copied out by the dd command then the sector-by-sector (as oppose to file-by-file) transfer will have the bootloader included and will probably work if it is a Grub bootloader with the partition number unchanged.

Jaymo
08-17-2004, 09:10 AM
Ah, well I dont currently have any Linux partitions on my system, I did a clear format on my SATA drive (the one with all the OSes).
At the moment my main priority is to try to get into windows and then get a few things sorted before I install Linux.
Problem is that I cant boot into Windows at all at the moment, just get a screen after post with a flashing underscore. I dont really have anything that important on my OS drive so we can do as we like with that drive.

I think I know what might be causing some of the problems, everything immediately tries to put stuff on hda which is my IDE drive rather than hde which is my SATA drive.

Here is some information about my system that may help:
Western Digital Raptor 36GB 10000rpm SATA (OS and Programs only drive, All OSes should be on this drive) as SATA1. Currently used fully by Windows.
Western Digital JB 80gb 7200rpm PATA IDE (Storage of documents, installers, etc.) as Master
Western Digital JB 120gb 7200rpm PATA IDE (Video, Music, File sharing) as Slave
A7N8X-E Deluxe Motherboard with Si3112r SATA controller
AMD Athlon XP 2800+ @ Stock clockspeed
Radeon 9800pro Extreme 128mb
512mb DDR400 RAM

BIOS boot settings:
1. CDROM
2. Floppy
3. HDD0 (SATA1)

Also, I pose a question: Say if I format my OS drive again but only put Linux on, would there be a tool to resize the partition with the majority of the harddrive space to allow Windows to be installed after? Because so far with my Linux experience I have seen that it has made 3 partitions:
A boot parition
A main stuff partition
A swap partition

The main stuff parition is usually in the middle. So I am thinking that if I do resize the main partition I still would not be able to install windows as it is straight in the middle of the drive. Is this correct?

saikee
08-17-2004, 09:39 AM
Many Windows software have been written to assume occupation the first priamry partition and I would suggest you stick to it as Linux is a far more superior system able to reside in anywhere in the hard drive.

My family runs 6 copies of XP and they range between 6 to 15 Gb. Thus you can have hda1 or hde1 given to WIndows together with about 15 Gb and plan the future for your Linux and data stuff. You don't have the disk fully allocated to run either Windows or Linux. I have 28 partitions on mine and about 5 to 6 partitions are still empty. The majority of my distros are kept inside a 5Gb partition but I have one large data partition accessed by both Windows and Linux.

A Linux if doesn't support SATA will not recognise hde and goes straight to hda for installation. According your boot queue only SATA can boot and so your Linux will be bootable as long as you allow its bootloader into the MBR of the SATA disk.

I hope you have a better luck this time but there is no need to format the hard disk at all if any of the systems doesn't boot. It is just a matter of know where the bootloader resides and when one has been overwritten the other so that you can put back whatever necessary. All the systems should be recoverable.

Jaymo
08-17-2004, 11:24 AM
I just had a look at my windows CD, it is thoroughly scratched, I have nfi how my computer read it :|. It probably skipped many files or copied corrupted files over.
I shall be obtaining a new windows install cd with SP2 integrated in a few days time.

I ran windows fine with the boot disk I made, providing that the two ide drives were disconnected. When I connected them and used the boot disk it would say "Missing or corrupted hal.dll file". So I googled around for hal.dll and saw that quite a few sites provided them, being cautious I thought it would be a bad idea to get a system dll off the web, so I copied the hal.dll file from my other box to my current problemed box.
Oh dear how that was a bad mistake :D . Ah well, one can only learn from their mistakes, nothing important lost either so it isnt a biggie.

I am gonna slap Powerquest for starting this chain of madness, hehe.

I think on my install of WXP SP2 I will select the allocated harddrive space from the initial install, as has been my trusty faultless way for about 2 years (yes, I have dawdled in Linux essentially learning nothing except how to do a few basic things and constantly switching distros).

I like your multiple distro set up, how big a harddrive to you boot them off? :eek:

saikee
08-17-2004, 12:21 PM
I have my operating systems in a 200Gb ATA hard drive.

I have moved my XP and Linux systems 3 or 4 times from disk to disk and have never had a need to reinstall XP. The dd command (suggested by XiaoKJ) can clone the 200Gb drive in 1.5 hours. I have also moved Linux from one partition of one disk to a partition of another, using the tar command ( after Hard Candy advised me to read the moderator DMR's thread on using tar). Apart from the book "Linux in a nutshell" I learn everything from this forum.

I disassembled my SATA RAID system and use ATA disk to run Linux as many distros with 2.4 kernel cannot recognised SATA.

Jaymo
08-17-2004, 08:36 PM
Neat, well I just pinpointed the exact problem why it was trying to boot the other drives.
See, Windows was installed with only the SATA drive plugged in, and was recognised as disk0 and so that was inputted into the boot.ini file.
When I connected the IDE drives the master would be recognised as hd0 and the slave as hd1. The SATA drive would have been recognised as hd3 (or 5, depending on whether the optical drives count).
So basically it booted the SATA drive alright, but the SATA drive was redirecting to the master ide, or the then hd0.
Bah, stupid thing probably wont let me keep C: as the OS drive if I install with all drives plugged in, ah well.

SATA should be recognised as HD0 damnit, damn IDE drives, hehe :D .

saikee
08-18-2004, 03:37 AM
Each distro can name the hard disks differently and the age of the kernel may matter too.

Just deal with convention a Linux has decided. You should get a pretty good idea of where you are by doing fdisk -l which should list all the partitions of every disk you have got. During installation you will have a facility to select/format a partition and by looking at the partition table you should be able to tell which disk you are working.

All my distros except 2 distros name my ATA and SATA as hda and hde. The two exceptions do exactly the opposite.

Jaymo
08-18-2004, 04:21 AM
Ok, only a few mins left of windows install, left about 8 gigs unpartitioned for a linux install.
What would be the best course of action when installing the Linux bootloader?
Should I install it to the MBR?

saikee
08-18-2004, 05:42 AM
I don't have any hang up of puting a Linux bootloader into the MBR. I am just surprised by the number problems reported. I do have back up though.

I have changed the hard drive at least 4 times and reloaded Linux distros countless number of times (from original CD or from backup) to suit my taste. So far I have not even once had a need to reinstall my XP since I started Linux. My XP is in the first primary partition and I have deleted everything above it to reorganise my Linux distros. The XP in my 16-partition hard drive is the same one currently in the 28-partition drive or the copy when I started my Linux adventure. I have restored the XP MBR a few times using original CD or just a DOS floppy.

If you are nervous about MBR you can switch the bootable hard drive from the Window disk to the Linux disk so that the MBR is effectively with the latter. I have a thread describing it in my signature.

Jaymo
08-18-2004, 10:16 AM
Originally posted by saikee

If you are nervous about MBR you can switch the bootable hard drive from the Window disk to the Linux disk so that the MBR is effectively with the latter. I have a thread describing it in my signature.
Yeah, I am installing the OSes on one drive only though, my 2 other drives are plainly for storage purposes.
I dont think I would be able to dual boot with my set up, plain impossible, I have tried every combination yet it tries to be a pain in the arse every time.
It is a pity as at the moment I can only dual boot on my laptop, which has a 1024x768 resolution XGA monitor :(, the pain!

saikee
08-18-2004, 12:18 PM
I don’t know you exact problem as you have been changing the goal posts all the time.

The latest is that you have Windows in SATA and it is called disk 0 by Windows. You are now convinced the Linux names the IDE master and slave as hd0 and hd1 and the computer boots to SATA which is named as hd3 or hd5. So is there a problem? Linux can allow any disk to boot from the choices of hd0, hd1or hd3. If you call Window from Linux you use hd3 (more likely (hd3,0) by Grub and Lilo can be different).

What is the fundamental obstacle preventing you from a dual boot?

Jaymo
08-19-2004, 03:58 AM
Originally posted by saikee
I don’t know you exact problem as you have been changing the goal posts all the time.

The latest is that you have Windows in SATA and it is called disk 0 by Windows. You are now convinced the Linux names the IDE master and slave as hd0 and hd1 and the computer boots to SATA which is named as hd3 or hd5. So is there a problem? Linux can allow any disk to boot from the choices of hd0, hd1or hd3. If you call Window from Linux you use hd3 (more likely (hd3,0) by Grub and Lilo can be different).

What is the fundamental obstacle preventing you from a dual boot?
Hmm... well you are partially correct, the problem was that the SATA drive dropped to HD2 (sorry, typo before) once I connected the ide drives, windows tried to boot HD0 which was an IDE drive without an OS. I'm contemplating on losing the SATA as the OS drive and instead setting it to the default install directory so that I still get the benefits of 10k rpm.

Sorry if Im sounding schizo as I did post this thread on a few places, taking advice from many directions, yet with no avail on any of the forums :(.

Current Problem: Tried formatting numerous times and installing Windows (No linux partitions or traces atm) but I get an error saying "Error booting from disk, press ctrl-alt-del to restart". This happens at the stage after Windows install copies the data off the disc to install it once you reboot, gonna make a bootdisk now though. I think this has gone beyond the realm of Linux now though, so I might post it on some general PC boards.

saikee
08-19-2004, 05:06 AM
OK your problem has been narrowed down to purely Window-related. This clarifies the situation considerably.

It is a long shot but can your current problem be related to not putting in the correct driver for SATA? Windows need the SATA driver up front during an installation. The first question XP asks is to press F6 key if there are SCSI drives and SATA falls into this category.

You are contemplating losing SATA as the boot drive. Where do you get the idea from? I wrote my last post trying to convince you that it shouldn't happen. You control which drive to boot first by the BIOS and no OS can override your decision. SATA will not boot only if a Linux can't recognise it because of its 2.4 kernel but Mandrake 10 and Knoppix 3.4 use 2.6 kernel and they support SATA. In any case if a Linux cannot recognise SATA it would not be able to put a bootloader there and so it cannot have any influence on changing the booting status of your SATA.

Good luck on your Window installation.