A good solution for grub error 17.

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

A good solution for grub error 17.

Postby nick6196 on Mon Mar 09, 2009 6:33 pm

I have had a nightmare trying to set up dual booting between Win XP and Linux Mint. One of my early attempts to overwrite the MBR on Windows totally wrecked my Windows partition and made it unreadable and unrecoverable from the Recovery Console so much of my time was spent reinstalling Windows (which, incidentally, is a lot more work than installing any Linux distro on the planet). I had many attempts at installing Mint and I have seen a fair few grub errors now. My problems were based on the fact that I was trying to put Windows and Linux on different disk drives and, presumably because two of the drives were on a RAID card, the order that the BIOS saw the drives in was different than the order that Linux Mint saw the drives (gparted was different again-very confusing).

I ended up buying System Commander 9 thinking that it would make the process easier but actually this didn't help at all. The boot manager still requires you to fix whatever grub errors you have before it will work and the partitioning tool it contains is not as good as gparted anyway. I was less than impressed with that.

What did help me enormously was the post below from mbwardle over on the Ubuntu forums regarding grub error 17. I carried out all of these steps and it fixed the booting problem with Linux Mint. In my case the 'setup (hd0)' step failed, returning 'error 17: Cannot mount selected partition' but I think that might have been because I still have System Commander installed but it didn't matter because it boots perfectly now anyway.

I don't think I'll be playing with the boot sector again for a while but I am very happy to finally have Linux Mint up and running!

mbwardle's post:

a better solution
I got this error after installing the Ubuntu 7.10 release candidate.

The error usually happens because Linux and your BIOS detect your hard disks in different orders. GRUB tries to translate between the two using the device.map file in /boot/grub/device.map, which is automatically generated. Chances are, it guessed wrong.

In my case, I have three SATA hard disks.

My BIOS sees them as:
HDD1 - 80 GB - Windows
HDD2 - 80 GB - Linux
HDD3 - 250 GB - Media

Linux sees them as:
/dev/sda - 80 GB - Windows
/dev/sdb - 250 GB - Media
/dev/sdc - 80 GB - Linux

So it generated device.map assuming that order was correct, i.e.:
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc

When the installer installed GRUB using that data, it tried to install the first part of GRUB on /dev/sda and told it to look for the OS on /dev/sdc. Unfortunately, this translated to "install on (hd0) then look for the OS on (hd2)", so it was looking for the OS on the wrong drive.

To fix it, you have to teach GRUB which order the BIOS uses. To do this, follow these steps:

1) Boot from the Ubuntu CD
2) Open a Terminal (Applications->Accessories->Terminal)
3) Run "sudo -s"
4) Run "mkdir /ubuntu"
5) Run "mount /dev/sdc1 /ubuntu" (where /dev/sdc1 is your Linux root partition)
6) Run "chroot /ubuntu"
7) Run "cd /boot/grub"
Edit device.map (using vi or another text editor)

In my case, my new device.map was:
(hd0) /dev/sda
(hd1) /dev/sdc
(hd2) /dev/sdb

which told GRUB that sdc was really the second hard drive, not the third.

9) Run "grub --device-map=device.map"
10) Type "root (hd1,0)" (where hd1,0 is your Linux boot or root partition using the BIOS order)
11) Type "setup (hd0)" (where hd0 is your first boot drive, almost always hd0)

You should see a message that it's now telling GRUB to load 17+(hd1,0) instead of 17+(hd2,0) or something like that. This is what we want.

12) Edit menu.lst

You need to change references from (hd2,0) to (hd1,0), or whatever your Linux boot drive was autodetected as to whatever it is according to your BIOS.

If you get this step wrong, you'll see an error message something like:
Error 17: Cannot mount selected partition

meaning it's looking for a Linux file system on that partition, but it can't find one (because the drive device number is wrong in menu.lst).

13) Reboot

14) Celebrate or complain in this thread!
nick6196
Level 1
Level 1
 
Posts: 6
Joined: Wed Mar 04, 2009 5:37 pm
Location: Bucks, UK

Linux Mint is funded by ads and donations.
 

Re: A good solution for grub error 17.

Postby Husse on Tue Mar 10, 2009 8:47 am

I think another solution is described here - and it's Mint specific, rather gfxbrub specific
http://www.linuxmint.com/wiki/index.php ... annot_boot
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: A good solution for grub error 17.

Postby nick6196 on Tue Mar 10, 2009 3:27 pm

Ahhh! I missed this solution because it says at the top of the page:

'If you only have IDE disks or only have SATA disks this is probably not for you'

and since all my disks are IDE drives I stopped reading at that point. Maybe that line should be taken out because this problem can occur with systems running all IDE drives as well.
nick6196
Level 1
Level 1
 
Posts: 6
Joined: Wed Mar 04, 2009 5:37 pm
Location: Bucks, UK

Re: A good solution for grub error 17.

Postby Fred on Tue Mar 10, 2009 3:33 pm

nick6196,

Actually, there are several different problems that can cause the error 17 failure. There isn't a one size fits all fix. What it takes to fix the error 17 failure depends on what is causing it. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: A good solution for grub error 17.

Postby nick6196 on Tue Mar 10, 2009 3:49 pm

I'm sure that's true Fred,

Maybe I was just lucky to come across a workable solution for my own situation then. I'm glad to have the thorny installation issue out of the way, I can enjoy using Linux Mint now and it's a very smart looking OS. I was getting a little tired of the brown themes of Ubuntu Fiesty, Gutsy, and Hardy that I was using before. I was having some issues with Compiz in Hardy which I could only solve by turning Compiz off. It's probably good to have a clean install every now and then rather than repeatedly upgrading I guess.

Nick
nick6196
Level 1
Level 1
 
Posts: 6
Joined: Wed Mar 04, 2009 5:37 pm
Location: Bucks, UK

Re: A good solution for grub error 17.

Postby Fred on Tue Mar 10, 2009 3:54 pm

nick6196,

I am glad you got your problem worked out. Bye-the-way, welcome to Mint. :-)

I think you will find there are quite a few very nice people here that will be happy to try to help you if you have problems.

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA


Return to Installation & Boot

Who is online

Users browsing this forum: No registered users and 34 guests