LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2009, 06:39 PM   #1
iabailey
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Exclamation 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.
 
Old 11-29-2009, 06:46 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware, Ubuntu
Posts: 10,094

Rep: Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369
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.
 
Old 11-29-2009, 07:15 PM   #3
iabailey
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Unhappy

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
 
Old 11-29-2009, 07:17 PM   #4
iabailey
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
The ubuntu is on the hard disk. Windows Xp SP 2 is on the internal.
 
Old 11-29-2009, 07:52 PM   #5
jiobo
Member
 
Registered: Nov 2008
Posts: 180

Rep: Reputation: 36
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.
 
Old 11-30-2009, 12:07 AM   #6
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
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)

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?

Last edited by itsbrad212; 11-30-2009 at 12:39 AM.
 
Old 11-30-2009, 02:19 AM   #7
Wifi-Fanatux
Member
 
Registered: Mar 2009
Location: Northwest
Distribution: LAPTOP->DreamStudio & Saline-Debian
Posts: 70

Rep: Reputation: 19
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
 
Old 11-30-2009, 08:54 AM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware, Ubuntu
Posts: 10,094

Rep: Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369Reputation: 2369
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to resolve compilation error;./List.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ amolgupta Programming 3 01-09-2009 10:09 AM
Who can tell me how to resolve this image error? frinsz Linux - Kernel 2 12-02-2008 12:20 AM
Fatal Error - Cannot Resolve ayomi8175 Linux - Newbie 1 03-19-2008 08:19 AM
ERROR! Cannot resolve ballistic509 Debian 18 09-24-2006 06:51 PM
how to resolve this error? sensovision Linux - Software 3 07-07-2004 03:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration