Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just installed ubuntu on my external hard drive. Now when i start up my pc i get an error 21.
I know that error 21 means that it can't find the external hard disk. but what do i have to do about it?
I searched several forums but i couldn't figure it out.
Version 8.10 of Ubuntu? What else is on the computer? Any other OS's on the internal or external drives? What bootloader are you using, Grub? If you are using Grub, where did you install it? The mbr of the external drive? If that's the case you need to set the external to boot first in your BIOS. Use your installation CD as a Live CD and enter command: sudo fdisk -l, post output (that is a lower case letter L, not a number one in the command).
You need to enter in BIOS and chose to boot from the external hard disk drive. In your case i think you should try to boot from USB if the hdd is USB.
Be carefull not to have any other USB sticks / USB memory or whatever in your USB port from the PC, because it will try to boot from USB and if it cannot find an oS on those memory stick / or whatever you have plugged in ur usb port then will can't boot. ;-)
I use ubuntu 8.04 LTS. I tried 8.10 but the installation disk didn't work. I have XP on my internal drive, Ubuntu on my external usb drive. I use grub to boot up. When I boot i get an error 21 so I can't do anything. I tried to change some things with some program for grub before but that didn't work. It just booted windows then. now i reinstalled Ubuntu and i get error 21 again.
output of sudo fdisk -l:
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x17df17de
Device Boot Start End Blocks Id System
/dev/hda1 * 1 9728 78140128+ 7 HPFS/NTFS
Disk /dev/sdb: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000cce6f
Device Boot Start End Blocks Id System
/dev/sdb1 1 4659 37423386 83 Linux
/dev/sdb2 4660 4864 1646662+ 5 Extended
/dev/sdb5 4660 4864 1646631 82 Linux swap / Solaris
When you installed Ubuntu to the external drive, at some point you were asked where to install Grub. If you used the default (just clicked "Next") then you installed Grub to your internal drive. Now, Grub thinks that your Ubuntu is on the internal drive, unless you changed the configuration for the menu to be on hd1,0 instead of the default hd0,0 which is your internal drive.
If you have a live CD you can re write Grub to the MBR with the correct parameters, or write it to the external drive. If writing to the external drive, set your bios to load the external drive first.
Another option is to create a Grub CD that chain loads the external drive, but you would need to set the menu.lst listings to hd1 where ever hd0 appears for root and kernel. This is because the Grub CD will always associate the internal drive as hd0.
Hi Zilie, in order to get a clearer picture of your setup, how about booting your Live CD (the Ubuntu install CD), download the Boot Info Script to your Ubuntu desktop, open a terminal (Applications > Accessories > Terminal) and do:
Code:
sudo bash ~/Desktop/boot_info_script*.sh
That will create a "RESULTS.txt" file in the same directory from where the script is run, namely your desktop; please copy/paste the contents of that file to your next post, highlight the copied text, and click the pound sign # graphic in the forum message box so that the text will get "code" tags put around it. The results of that script will help clarify your setup and hopefully what it will take to correct your Grub error 21.
============================= Boot Info Summary: ==============================
=> Grub0.97 is installed in the MBR of /dev/hda and looks on boot drive #2 in
partition #1 for /boot/grub/stage2 and /boot/grub/menu.lst.
=> No boot loader is installed in the MBR of /dev/hdc
=> No boot loader is installed in the MBR of /dev/sdb
hda1: _________________________________________________________________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM
sdb1: _________________________________________________________________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 8.04.1
Boot files/dirs: /boot/grub/menu.lst /etc/fstab /boot /boot/grub
sdb2: _________________________________________________________________________
File system: Extended Partition
sdb5: _________________________________________________________________________
File system: swap
=========================== Drive/Partition Info: =============================
Drive hda: _____________________________________________________________________
fdisk -lu /dev/hda:
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x17df17de
Device Boot Start End Blocks Id System
/dev/hda1 * 63 156280319 78140128+ 7 HPFS/NTFS
sfdisk -V /dev/hda:
end of partition 1 has impossible value for head: 254 (should be in 0-15)
Drive hdc: _____________________________________________________________________
fdisk -lu /dev/hdc:
Note: sector size is 2048 (not 512)
Disk /dev/hdc: 728 MB, 728225792 bytes
255 heads, 63 sectors/track, 22 cylinders, total 355579 sectors
Units = sectors of 1 * 2048 = 2048 bytes
Disk identifier: 0x00000000
sfdisk -V /dev/hdc:
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/hdc: unrecognized partition table type
sfdisk: no partition table present.
Drive sdb: _____________________________________________________________________
fdisk -lu /dev/sdb:
Disk /dev/sdb: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders, total 78140160 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000cce6f
Device Boot Start End Blocks Id System
/dev/sdb1 63 74846834 37423386 83 Linux
/dev/sdb2 74846835 78140159 1646662+ 5 Extended
/dev/sdb5 74846898 78140159 1646631 82 Linux swap / Solaris
sfdisk -V /dev/sdb:
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
/dev/sdb: OK
blkid -c /dev/null: ____________________________________________________________
/dev/hda1: UUID="4A280678280662F5" TYPE="ntfs"
/dev/loop0: TYPE="squashfs"
/dev/sdb1: UUID="369c54b1-8a08-4ea9-a78e-cea2a8ee5102" TYPE="ext3"
/dev/sdb5: TYPE="swap" UUID="9916ad40-06a8-44f8-b1a1-89f3f116ea68"
=============================== "mount" output: ===============================
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /lib/modules/2.6.24-19-generic/volatile type tmpfs (rw,mode=0755)
tmpfs on /lib/modules/2.6.24-19-generic/volatile type tmpfs (rw,mode=0755)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/sdb1 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)
================================ hda1/boot.ini: ================================
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect /NoExecute=OptIn
=========================== sdb1/boot/grub/menu.lst: ===========================
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=369c54b1-8a08-4ea9-a78e-cea2a8ee5102 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd1,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 8.04.1, kernel 2.6.24-19-generic
root (hd1,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=369c54b1-8a08-4ea9-a78e-cea2a8ee5102 ro quiet splash
initrd /boot/initrd.img-2.6.24-19-generic
quiet
title Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
root (hd1,0)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=369c54b1-8a08-4ea9-a78e-cea2a8ee5102 ro single
initrd /boot/initrd.img-2.6.24-19-generic
title Ubuntu 8.04.1, memtest86+
root (hd1,0)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
makeactive
chainloader +1
=============================== sdb1/etc/fstab: ===============================
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=369c54b1-8a08-4ea9-a78e-cea2a8ee5102 / ext3 relatime,errors=remount-ro 0 1
# /dev/sda5
UUID=9916ad40-06a8-44f8-b1a1-89f3f116ea68 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
================================== sdb1/boot: ==================================
total 11104
drwxr-xr-x 3 root root 4096 2009-01-14 21:32 .
drwxr-xr-x 21 root root 4096 2009-01-14 21:31 ..
-rw-r--r-- 1 root root 422667 2008-06-18 18:11 abi-2.6.24-19-generic
-rw-r--r-- 1 root root 80049 2008-06-18 18:11 config-2.6.24-19-generic
drwxr-xr-x 2 root root 4096 2009-01-14 21:32 grub
-rw-r--r-- 1 root root 7881072 2009-01-14 21:31 initrd.img-2.6.24-19-generic
-rw-r--r-- 1 root root 103204 2007-09-28 10:06 memtest86+.bin
-rw-r--r-- 1 root root 905146 2008-06-18 18:11 System.map-2.6.24-19-generic
-rw-r--r-- 1 root root 1920472 2008-06-18 18:11 vmlinuz-2.6.24-19-generic
=============================== sdb1/boot/grub: ===============================
total 204
drwxr-xr-x 2 root root 4096 2009-01-14 21:32 .
drwxr-xr-x 3 root root 4096 2009-01-14 21:32 ..
-rw-r--r-- 1 root root 197 2009-01-14 21:32 default
-rw-r--r-- 1 root root 30 2009-01-14 21:32 device.map
-rw-r--r-- 1 root root 8056 2009-01-14 21:32 e2fs_stage1_5
-rw-r--r-- 1 root root 7904 2009-01-14 21:32 fat_stage1_5
-rw-r--r-- 1 root root 16 2009-01-14 21:32 installed-version
-rw-r--r-- 1 root root 8608 2009-01-14 21:32 jfs_stage1_5
-rw-r--r-- 1 root root 4582 2009-01-14 21:32 menu.lst
-rw-r--r-- 1 root root 7324 2009-01-14 21:32 minix_stage1_5
-rw-r--r-- 1 root root 9632 2009-01-14 21:32 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 2009-01-14 21:32 stage1
-rw-r--r-- 1 root root 108356 2009-01-14 21:32 stage2
-rw-r--r-- 1 root root 9276 2009-01-14 21:32 xfs_stage1_5
=============================== StdErr Messages: ===============================
Disk /dev/hdc doesn't contain a valid partition table
I think the best solution to your problem would be to install Grub to your external Ubuntu drive, and then set your BIOS to boot the Ubuntu drive on start up. If that works OK, you could restore a Windows MBR to your sda Windows drive, and then your drives will be independent of each other as far as booting goes; that way you shouldn't get a Grub error 21. So if that sounds good, how about first installing Grub to the MBR (Master Boot Record) of your Ubuntu drive:
And please post the output of the above commands before doing "quit". Note the "makeactive" command is to set the boot flag on your Ubuntu partition, because even though Grub ignores the boot flag and does not need it to boot a partition, some BIOSes will refuse to boot a drive that doesn't have the boot flag set on one of the primary partitions; that's because those particular BIOSes assume the drive is a data drive if no boot flag is set. Next reboot, set your BIOS to boot the Ubuntu drive, and you should get the Grub menu if all goes well. If you get the Grub menu OK, you'll need to slightly modify the Ubuntu entry in order to boot into Ubuntu; so select the first Ubuntu entry in the Grub menu, press "e" to edit it, select the line that says "root (hd1,0)", press "e" to edit it, change it to "root (hd0,0)", press return to save the change, then press "b" to boot. Based on the info you gave, I think that should be all it takes to boot Ubuntu. Note that the change is not permanent, so you'll need to modify your menu.lst to make it permanent.
So if it works, when you get into Ubuntu, just do:
Code:
gksudo gedit /boot/grub/menu.lst
And change the line that says "# groot=(hd1,0)" to use the (hd0,0) that worked to boot Ubuntu. Save, quit gedit, then run:
Code:
sudo update-grub
And you should be all set. Let me know how it goes or if you run into problems.
Yes, but "harddisk" is obviously your Windows drive. Is your external Ubuntu drive SATA or USB? Does your BIOS not give you any other HDDs to choose from to boot? If so, you may not be able to boot your Ubuntu drive from your Windows drive. We will need some more info about which drives your BIOS sees on start up, so how about downloading the Super Grub Disk, boot that, and when you get the first main menu, press "c" to get the Grub command line, and then do:
Code:
grub> geometry (hd0)
That should show your Windows drive, i.e. one partition of type "0x7". Next try:
Code:
grub> geometry (hd1)
And let me know what that returns. If it says drive not found, I don't think there is much hope of getting your Ubuntu drive booting with Grub, because that would mean that Grub does not even see the Ubuntu drive on start up. It might be that using "PLoP" or some other boot manager would work to boot your drive, but that will take some work.
Since Grub can't detect your Ubuntu HDD on start up, that unfortunately means you won't be able to use Grub to boot your Ubuntu drive. There's a good chance you can use the PLoP boot manager to boot your Ubuntu USB drive though, because it comes with its own built in USB drivers; how about downloading the PLoP CD ISO (you'll need to unzip it), burn it to CD, and see if that will boot your Ubuntu drive; you would choose the option to boot the USB drive from the PLoP boot menu. Let me know if that works or not.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.