LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Help me please! GRUB Error 21 (https://www.linuxquestions.org/questions/ubuntu-63/help-me-please-grub-error-21-a-575394/)

mojorising73 08-07-2007 12:40 PM

Help me please! GRUB Error 21
 
Hi Everyone. I know you've heard this problem before and somewhere in these forums lies the answer but I have yet to run across it. Please keep in mind that I'm a Linux newbie and have no idea of what I'm doing. So forgive my ignorance. Ok, this is how it all started. I have two hard drives on my computer. At the time, my primary was Win Xp and my secondary the same. I installed Ubuntu sucsessfully on my second and I could switch easily from one to the other when I start up my computer by going into the bios and switching drives. Then my Ubuntu drive was having sound issues and istead of spending more time finding a solution, I reinstalled it. That's where it went all downhill. Long story short, I had to format both drives. I finally got Win XP back on one drive. Unplugged that one and reinstalled Ubuntu on the other. Now, I get something about GRUB loading...Error 21. I don't know what happened but I've been having a tough time with it for a few weeks now. I've tried looking at forums, manuals, I even downloaded Super GRUB onto a disk and nothing has helped. You know I'm sure Linux/Ubuntu is great but I can't experience it because of this problem. Please, if anyone can help me please do. Give me step by step instructions on where to start, what info you may need from me and how do I get that info because I'm clueless at this point. Thank you.

masinick 08-07-2007 01:15 PM

Please provide more information
 
Error 21 means "Can not find disk". Chances are you are pointing to the incorrect location with your GRUB menu entries. Please post the contents of /boot/grub/menu.lst and tell us where each OS is located, and we can help you more.

b0uncer 08-07-2007 01:23 PM

Step by step instructions are surely in some (probably several) threads here, just search well. Error 21 is already becoming famous among newbies. It could be at the GRUB website too.

While I haven't had this, I'm fairly sure it's got its roots in the harddisk layout. GRUB installs part of itself in the MBR (or beginning of partition, it depends how you make it) that BIOS searches for, but it's configuration files and the rest in your /boot partition. If you happen to remove /boot but MBR stays as it is, GRUB can't find it's configuration from the disk and so on. Another problem is how GRUB knows what physical drive is called what, as switching harddisks may cause BIOS to "map" the drives in a different way than GRUB thinks, causing GRUB to look for the configurations in the wrong disk. This sounds very unclear, but if you just take the time to search for the older "error 21" threads, it should enlighten. You could either re-install or re-configure your GRUB. I don't encourage having two drives and taking either one out at times, better to either have both in at the same time and not plug them in and out, or then have only one disk at a time connected, to make sure the disk order is same for BIOS and GRUB. And avoid overwriting either /boot or MBR/partition beginning when doing reinstalls.

pixellany 08-07-2007 02:46 PM

When installing Ubuntu, can you recall what options you selected for installing the bootloader (GRUB)?
GRUB has to be installed in such a way that it can find the /boot directory with its files. This gets "hard-coded" into the GRUB code that goes into the MBR.

Take a look also at the link below on booting.

stumpedguy_frustrate 08-07-2007 02:52 PM

what happened was, when you unplugged the WinXP drive, you made the Ubuntu drive the first drive. So now, GRUB is looking for files on the XP drive (now that I assume it is plugged back in) and it can't find any files. You need to boot the Ubuntu disk again and you need to change the location of where GRUB should be looking for the files.

pixellany 08-07-2007 03:02 PM

Quote:

Originally Posted by stumpedguy_frustrate
.....and you need to change the location of where GRUB should be looking for the files.

Which you must do by re-installing GRUB......

mojorising73 08-09-2007 02:13 PM

suggestions
 
Thank you for writing some suggestions. The only problem is that I don't know how to do some of them. I don't know how to get the contents of /boot/grub/menu.lst. I would like to reinstall grub but how do I get into it? Do I load up the Live CD and then try to install it through the terminal? Becaue everytime I restart my computer I get that Grub error? Should I run it with my Ubuntu disk in? Please let me know if you'd like to just email me directly for some ideas to get this cleared up. Thank you.

--johnny

pixellany 08-09-2007 02:22 PM

Running from the Live CD, you can run all the same commands that you would from the installed version.

When someone asks for the content of a file, you can get that with any text editor--or in a terminal.

to re-install grub, you need to know the partition where the /boot directory is. This can be verified by mounting a partition and looking at the contents---but if you simply do "fdisk -l", the answer may be obvious.

Suppose you have one IDE drive (/dev/hda) and /boot is on the first partition (/dev/hda1). The commands to install GRUB are:
grub (opens the grub shell)
root (hd0,0) points grub at the partition containing /boot---grub counts from zero)
setup (hd0) puts grub in the MBR of hda

mojorising73 08-12-2007 01:45 PM

I got Ubuntu running
 
I got it working! I don't know how I did it. I'm just glad it's working. Here's what I did. I was going to have a friend take a look at it because he's experienced in Linux stuff so I thought I'd start from scratch by reinstalling Win Xp on my drive. So, I put in my Win XP disk in and it bypasses my GRUB error but my Unbuntu screen loading bar wasn't moving at all . I ctrl-alt-del to start again and I noticed right after GRUB loading it said press ESC for menu. I did and saw a menu for Ubuntu and Ubuntu recovery mode. I choose that and let it run until I got the prompt again. I rebooted and then choose the regular Ubuntu and low and behold, it started. No live CD, no GRUB error 21. I was shocked. I don't know if I can load without my Win XP disk now, or if anything will go wrong if I plug in my Windows drive but I am happy for now. Thanks everyone for their ideas on fixing my problem that started all because of me. If I ever run into anything like it again (I'm sure it will be soon, lol), I'll post again. Thanks.:newbie:


All times are GMT -5. The time now is 09:38 AM.