Grub error 21
June 23, 2010 4:27 PM   Subscribe

When trying to boot my computer, I am getting a Grub Error 21. I have tried several methods to fix and none of them have worked. I am at wits end.

About my computer: I have a home-build Quad Core intel processer. My main os is Windows 7 ultimate. I have tried to install Ubuntu in the past, but it never showed up on the boot menu. I didn't mind until one morning my computer wouldn't get past the Grub 21 error. The prevailing solution is to boot into a live CD and type in several commands to repair the Grub file (or whatever) and that fixes the problem.

First I tried using the Ubuntu Live CD (version 9 or 10) and it stops in the boot process and gave me the following error:

"Unable to find a medium containing a live file system"

and then kicked me to the busybox console.

Next, I tried downloading the latest version of knoppix. It gave me a

"can't access tty, job control turned off

error, no matter what boot commands I tried. (even failsafe mode failed) it again kicked me to the busybox console.

Next tried an older 7.10 Ubuntu live cd. But it gave me a

"Buffer I/O error on device fd0, logical block 0"

several times before going to the busybox console. I assume it's looking for a floppy drive that isn't there (but I can't install one, as my harddrive has no floppy port, only IDE and a bunch of SATA ports)

Lastly I downloaded and burned the SuperGrub disk, but that failed to boot for an unspecified reason.

I do not have the original windows install disk to perform a repair on the MBR, I suppose that is my endgame, to find this disk. I have tried using old copies of the Windows 7 Beta to repair it, but they seem unresponsive and can't find any errors.

I want one of the following
  • Fix Grub
  • Get into some form of the Linux console to fix grub
  • Fix MBR
is there a way to fix grub from the busybox console?
Is there a utility to fix Grub or the MBR that I can boot?
is there a bootable version of linux that I could try?
Is there another way to fix Grub error 21?
posted by hellojed to Computers & Internet (21 answers total) 1 user marked this as a favorite
 
Do you have an external disk enclosure?

Could you remove the drive, boot from CD, put the drive in the enclosure, and fix it from there?
posted by Netzapper at 4:39 PM on June 23, 2010


It's been a while since I ran Ubuntu (matter of fact, I just recycled the paper I had this solution written on, from when I had a similar problem). Hopefully this works for you.

sudo grub
find /boot/grub/stage1 or find /grub/stage1
root(hdX,Y)
setup(hd0)
quit

hdX,Y would be something like hd0,0, or hd0,2 , depending on where ubuntu was installed.. How one determines that, I can't recall (sorry!)
posted by comradestu at 4:52 PM on June 23, 2010


Response by poster: Removing both harddrives allows me to get into the Ubuntu Desktop (at last!) but ubuntu apparently doesn't have Grub installed, and it can't find the hard drives after I plug them in. What is the command to do this?

In the intirm, am messing with the Cmos settings. It's pretty fruitless.
posted by hellojed at 5:00 PM on June 23, 2010


Response by poster: I am installing Ubuntu on one of my hard drives. My plan is to transfer important files over to a backup and wipe the drive, as I am tired of messing with it and this seems to be the only option that will actually get me anywhere soon.
posted by hellojed at 5:53 PM on June 23, 2010


I turned up this while googling the fd0 error: http://www.overclock.net/linux-unix/388852-buffer-i-o-error-device-fd0.html
Perhaps some of the information there will let you boot from a live cd while the drives are plugged in?

Did you try hooking your boot drive up to an enclosure and reading it that way? That might rule out if there's something more going on, beyond the grub error
posted by comradestu at 5:56 PM on June 23, 2010


Hold on – you're flying ahead here. Go back. What's the problem? You boot up your computer and get Grub error 21? If I recall correctly, that error gives you a command prompt, right?

Getting into Ubuntu or whatever would help if what you wanted to do was fix Grub. It might even help a little bit in this case, but it's not really the immediate issue. What you want to do is fix the booting error. Your objective should be to get into Windows 7 and then download and run EasyBCD to fix the boot.

Booting into Windows 7 shouldn't be difficult. Just type the commands that comradestu lists above when you get that Grub Error 21; you should be able to boot that way. Let us know what happens.
posted by koeselitz at 6:00 PM on June 23, 2010


hellojed: “I am installing Ubuntu on one of my hard drives. My plan is to transfer important files over to a backup and wipe the drive, as I am tired of messing with it and this seems to be the only option that will actually get me anywhere soon.”

Whoa - that's jumping the gun, I think. We're happy to help, but I think we need to know: what's happening when you boot? Exactly? For example, when you got it to boot into Ubuntu, what happened, and how did you know that "apparently Grub isn't installed" on Ubuntu?
posted by koeselitz at 6:02 PM on June 23, 2010


Oh, and by the way: the easy way to mount your drive in Linux is to open up the terminal (Accessories -> Terminal) and type this command and press enter:

sudo mount -a

That just means "connect to every drive you possibly can that I have plugged in right now."

For a list of all the drives you have currently mounted, run this command:

mount -l | grep /dev/.d.

This will tell you which drives (or partitions) are mounted at which folders. The first one listed should be your Ubuntu install – it's mounted on /, just a plain slash.

If sudo mount -a doesn't mount a drive even when it's connected, then make a mount-point:

sudo mkdir /mnt/drive

Then, try to mount various drives:

sudo mount -v /dev/sda1 /mnt/drive
sudo mount -v /dev/sda2 /mnt/drive
sudo mount -v /dev/sda3 /mnt/drive

... and keep going until you get one that doesn't give you the does not exist error. Then, do

ls /mnt/drive

which will list your directories and files on that newly-mounted drive.
posted by koeselitz at 6:30 PM on June 23, 2010


Response by poster: I get no command line when grub 21 comes up.

And now there appears to be a disk error on boot. I tried removing and plugging the hard drives back in. CMOS can't find any hard drives (ubuntu couldn't either, but oh well)
posted by hellojed at 6:32 PM on June 23, 2010


Response by poster: Also, I apologize for jumping ahead. I've been working on this for about 3 days and nothing I've tried seems to work.
posted by hellojed at 6:36 PM on June 23, 2010


Response by poster: how did you know that "apparently Grub isn't installed" on Ubuntu?

Typing in "sudo grub" resulted in "Command not found"

Typing in "grub" resulted in "grub not installed"
posted by hellojed at 6:38 PM on June 23, 2010


This is no help to you at all and I'm sorry for that, but after two weeks of trying to fix Grub on my homebuilt (while able to boot to an old live CD, but couldn't get it to install the old OS) I broke down and wiped everything for a fresh install with a new live CD. After backing everything up, of course, but still. The 'nuke it from orbit' option was in the back of my mind from the beginning, and I finally relented. FWIW things are peachy now.
posted by carsonb at 6:47 PM on June 23, 2010


Best answer: Oh hey, hellojed - sorry if I sounded like I was scolding. Three days is a long, obnoxious time, I know.

First of all, it sounds distinctly like your CMOS isn't set up to boot from a CD. If it's going to the BusyBox prompt every time, even if there's a little variation, then something weird has to be up. Knoppix in particular I know pretty well, and it should be able to boot off of any system immediately and run in RAM with just the CD. What happened when you tried to boot off of those CDs? Did it show a splash-screen, or an identifier of any kind? Did it say "Knoppix" or "Ubuntu?" I'm betting it probably didn't; which means it's not booting to the CD at all.

If removing the drives allows you to boot to CD (I think that's what happened upthread there) then what's happening is that your CMOS settings are set to boot only to the hard drive. They should be set to boot first to the CD/DVD drive, and then to the hard drive; this is so that a CD in the drive interrupts the standard boot and just boots from there. It would probably be good to change those settings.

In any case: the thing about Grub not being installed...

The thing to know here is that we're talking about two different things. The Grub bootloader is a bit of software installed on the first few sectors of your hard drive that tells it how to behave when you start the computer. The grub command within Linux is a different program which installs the grub bootloader. So (while I think you probably already grok this, I may as well explain it) to manipulate the grub bootloader, you want to either install or have already installed the grub program. I know for a fact that Knoppix comes with the grub program pre-installed, so you might want to boot into that and see what you can do from there if you want to try repairing grub.

However – I still think this might not really be the quickest way around this.

I'm guessing you don't have any Windows 7 disks, do you? Even if you don't SuperGrub ought to be able to boot Win7 systems. Even if all you can get from a boot disk is a command prompt, that's all you need; all you have to do is run this command:

Bootrec.exe/FixMbr

from a Windows command prompt, and your boot will probably be fixed.

Oh, and one thing – I really think you should put the hard drives back in. I don't know what good taking them out did. if you can't get a system to boot from a CD, it's not because the hard drives are connected, it's because the boot options aren't set or because there's a real hardware problem somewhere. In any case, you'll want them in there at boot when you finally get into Windows 7, as that will allow you to actually fix the native boot record. And even if you're just booting into Ubuntu livecd or Knoppix, having the drives plugged in at boot helps, because that way the system finds them automatically, without the hassle I described above for finding and mounting drives.
posted by koeselitz at 7:38 PM on June 23, 2010


Ah - I see you have a Win7 beta disk. (Sorry I missed that.) There has to be some way to get that to boot. We should check your CMOS settings; the boot order is set wrong, I'll bet.
posted by koeselitz at 7:40 PM on June 23, 2010


Response by poster: Alright, I straightened out my CMOS as best as I could. I can get to a command prompt within windows setup, so I will try that command next.

When I booted off Knoppix it would give me the standard Knoppix splash screen, where I could let it try to boot or I could enter boot commands. Knoppix has given me issues in the past. I'm not sure why. Even on failsafe modes with everything turned off.

Ubuntu would typically give me the loading screen and then it would go to the black busybox console.

Removing the drives was an act of desperation to try something, anything, different. For some reason removing them allowed Ubuntu to get to the desktop where I could use the terminal. From there I installed it on the spare room I have on my backup drive. From there I can see all of my hard drives. I'm not sure why Ubuntu can see the drives but not the CMOS.

thank you for your patience! I'll try to get into command prompt next.
posted by hellojed at 8:11 PM on June 23, 2010


hellojed: “Removing the drives was an act of desperation to try something, anything, different. For some reason removing them allowed Ubuntu to get to the desktop where I could use the terminal. From there I installed it on the spare room I have on my backup drive. From there I can see all of my hard drives. I'm not sure why Ubuntu can see the drives but not the CMOS.”

Ah – I understand completely. And sometimes hardware can give you weird issues like that; you never know. (Part of the reason I'm here saying all this is because I've been messing with Grub a whole lot over the last two weeks, as a result of a Windows Vista defrag that totally fried the boot on my machine. By the way, if you defragged your drive before this happened, that might be why...)

Anyhow – that actually sounds like we could work with it quite nicely. You say you've got an installation of Ubuntu on your backup drive now? That's perfect. You should be able to install the program grub and then use it to install a Grub bootloader on your main hard drive, if you'd like to do that; although of course the Windows MBR (master boot record) is the optimal solution.

I can walk you through the grub thing if that's something you need.

hellojed: “thank you for your patience! I'll try to get into command prompt next.”

No problem. I have to learn this stuff, because I'm a bumbling idiot and always mess stuff up myself. Just last night I accidentally deleted most of my Ubuntu desktop; spent an hour or so reinstalling it just so it'd boot right. Heh.
posted by koeselitz at 8:27 PM on June 23, 2010


Response by poster: Okay. It looks like running the "startup repair" from the recovery disk did the trick. It booted into windows before running Checkdisk. Apparently it fixed the Windows 7 Beta installation, but not the Windows 7 Ultimate. I think all my data is still on there, I just can't boot to my installation anymore....for some reason.
posted by hellojed at 8:28 PM on June 23, 2010


Response by poster: I need to go to bed soon. I have a bad feeling one of my drives may be dead, because I can hear it spin up but it's never shown up on either Ubuntu or Windows7 Beta.
posted by hellojed at 8:48 PM on June 23, 2010


Response by poster: Yeah. I'm going to call it a dead hard drive. It would explain why I got the Grub error, since it was next in line to boot after windows 7. It explains why the drive dosen't show up in Bios or any OS I have booted or installed.

I had some of my stuff backed up, but not all of it. My code all went on the backup. and most of my art is either on the internet or backed up. I'll miss some stuff, inevitably. I'll have to call some guy to get a copy of an old school project. Damage control time.
posted by hellojed at 9:14 PM on June 23, 2010


Damn. So you can't access that drive at all on any system, even when it's plugged in externally? Bummer.

I hope for your sake it's something else - I know it sucks to lose a lot of stuff. Good that you got it working again. Good luck, anyway.
posted by koeselitz at 9:20 PM on June 23, 2010


Response by poster: I spent all of last night and a few hours after work attempting to get the computer to boot into Ubuntu and not Windows7 Beta (which was expired and not really functioning)

So I bought a new hard drive (which I needed to do anyway) and installed ubuntu on that, again, which is what I'm doing for the time being until I have time to format everything properly.

The moral of the story: Drive Failures can, and will, happen to you. Bring a 6 pack.
posted by hellojed at 8:10 PM on June 24, 2010


« Older Give me direction!   |   Portuguese food question Newer »
This thread is closed to new comments.