LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I resolve Grub 21 Error (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-resolve-grub-21-error-772326/)

iabailey 11-29-2009 06:39 PM

How do I resolve Grub 21 Error
 
Hello,

A few months ago, I bought a new hard drive. I thought it would be clever and SAFE to install Ubuntu on the Hard Drive so that would not interfere with the internal hard drive on my laptop. It worked fine until I disconnected the hard drive. I got the "Grub Error 21" when I installed. I know how to get around it, unfortunately, I have to lug around this hard drive whenever my computer sleeps or restarts. This weekend I had a scare where I thought my external reformatted. Everything is ok, but I need to correct this issue soon. Pleas help.

yancek 11-29-2009 06:46 PM

If your computer only boots when you have your external hard drive attached, you have installed stage1 of Grub to the master boot record of your internal drive. When you boot the computer without the external drive attached, Grub is unable to find the files necessary to boot as they are on your Linux partition on the dis-connected external drive.

Boot your computer and from Ubuntu run the command: sudo fdisk -l (lowercaseletter L) and post the output here. You need to install Grub to the mbr of the external. What OS do you have on the internal drive? Which version of Ubuntu do you have? 9.10, 9.04 or earlier. 9.10 uses a different version of Grub.

iabailey 11-29-2009 07:15 PM

I have Ubuntu 8.10. What do you mean I need to install Grub?

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xd885d28f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 18830 151251943+ 7 HPFS/NTFS
/dev/sda2 18831 19456 5028345 1c Hidden W95 FAT32 (LBA)

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x469d60df

Device Boot Start End Blocks Id System
/dev/sdb1 1 821 6594651 c W95 FAT32 (LBA)
/dev/sdb2 822 121601 970165350 5 Extended
/dev/sdb5 822 121231 967193293+ 83 Linux
/dev/sdb6 121232 121601 2971993+ 82 Linux swap / Solaris

iabailey 11-29-2009 07:17 PM

The ubuntu is on the hard disk. Windows Xp SP 2 is on the internal.

jiobo 11-29-2009 07:52 PM

Your system is a notebook computer with an internal HD that has Windows on it, and you have an external USB HD that you installed Ubuntu on? Is that right?

Then what you want is to boot you notebook computer to Windows when you do not have the external HD, and to boot to Ubuntu when you have the external HD connected? Is that right?

One solution would be to reinstall GRUB onto your notebook computer so that you have a default chainloader+1 boot to Windows, and a menu selection to boot the USB HD. The GRUB manual can be of help.

You can also check your BIOS boot order to see that it still has the notebook HD selected as the first boot device.

itsbrad212 11-30-2009 12:07 AM

all you need to do is go into your BIOS and change the boot order to:

USB
Optical Drive
Hard Drive
Floppy

(I put optical drive second just in case you need to boot from the live cd later on. It doesn't hurt to have it on there. I also put floppy last because most people don't use floppy disks anymore) :D

EDIT: GRUB shouldn't even effect the internal hard drive, because if I read correctly, GRUB was installed with the distro on the external hard drive, right?

Wifi-Fanatux 11-30-2009 02:19 AM

Grub CD
 
Burn this grub iso and try to boot to either your internal drive or your usb drive.

http://www.keepandshare.com/doc/view...d=1579977&da=y

yancek 11-30-2009 08:54 AM

Quote:

What do you mean I need to install Grub?
What I said in my previous post was that you need to install Grub to the master boot record of the "external drive". Based on the error message you get when you boot without the external attached, you have installed the stage1 file of Grub to the master boot record of the "internal drive" so that when you boot without the external attached, the stage1 file in the master boot record of your internal drive is looking for the remaining files of Grub needed to boot. Since these files are on your dis-connected external drive, Grub can't find them.

Since you are using Ubuntu 8.10 and your Ubuntu partition is on sdb5, the commands to install Grub to the mbr of the external would be to log in as root:

sudo grub (prompted for your password, enter it, hit enter key, get grub prompt - grub>)

At the grub prompt type:

root (hd1,4)
setup (hd1)
quit

In the terminal open the menu.lst file:

sudo gedit /boot/grub/menu.lst

At the bottom of the file enter the following:

title windows xp
rootnoverify (hd0,0)
chainloader +1

This will allow you to reboot from Ubuntu to xp.

To change the internal master boot record to include xp bootloader info use your xp installation CD, type 'R' at the prompt or select Recovery mode and enter: fixmbr
if that fails, enter fixboot

If you don't have a full installation CD, you could download SuperGrubDisk and use it to repair windows mbr.

Doing this will only allow you to boot Ubuntu from the external when you select the external in the BIOS. It is possible to boot Ubuntu from xp but, that's another story.


All times are GMT -5. The time now is 11:41 PM.