I can't use any operating systems because of Grub. Can any computer experts help me?
September 30, 2010 6:21 PM   Subscribe

I can't use any operating systems because of Grub. Can any computer experts help me?

When I got this computer, I installed Ubuntu to try it out. The operating system was excellent. Sadly, it was difficult to install programs because I have no internet access on this computer.

So I decide to try something else. I burned ReactOS to a CD, wipe my partition, and install this operating system. At the end of the installation, my computer tells me "press enter to restart computer". I comply, and when the computer goes through it's processes on the black screen, I get a message:

error: file not found.
grub rescue>

What should I do? According to Google, Grub came from Ubuntu. How can I get rid of this so I can use my computer again?
posted by EatingCereal to Computers & Internet (9 answers total) 1 user marked this as a favorite
Boot a bootable Windows or DOS disk or CD. From the command line, do "FDISK /MBR" which will overwrite the boot record.
posted by fings at 6:25 PM on September 30, 2010

Response by poster: @ fings

I inserted my Windows CD. I still got that "file not found" message. How do I get to the command line?

Thanks for helping me.
posted by EatingCereal at 6:39 PM on September 30, 2010

You have to set the computer to boot into the CD first. Right at the beginning, before the grub error pops up, there should be a brief prompt at the bottom saying press F2 for setup (not necessarily F2, it could be delete or any other key) and F12 for boot options or something (again, not necessarily F12, different computers want different inputs). Then choose CD-ROM from the options.

If there is no boot option option, you'll have to go into your bios and manually set the boot order. This seems like a reasonable tutorial.

Eventually, after you get into the Windows CD, you have to find the option to get you into the command line. I don't remember what it is specifically, but it shouldn't be too hard to find.
posted by Geppp at 6:56 PM on September 30, 2010

It's called the recovery console. It will at some point say Hit R to enter the recovery console. And if the FDISK command doesn't work, also try the one that's sort of set aside for fixing an MBR - FIXMBR
posted by deezil at 7:04 PM on September 30, 2010

Response by poster: @ Geppp and Deezil

Thanks for the help! I already had my BIOS set to check for any CDs or DVDs before booting from the hard drive.

When I loaded from disc, I got the blue screen of death! It said something about PCI.SYS.
posted by EatingCereal at 7:11 PM on September 30, 2010

Perhaps use Gparted.

Try inserting the Ubuntu CD you used to install Ubuntu and run it as a live disc (the "Try Ubuntu" button when prompted).

Once you're into Ubuntu, go to admin, and you should see gparted as one of your options. Once opened, this should be showing your hard drive as a partitioned or partially partitioned disc. From there you want to do something like (google the method because I am NOT an expert) wipe or delete the partitions.

Before you log out of the live disc session, you're probably going to want to install some kind of other file system or flags or something so that the disc is recognized by whatever you install next, but I don't know what those are, so google again.
posted by Ahab at 9:09 PM on September 30, 2010

You don't want to wipe or delete the partitions.

The very first 512-byte block on a DOS-partitioned hard disk is the Master Boot Record or MBR, and it contains two things: a primary boot loader, and a partition table.

When you partition a hard disk with one of the Microsoft tools (like Microsoft FDISK, or a Windows setup CD) then the tool writes a Microsoft boot loader to the MBR along with the partition table. When you install GRUB, the Microsoft boot loader gets replaced with GRUB's primary boot stage which, as you've found, won't work if it can't find the /boot/grub folder where it expects to.

As far as I know, none of the Linux-based partition management tools will ever modify the boot loader region of the MBR; all of them confine themselves to the partition table region. In other words, using Linux-based partitioning tools will not help you put the Microsoft primary boot loader back, which is what you actually need to do.

The official Microsoft tool for this job is FIXMBR, which is part of the Recovery Console accessible via a Windows XP setup disc.

Windows XP Setup was released in 2002, before the advent of SATA hard discs, and the XP kernel included on the disc can't talk to SATA controllers in native mode unless you provide it with a so-called F6 or text-mode SATA driver on a floppy disc. Many modern computers no longer include floppy discs, which makes this hard to do.

If your BIOS includes an option for making your SATA controller emulate an IDE controller, try turning that on before booting from the XP setup disc.

If that still doesn't work for you, but you can boot a Linux live CD without problems, try this:

1. Boot a Linux live CD on a computer that still has a Microsoft boot loader in place i.e. one that boots natively into some version of Windows.

2. Open a Terminal window, and type in the following command:

sudo dd if=/dev/sda of=/tmp/bootcode bs=446 count=1

This saves a copy of the boot code from the MBR of the first hard disk as a file named bootcode inside the /tmp folder. Depending on the exact Linux live CD you use and the hardware in your computer, you might find you need to use /dev/hda instead of /dev/sda.

3. Plug in a USB pen drive, copy the bootcode file from the /tmp folder onto the pen drive, and check its file properties to verify that it is indeed exactly 446 bytes long.

4. Boot the Linux live CD on the computer that has the broken installation of GRUB.

5. Plug in the USB pen drive, and copy the the bootcode file from the pen drive into the /tmp folder.

6. Open a Terminal window, and type in the following command:

sudo dd if=/tmp/bootcode of=/dev/sda conv=notrunc

Once again, you might need to try /dev/hda instead if you get a "No such file" message about /dev/sda.

This last command overwrites the primary boot loader on /dev/sda with the contents of the bootcode file. Once that's done, the computer should boot Windows without trouble.
posted by flabdablet at 3:03 AM on October 1, 2010 [1 favorite]

Assuming ReactOS did the standard thing of installing on the first partition... from the grub rescue prompt that pops up try this.

grub rescue> root (hd0,0)
grub rescue> chainloader +1
grub rescue> boot

Then your ReactOS should start booting. This tells grub to think about the first disk (hd0), first partition (0), load the boot loader from the +1 block of that partition, then execute it. Once ReactOS boots, use whatever 'fdisk /mbr' or disk repair tool available to rewrite a standard MBR.

Note: If your system has a hidden 'recovery' partition like my recent dells have had, ReactOS may have installed on partition #2, in that case you would use (hd0,1) as the root.

This is just what the standard MBR code does, it locates the partition marked as 'active' and loads/ececutes the bootloader found on that partition.
posted by zengargoyle at 9:54 AM on October 1, 2010 [1 favorite]

Response by poster: @ Ahab, Flabdablet, and Zengargoyle

I finally fixed my problem. A reinstall of Ubuntu fixed everything. Grub and Ubuntu both work great.

Deleting partitions didn't harm anything, installing ReactOS caused Grub to mess up. Everything is fine.

I'm so happy to have my computer back! Thanks everybody!
posted by EatingCereal at 5:40 PM on October 1, 2010 [1 favorite]

« Older What can I make from lousy fruit?   |   Between pegs and over curves Newer »
This thread is closed to new comments.