# Solved: GRUB Error 17 after installing Ubuntu Linux



## almightybob7

Hello,

I recently decided to install Ubuntu Linux onto my computer, to dual-boot with Windows XP. I had my Windows XP on one partition, and had another partition of extra space. I did the installation and and the guided partiton maker, and made the Ubuntu partition about 60 GB. I'm pretty sure that I formatted it as an ext3 partition, but I can't remember exactly. Now when I try to boot up my computer, I get an error message that says
"GRUB stage 1.5

Grub Error 17"

Now I know that GRUB Error 17 has to do with the filesystems, but I don't know how to fix this problem. 

Thank you!
Nate


----------



## jwbirdsong

You may have to boot from a live CD to get these but can you post your menu.lst:


Code:


gedit /boot/grub/menu.lst

and



Code:


sudo fdisk -l

the -l is a small "L"
from the Ubuntu install

The Ubuntu isn't on a USB drive by any chance is it?

See also http://www.gnu.org/software/grub/manual/grub.html#Troubleshooting


----------



## almightybob7

no it's not on a USB drive, it's a live CD install.

thanks.


----------



## almightybob7

here is my menu.lst file:


> # 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 change this entry to 'saved' 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=65619789-a4bf-4d31-9957-6b3d4cdb5c6f ro
> 
> ## Setup crashdump menu entries
> ## e.g. crashdump=1
> # crashdump=0
> 
> ## default grub root device
> ## e.g. groot=(hd0,0)
> # groot=(hd0,3)
> 
> ## 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
> 
> ## ## End Default Options ##
> 
> title Ubuntu, kernel 2.6.20-15-generic
> root (hd0,3)
> kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=65619789-a4bf-4d31-9957-6b3d4cdb5c6f ro quiet splash
> initrd /boot/initrd.img-2.6.20-15-generic
> quiet
> savedefault
> 
> title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
> root (hd0,3)
> kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=65619789-a4bf-4d31-9957-6b3d4cdb5c6f ro single
> initrd /boot/initrd.img-2.6.20-15-generic
> 
> title Ubuntu, memtest86+
> root (hd0,3)
> 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/sda1
> title Microsoft Windows XP Professional
> root (hd0,0)
> savedefault
> makeactive
> chainloader	+1


and here's the disk information from fdisk:


> Disk /dev/sda: 203.9 GB, 203928109056 bytes
> 255 heads, 63 sectors/track, 24792 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
> Device Boot Start End Blocks Id System
> /dev/sda1 1 8924 71681998+ 7 HPFS/NTFS
> /dev/sda2 8925 16805 63304132+ f W95 Ext'd (LBA)
> /dev/sda3 24788 24792 40131 83 Linux
> Partition 3 does not end on cylinder boundary.
> /dev/sda4 * 16806 24787 64115415 83 Linux
> /dev/sda5 8925 16712 62557078+ 7 HPFS/NTFS
> /dev/sda6 16713 16805 746991 82 Linux swap / Solaris
> 
> Partition table entries are not in disk order
> 
> Disk /dev/sdb: 80.0 GB, 80026361856 bytes
> 255 heads, 63 sectors/track, 9729 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
> Device Boot Start End Blocks Id System
> /dev/sdb1 * 1 9729 78148161 7 HPFS/NTFS


----------



## saikee

There is a possibility that the pen drive was added after the Linux installation and the Bios was instructed to boot the USB device first.

In that case the sdb may robs the 1st disk (hd0) status from internal hard disk sda. Grub therefore could not find 4th partition of the 1st disk or (hd0,3) and so it issued

17 : Cannot mount selected partition

If the above case is true then removing the pen drive during booting will solve the problem. Plugging the pen drive in after booting will allow the pen drive to be used in both systems.


----------



## almightybob7

Thank you, but I don't have a pen drive. sdb would be my second (slave) hard drive. I'm using a live CD install.


----------



## saikee

Oops! Yep sdb has 80Gb so it cannot be a pen drive.

OK if that is the case then try investigate it mannually.

Instead of selecting Ubuntu to boot try Windows instead and confirm the size of its drive C and D etrc.

If your boot up Windows "C" is about 80Gb and the "D" is smaller then your slave drive has been nominated as the first bootable disk in the Bios because in Grub menu.lst it is being booted as (hd0,0), meaning the first partition of the first hard disk.

You have 3 NTFS partitions of size 80, 73 and 65Gb approximately. Only the largest one sdb1 has been marked bootable and so Windows has to come from there. Sda1 isn't bootable and sda5 is a logical partition. If WIndows firs up then sdb has to be (hd0) and sda is relegated to (hd1).

If Windows boots while Linux doesn't then you are interfering with the boot loader by changing the boot disk order all the time.

The other confirmation you could give to the thread is when you see the boot screen press "c" key immediately to drop into a Grub prompt. In the Grub prompt ask Grub to display the boot disk oder by


Code:


geometry (hd0)
geometry (hd1)

According to Ubunuto installed information it would boot if (hd0) has 6 partitions while (hd1) has one. If this isn't the case I recommend you to chop off the hand the fiddles with the bios setting. You can leave Grub prompt to go back the original screen by


Code:


root (hd0)
chainloader +1

Report even if you are left with only one hand.


----------



## jwbirdsong

> Report even if you are left with only one hand.


LOL...

Not sure why these replies were going to my junk folder. Glad I noticed them finally


----------



## almightybob7

lol, but I tried pressing c when I got to where grub should start, but nothing happened. I just got the same old error message.


----------



## saikee

OK

Since you have Ubuntu Live CD you can boot it up, click terminal and activate a Grub shell by command


Code:


sudo grub

You can then use the suggested geometry statements to find out how Grub views the disk order.

Also in the /boot/grub directory of your installed Ubuntu there is a file called device.map which record the disk order at the time of the installation.


----------



## almightybob7

It looks like the boot order is fine, because hd0 has six partitions, and hd1 has one.



> grub> geometry (hd0)
> drive 0x80: C/H/S = 24792/255/63, The number of sectors = 398297088, /dev/sda
> Partition num: 0, Filesystem type unknown, partition type 0x7
> Partition num: 2, Filesystem type is ext2fs, partition type 0x83
> Partition num: 3, Filesystem type is ext2fs, partition type 0x83
> Partition num: 4, Filesystem type unknown, partition type 0x7
> Partition num: 5, Filesystem type unknown, partition type 0x82
> 
> grub> geometry (hd1)
> drive 0x81: C/H/S = 9729/255/63, The number of sectors = 156301488, /dev/sdb
> Partition num: 0, Filesystem type unknown, partition type 0x7


all the filesystems that it labels as unknown are NTFS, so perhaps that could be the problem?


----------



## jwbirdsong

Since you are trying to boot (hd0,3) aka /dev/sda4 What is on (hd0,2)aka /dev/sda3? I'm asking because I know some people like to partition their setup so */home* and root ie. */* are on seperate partitions. In that case the menu.lst needs to point at the root partition.

I DON'T believe that to be the case here or it would probably give a completly different error; but not positive.
Just checking out all possibilities


----------



## almightybob7

I'm actually thinking that the linux installation is on hd(0,4), because that's what it looks like in gparted. I'll try to get a picture of gparted up in a second. 

if this is the case, how would that be fixed?


----------



## almightybob7

This is what gparted looks like, I think the linux installation might be on sda5, because when I installed ubuntu I remember I made a partition that was 59 GB, and that's the one that I installed ubuntu on.


----------



## saikee

Grub confirms the sda is (hd0) and the partitions are similar to that reported by fdisk -l except no boundary error reported as Grub does not care or able to diagnose the fault.

The ntfs partitions are foreign to Grub and treated as unknown. All that means Grub cannot read its content but there is no need for Grub to do such thing. Grub always boots a Windows by chainloading and there is no kernel needed to be read. Thus it is absolutely fine to have ntfs partitions reported as unknown.

99% of the booting problem is due to the owner having no idea where are his/her partitions. The information from Post #4 and #11 is the definitive answer in it it can be established that there are only two partitions (hd0,2) and (hd0,3) type 83 which can hold a Linux. The equivalent partition references in Linux are sda3 and sda4.

The OP assertion of (hd0,4) cannot be supported because it would be sda5 which is a ntfs partition of Type 7.

I believe I have answered this same question in JustLinux forum and so will not repeat here.

There is enough evidence to support the partitioning scheme is faulty as fdisk has reported


Code:


Device Boot Start End Blocks Id System
/dev/sda1 1 8924 71681998+ 7 HPFS/NTFS
/dev/sda2 8925 16805 63304132+ f W95 Ext'd (LBA)
/dev/sda3 24788 24792 40131 83 Linux
[color=red]Partition 3 does not end on cylinder boundary.[/color]
/dev/sda4 * 16806 24787 64115415 83 Linux
/dev/sda5 8925 16712 62557078+ 7 HPFS/NTFS
/dev/sda6 16713 16805 746991 82 Linux swap / Solaris

To remove the above fault I have recommended the distro to be re-installed.

It is my personally held belief a Linux user can do better by using the "cfdisk" or "fdisk" terminal programs to partition a hard disk because graphic tools like Gparted mixes partitioning with formatting. A better understanding how partitioning works can be achieved by using cfdisk program IMO. In fact I learn all my partitioning skill from cfdisk! fdisk is also the most robust partitioning tools and is the last one that can be used when all other partitioning tools have packed in. fdisk is available in every Linux, cfdisk in about 75% with the remaining 25% belong to the Red Hat family that uses sfdisk in place of cfdisk.

The partitioning boundary error is typically created by using more than one partitioning tool, especially with one not based on Linux.

I notice Gparted reports sda5 has a Ext3 filing system but its partition type is Type 7 for ntfs fling system according to fdisk. This is likely caused by the OP creating the partition with Type 7, possibly used it for a MS system but formatting the partition later in Ext3, rending the content impossible to read. An OS depends on the partition number to use the correct driver to read its internal content.

The partition type number can be changed easily by cfdisk or fdisk but I don't think it would work because the menu.lst information suggests the root of the Linux is in (hd0,3) and not (hd0,4)!

If the OP does not know his/her hard disk setup what chance do we have?


----------



## almightybob7

yes, thank you saikee. you also helped me out on the justlinux.com forums.

if anybody wants to see how this was solved, visit http://justlinux.com/forum/showpost.php?p=869980&postcount=6

thanks everybody else as well!


----------

