GRUB error 17

Asked by jatilau

i loaded Ubuntu 8.04 alongwith Win XP in my system which had one of the partition as free space without any file system (etx3/ NTFS). later when i formatted this partition as NTFS, Ubuntu would not boot and displayed GRUB error 17. i booted from the Ubuntu LTS CD and browsing the net i tried several solutions but of no help.

as part of the solution i issued the < sudo fdisk -l > command which produced the following:

ubuntu@ubuntu:~$ sudo fdisk -l
omitting empty partition (5)

Disk /dev/sda: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xcfd6cfd6

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 1912 15358108+ 7 HPFS/NTFS
/dev/sda2 1913 9963 64669657+ f W95 Ext'd (LBA)
/dev/sda5 ? 15490 121434 850995205 72 Unknown
/dev/sda6 4345 7280 23583388+ 7 HPFS/NTFS
/dev/sda7 7281 9963 21551166 7 HPFS/NTFS

Partition table entries are not in disk order
ubuntu@ubuntu:~$

Mounting /dev/sda5 also generated error message "Can't find /dev/sda5 in /etc/fstab and /etc/mtab"

what could be the problem. what is the remedy. i have a lot of data to save from being destroyed.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Solved by:
jatilau
Solved:
Last query:
Last reply:
Revision history for this message
Nikolas Poniros (nponiros) said :
#1

it is possible that after u formated the disk, the disk names changed and grub is trying to mount a disk with an unsupported file system (this is what error 17 means).

in the output of fdisk -l , i dont see any linux file system. are u sure u have formated the right partition?

pls paste here menu.lst (it is in /boot/grub ) from the installed ubuntu not live cd.

was ubuntu on /dev/sda5 ?

Revision history for this message
jatilau (jatilau) said :
#2

________________________ ***** _______________________
Here's part of the menu.lst which i saved after installing Ubuntu:
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=79688ffa-4dd6-4c07-bb6e-c7dbaeb90a03 ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet

title Ubuntu 8.04, kernel 2.6.24-16-generic (recovery mode)
root (hd0,5)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=79688ffa-4dd6-4c07-bb6e-c7dbaeb90a03 ro single
initrd /boot/initrd.img-2.6.24-16-generic

title Ubuntu 8.04, memtest86+
root (hd0,5)
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

______________________ ***** _______________

yes i have formatted the right partion which appears on /dev/dha6 and Ubuntu was installed in /dev/hda5.

Revision history for this message
Nikolas Poniros (nponiros) said :
#3

well grub tries to boot /dev/sda6 (in grub the partitions start from 0 and not from 1)
try changing root (hd0,5) to (hd0,4)

as said before /dev/sda5 doesnt seem to be a linux partition and that would also explain y u could mount it with the mount command.

did u mount with " sudo mount -t ext3 /dev/sda5 /mnt "
(if it is ext3 if not use the right file system and u can change mnt to an other mount point if u want)

Revision history for this message
jatilau (jatilau) said :
#4

with sudo grub i received the following:
grub> root (hd0,4)

grub> setup (hd0)

Error 17: Cannot mount selected partition

grub>

as in the case of mounting, here is the output:

ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/sda5 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sda5,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so

ubuntu@ubuntu:~$

Revision history for this message
jatilau (jatilau) said :
#5

Moreover when i used cfdisk, the following was generated:

     FATAL ERROR: Bad logical partition 5: Partition ends after end-of-disk
                          Press any key to exit cfdisk

I think there is no other way but to re-partition the entire hd and reinstall every thing.

Revision history for this message
udhye! (rudhy-laziale) said :
#6

check the all partition with fdisk -l ..if any NTFS partition then you can the mount point in /etc/fstab, (edit in root) then add the following command :
/dev/hda5 /mnt/windows ntfs ro,defaults,umask=0222 0 0
which hda5 is number of NTFS partition and don't forget to create a folder to mount the partition, in this case i mountedmy partition in /mnt/windows
hope this usefull...

Revision history for this message
Nikolas Poniros (nponiros) said :
#7

ur /dev/sda5 is messed up.. no real file system and the start and end blocks are completely wrong. u can try formating only /dev/sda5 but if cfdisk wont even start that could be hard to do..

if u format the whole disk and recreate the partitions then it should be ok but u might want to check what caused the problem. maybe disk failure is eminent..

Revision history for this message
Wyatt Smith (wyatt-smith) said :
#8

From you fdisk output, it appears that the partition on /dev/sda5 is badly damaged. It is does not know where the it starts or what type of format it is. I would recommend trying to use TestDisk to try to recovery/repair that partition. If that does not work, you will be able to boot back into Windows if you remove grub from the MBR and restore windows bootloader. If this is the case, you will also probably have to reinstall Ubuntu.

*** You can try to recovery your linux Partition ***
Please read some documentation before using
http://www.cgsecurity.org/wiki/TestDisk

You can boot to the LiveCD and use TestDisk. To install please enable the universe repository from System-> Administration-> Software Sources. Then open a terminal from Application-> Accessories-> Terminal and type

sudo apt-get update
sudo apt-get install testdisk

To run TestDisk, maximize the terminal and type

sudo testdisk

*** To remove grub from MBR so you can boot Windows again ***
There are many ways that you can remove grub. Typically you would just boot with Windows Install CD in the drive and select Recovery Console. When you get to the command prompt, enter the command

For XP -> fixmbr
For Vista -> bootrec /FixMbr

If you are having problems using you Windows Disk there are some alternative for restoring you windows MBR. For example you can use

Super Grub boot disk
ms-sys from inside ubuntu
MBRFix.exe from inside windows

This page provides information on alternate methods
http://www.users.bigpond.net.au/hermanzone/p18.htm

Revision history for this message
jatilau (jatilau) said :
#9

Thanks folks for your kind and helpful suggestions. but as i feared the partition of linux got badly damaged which resulted in linux refusing to recognise its own partition. winXP partitions were alright. this matter should be looked into by the linux core developers to make LOS more tolerant to the events going on in its neighbouring partitions and adjust itself to the changes made to the drive just as windows does.

Lessons i learnt:
1. Never to mess around with partitions when there are two OSes (linux and winXP) in your disk.
2. Partition the disk as many as you want and format the drives you want for windows first in NTFS and then install linux in the free space partition.
3. Leave the drive with partitions as they are now and never ever touch or try to change them.

THanks once again.