LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-12-2009, 07:13 AM   #1
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Rep: Reputation: 0
Question GRUB Error 21 | can't start Debian or Vista from external harddrive


I installed Debian (don't know which version but here is the link where I downloaded it) on my external harddrive (3,5" USB 2.0 SATA HDD enclosure)
When I installed it it asked me if there are more systems than Vista (I've only got Vista) and if not it would be good to install GRUB.
But everytime I'm starting my PC I'm getting this:
GRUB Loading stage1.5.


GRUB loading, please wait
Error 21

First I thought there was a wrong information in the menu.lst, so I learned how to start the rescue mode and execute a shell, set the chmod of menu.lst
I opened the menu.lst but it seemed that everything was right.

I installed debian on sdb 2 (I think that's hd1,1) and Vista on sda 1 (hd0,0?)

I hope you can help me (or understand what I wrote, because I'm just 15;-)

Topsi
 
Old 10-12-2009, 07:33 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Error 21 usually is an Unknown Error.
Where do you have the grub installed? I would suggest you install it in the internal drive even though Debian is installed on the usb disk.

Can you go into rescue mode after booting from Debian disk and reinstall grub?

sudo grub-install /dev/sda
 
Old 10-12-2009, 09:58 AM   #3
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Original Poster
Rep: Reputation: 0
I already installed it there.
There is an option in the rescue program to reinstall GRUB.

I think you want me to use
sudo grub-install /dev/sda
in shell?
However when I clicked to reinstall GRUB it asked me where to install it.
I chose the Master Boot Record.
But it said Error.

In graphic rescue mode worked it.
But I keep getting Error 21
 
Old 10-12-2009, 10:13 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
Selected disk does not exist
This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system.
Above is the Grub Error 21.

Did you install Grub to the mbr of the internal or the external drive? Which is set to first boot priority in the BIOS?

Use your install CD to go to rescue mode, open a terminal and run the "fdisk -l" command to get partition information (that's a lower case Letter L in the command). Post that info here. Also would be helpful to post the contents of menu.lst

Did you install vista or was it installed? There may be a recovery parition if you didn't install. Check the cables to the external.
 
Old 10-12-2009, 11:19 AM   #5
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Original Poster
Rep: Reputation: 0
OMG I typed in the whole text and then the quick reply window closed-.-

1st Boot Device CDROM
2nd Boot Device Removable
3rd Boot Device Hard Disk

default 0
timeout 5
color cyan/blue white/blue

title Debian GNU/Linux, kernel 2.6.26-2-686
root (hd1,1)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/sdb2 ro quiet
initrd /boot/initrd.img-2.6.2.6-2-686

title Debian GNU/Linux, kernel 2.6.26-2-686 (single-user mode)
root (hd1,1)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/sdb2 ro single
initrd /boot/initrd.img-2.6.2.6-2-686

title Other operating systems:
root

title Windows Vista/Longhorn (loader)
root (hd0,0)
savedefault
makeactive
chainloader +1




fdisk -l will follow soon...
 
Old 10-12-2009, 11:24 AM   #6
deathscent
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
hi, i'm having a sort of similar problem, only that... it's slightly different.

it all started when my brother's cpu/hard drive died. he had some stuff he wanted off his hard drives for school, and i said sure to him using my PC as a backbone.

some hour or two later, linux was being installed. i didn't mind that linux was being partitioned ON A COMPLETELY DIFFERENT DRIVE (my brothers), AND HE/I ASSUMED THAT THIS WOULD HAVE NO AFFECT ON MY OWN DRIVES.

linux refused to boot from either of his drives, and when i disconnected the drives, trying to boot into my beutifully secure boot of Windows 7, i got a beautiful little message that is now haunting me:
Error 21

i am trying to find out how i can get rid of this thing so that i can just access my windows, my beautiful safe hold of "i really don't care if i get viruses, or other garbage".

i'm also assuming that this is a BIOS problem.

if anyone can help me weave my ass around this stupid problem, i will love you forever.

thanks,

rob
 
Old 10-12-2009, 11:38 AM   #7
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Original Poster
Rep: Reputation: 0
Vista was installed before I installed Linux

fdisk -l:

Disk /dev/sda: 320.0GB, 320072933376 bytes
240 heads, 63 sectors/track, 41345 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x56821e70

Device Boot Start End Blocks Id System
/dev/sda1 * 1 38569 291579896 7 HPFS/NTFS
/dev/sda2 38569 38571 15360 e W95 FAT16 (LBA)
/dev/sda3 38572 41346 20971360+ f W95 Ext'd (LBA)
/dev/sda5 38572 41346 20971329 b W95 FAT32


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

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 117679 945251512 7 HPFS/NTFS
/dev/sdb2 117680 121434 30162037+ 83 Linux
/dev/sdb3 121435 121434 1341427+ 5 Extended
/dev/sdb5 121435 121601 1341396 82 Linux swap / Solaris

edit:
oh and cables are right, because I'm using external for the rescue mode and it wants me to "enter a device you wish to use as your root file system. You will be able to choose among your various rescue operations to perform on this file sytem."

I can choose between:
/dev/sda1
/dev/sda2
/dev/sda3
/dev/sda5
/dev/sdb1
/dev/sdb2
/dev/sdb3
/dev/sdb5

(I always choose sdb2, because I think Linux is installed there... now i think sdb5=swap[whatever a swap is xD] right?)

sdb1-sdb5 isn't listed when I pull the plug of the external.

Last edited by Topsi; 10-12-2009 at 11:55 AM.
 
Old 10-12-2009, 02:55 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Topsi: First thing I would suggest is to switch boot order for Removable and HDD in BIOS and try that. Also, you answered most questions but which drive did you install Grub to mbr on? Do you know? If the hard drive was attached when you installed Debian on the external, the default would be to install to the first drive which likely was the internal with vista.

vista has to be on sda2 and Debian on sdb2. Grub does not always see the partitions with the same output as you get from fdisk. If switching boot order as suggested above does not work, boot the Debian CD (I'm assuming you can't boot Debian either??) and log in as root, type "grub" to get a grub prompt (grub>) and enter consecutively:

geometry (hd0) (hit enter key)
If grub sees sda as (hd0), you should get output such as:

Quote:
Partition num: 1, Filesystem type unknown, partition type 0x7
The 0x7 at the end means ntfs windows partition
geometry (hd1) (hit enter key)

If grub sees sdb as (hd1), you should get output such as:

Quote:
Partition num: , Filesystem type is ext2fs, partition type 0x83
The 0x83 show Linux partition.

Look at your device.map file which is in /boot/grub directory to see if it shows sda as (hd0) and sdb as (hd1).
 
Old 10-12-2009, 02:58 PM   #9
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Topsi: First thing I would suggest is to switch boot order for Removable and HDD in BIOS and try that. Also, you answered most questions but which drive did you install Grub to mbr on? Do you know? If the hard drive was attached when you installed Debian on the external, the default would be to install to the first drive which likely was the internal with vista.

vista has to be on sda2 and Debian on sdb2. Grub does not always see the partitions with the same output as you get from fdisk. If switching boot order as suggested above does not work, boot the Debian CD (I'm assuming you can't boot Debian either??) and log in as root, type "grub" to get a grub prompt (grub>) and enter consecutively:

geometry (hd0) (hit enter key)
If grub sees sda as (hd0), you should get output such as:

Quote:
Partition num: 1, Filesystem type unknown, partition type 0x7
The 0x7 at the end means ntfs windows partition
geometry (hd1) (hit enter key)

If grub sees sdb as (hd1), you should get output such as:

Quote:
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
The 0x83 show Linux partition.

Look at your device.map file which is in /boot/grub directory to see if it shows sda as (hd0) and sdb as (hd1).

Quote:
(I always choose sdb2, because I think Linux is installed there... now i think sdb5=swap[whatever a swap is xD] right?)
sdb2 is the only possible place for your root filesystem.

Quote:
sdb1-sdb5 isn't listed when I pull the plug of the external.
Right. There would be no way for them to be recognized if the drive is not plugged in.
 
Old 10-12-2009, 03:35 PM   #10
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
deathscent:

You should probably start your own thread instead of jumping in to someone else's even though it is similar.

I assume your brother wanted to save info from his drive so he attached it to your computer to do so?? I don't know how he got to installing Linux from trying to save data??

If he did try to install some version of Linux on his drive, it appears to me that he installed part of the Grub bootloader to the master boot record of your primary drive. Since he has removed his drive from your computer along with most of the boot files on his Linux partition, it obviously won't boot. Also, his drives won't boot because he installed the stage1 Grub file on your computer. I'm assuming all this based on your info as I don't have any information on your/your brothers computer, their partition structure.

What do you want to do? You had windows 7 ONLY on your computer and want to boot it??

I doubt this is a BIOS problem.

If you have a CD or whatever you use to install windows 7, you should be able to repair the master boot record. Otherwise, I think EasyBCD from neosmart technologies would help. It's good with vista and I assume windows 7 uses the same bootloader. Otherwise I would suggest you google the problem.
 
Old 10-12-2009, 07:22 PM   #11
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
Topsi

You have grub legacy installed in mbr so have a read of
http://www.linuxquestions.org/questi...hooter-278748/

I have a different way of doing it but remember if you change your bios boot order and you can not boot...grub legacy can still help you at the commmand mode.

firstly pretend you are at boot stage and get grub error

it should drop you into a command mode with grub flashing >

-----

type and enter

find /boot/grub/

and note what the output is...(hd0,1) or (hd1,1) etc

find /etc/fstab

and note what the output is.

lets pretend the linux was hdzero...so vista is on hd1.

So from command mode you can boot vista

Code:
root (hd1)  (means set to mbr of hd1)
chainloader +1
boot
if wrong...change to hd0

if wrong also try hd0,0 and hd1,0

(I am covering most bases)


sda1 is bootable so yancek made a typo...vista is on sda1 not sda2 on current bios setup.

if you do not change the bios order...sdb is the external which is hd1

good luck

2) Assuming you agree to put bios boot order back to removable before internal
...install grub into mbr of external to boot linux...so you can take it to a friends house.

WARNING make sure to use grub find commands to confirm the next bit uses hd0,1....as I do not know what your current bios boot order is..or the responses to your last search...pls note and leave until later if unsure.

if you understand that find /boot/grub returns (hd1,1) feel free to change below...but you must confirm what grub can see before issueing that command ok?


boot a live cd
Code:
su
grub
root (hd0,1).......(or could be hd1,1)
setup (hd0)........(or could be hd1)
quit
grub legacy counts drives and partitions from zero

Last edited by aus9; 10-12-2009 at 07:32 PM. Reason: fix some of my typos
 
Old 10-13-2009, 09:21 AM   #12
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Original Poster
Rep: Reputation: 0
@Yancek
Quote:
First thing I would suggest is to switch boot order for Removable and HDD in BIOS and try that.
-> Error 21 again

Quote:
which drive did you install Grub to mbr on? Do you know? If the hard drive was attached when you installed Debian on the external, the default would be to install to the first drive which likely was the internal with vista.
Do you mean the internal hard drive with "the hard drive which was attached" Then the hard drive was attached.

I reinstalled GRUB on (hd0) or /dev/hda (I had to type this to install GRUB in the Master Boot Record it said). I also tried to install it in "the second patition of my first hard drive", but I didn't try it in the graphical rescue mode-> could not intstall it... very bad (something like this said the message box)

grub> geometry (hd0)
drive 0x80: C/H/S = 0/240/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 1, Filesystem type is fat, partition type 0xe
Partition num: 4, Filesystem type is fat, partition type 0xb

grub> geometry (hd1)
drive 0x81: C/H/S = 0/255/63, The number of sectors = 1953525168, /dev/sdb
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82

content of device.map: (just 2 lines)
(hd0) /dev/sda
(hd1) /dev/sdb

What does this mean?
Linux is installed in Partition 2, I knowed that. (1st Partition is Volume)

@aus9

I will read ur links first^^
 
Old 10-13-2009, 10:01 AM   #13
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
I made an error in my earlier post which aus9 pointed out, vista is on sda1 not sda2. If you want to use Debian Grub to boot you can do the following which should put Grub stage1 in the master boot record of the first drive and it will point to the remaining Grub boot files on sdb2. If you do this, you will not be able to boot the internal drive unless the external is attached.

Open a terminal as root user and go to a grub prompt by typing grub. You should get: grub>

at this prompt type:

root (hd1,1)
setup (hd0)
quit

The other option is to put Grub stage1 file in the master boot record of sdb pointing to the remaining Grub files on sdb2. This will allow you to boot the external when it is set to priority over the internal drive. If you have the correct entry in the menu.lst file you should also be able to boot vista. This won't help if the external drive is disconnected and you have only the internal vista. You may need to repair the mbr in vista to boot it from the first drive.

From Grub prompt type:

root (hd1,1)
setup (hd1)
quit

Quote:
I also tried to install it in "the second patition of my first hard drive"
If you do this you won't be able to boot unless you have Grub from another distribution installed to chainload it or you configure the vista bootloader to do it.

Your device.map entries mean that Grub sees (hd0) as sda and (hd1) as sdb.

What is on the first 90%+ of sdb which is a vista partition. Not sure if that could be a problem because of the size of the drive?
 
Old 10-13-2009, 01:25 PM   #14
Topsi
LQ Newbie
 
Registered: Oct 2009
Location: Germany | Bremen
Distribution: Debian
Posts: 13

Original Poster
Rep: Reputation: 0
I think I understand...
but it seems that I have installed GRUB on my external Master Boot Record, because Removable was the 2nd Boot Device and Hard Disk was the 3rd (because of this my external was hd0 for GRUB, but not for the Linux-Installer. Linux was installed on my external and the GRUB files which should be installed in the MBR of my internal have been installed in the MBR of my external, right?

If that's correct why loads GRUB when my external is not plugged in?

How did you upon the solution?
I just want to understand what's going on.

And could you explain me the advantages and disadvantages of these 2 options?
Because it seems they are equal.

edit:
@aus9:
Is GRUB Legacy a program or something like a livecd?
Because if you mean with GRUB Legacy just GRUB i want to say
you:
There is nothing which "drop you into a command mode with grub flashing"

Last edited by Topsi; 10-13-2009 at 01:30 PM.
 
Old 10-13-2009, 04:43 PM   #15
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
because of this my external was hd0 for GRUB
Your device.map file shows (hd0) as sda. Don't know if you unplugged the external at some point, this could make a difference.

Quote:
GRUB files which should be installed in the MBR of my internal have been installed in the MBR of my external, right?
Don't know. If Grub begins to load when the external is not plugged in then I would say no.

Quote:
And could you explain me the advantages and disadvantages of these 2 options
Grub, like most if not all bootloaders, has more than one file. It has a file called stage1 which is not larger than 512 bytes which goes in the master boot record and basically point to the stage1.5 or stage2 files elsewhere on the computer. The BIOS looks to the mbr and with Grub, if stage1 is there it point to the next step (stage 1.5 or stage2) to continue the boot process. So, if you choose option 1, your stage1 file will be on your internal hardrive master boot record and it will point to the stage1.5 or stage2 files needed to boot on the partition on the external drive. If the external drive is not attached, it obviously won't boot. That's the big disadvantage. If you plan to keep the external attached, it should not be a problem. If you do not expect to keep it always attached, don't do it this way.

Option 2 would put the stage1 file of Grub in the master boot record of the external drive pointing to the stage1.5 or stage2 files on a partition on that disk. If you have this disk set to first boot priority in the BIOS it should boot right up if your entries are correct. Doing this will allow you to boot Debian from the external by simply setting that drive to first boot priority. You could also put an entry in the menu.lst file on the Debian partition of the external disk for vista so that you could boot it also.

aus9's reference to Grub Legacy just means an older version of Grub which is still used on most Linus computers. A newer version has been released but is not used much as yet. Still ironing out bugs, I guess.

Have you got it working?
 
  


Reply

Tags
debian, error, externalharddrive, grub



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
Installing on External Harddrive without GRUB on Internal nckinfn04 Ubuntu 1 05-07-2007 07:32 AM
Running Debian Linux on external harddrive CrownAmbassador Linux - Hardware 1 08-15-2006 02:29 PM
having trouble installing debian on external usb harddrive willigi Debian 4 11-14-2005 03:24 PM
Installing Debian on an external USB harddrive (NOT a flash drive) Hikaru79 Debian 1 06-23-2005 09:40 PM
GRUB on external harddrive Norky Linux - Software 1 02-16-2005 07:23 AM

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

All times are GMT -5. The time now is 12: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