Grub 2 install – error 15

Date: 02 Sep, 2009
Posted by: admin
In: hints & tips|linux, open source & software

Bookmark and Share

Upgrading GRUB in Kubuntu 9.04 (Jaunty) to GRUB2 and one solution to an error 15 boot problem. Additional insight and things to watch for if you’re making the same Grub upgrade.

It must be too long since I moved from Slackware and with 13 out that’s tipped me over the edge to do some “fiddling” (aka computer admin) – silly me!

How to upgrade from Grub to Grub2

I read a tutorial on howtoforge (like that on the Grub wiki) telling me how to update to Grub2, looked easy so I tried .. and it was easy, to a point. Here’s what happened when I followed those instructions, how things differed for me and how I fixed the non-booting system that was the result!

I upgraded to grub2 by initially using

sudo apt-get install grub2

from a command prompt, the config questions were straight forward (as in the links above), then I did

sudo reboot

which brought up the “grub2 chainload” option (presumably courtesy of grub (version 1)) and I chainloaded (but did not inhale!) into the grub2 menu with the expected menu options and my normal default entry at the top. I didn’t get the “unrecognised device string” error mentioned by the howtoforge page.

Contrary to the aforementioned tutorial my boot line didn’t look like theirs and didn’t start with “root” instead it had an absolute path to vmlinuz (IIRC) along with “root=UUID=31b27104-d1c1-4c0e-908e-0aa2e172f890“. I kept the line as was and continued with grub2. Everything loaded perfectly well and I was back in Kubuntu Jaunty’s KDE4 desktop environment and working normally.

Woo hoo?

Finalise Grub2 install

So the last bit is to run

sudo upgrade-from-grub-legacy

and then reboot with

sudo reboot

I didn’t edit my /boot/grub/device.map as the 3 hd appear to be detected correctly and so I didn’t need to run sudo grub-install (at least not yet).

Error 15

And guess what, it wouldn’t boot.

“Error 15” instead of the Grub menu meant my blood pressure rising and me silently cursing my curiousity at wanting to upgrade when Grub 1 was working perfectly well … . From what I can tell this error means grub can’t find some files it needs. So, I don’t get as far as the menu and can’t even get a Grub prompt.

Live CD

I then booted from my 8.04 install/live disc by using the “boot first hard disk” option in the menu (with no other interference). So it seems that it’s just Grub itself that is somehow confused – I wasn’t expecting the “boot first hard disk” option to work, it had me a little baffled.

My groot from the previous Grub install was groot=(hd0,3) as shown in /boot/grub/menu.lst and the current grub.cfg appeared to be set as if the root is (hd0,4). My root partition is /dev/sdb4 (don’t ask!) as I have an old Slack on sda and have Vista on sdc (all complicated by hidden partitions and what have you). A priori this seems to be set wrong, the fourth partition, where my root is, is numbered 3 – though why Grub has to use a different numbering scheme is not really clear to me.

Just as I was writing all of this into a missive for SWLUG I figured that perhaps I need to change my device.map so that (hd0) is /dev/sdb???

Extra info

A couple of little clues that led me to the above idea.

grub-install -v gives me grub-install (GNU GRUB 1.96)

The device.map file as automatically created gave the following result initially.

:~$ sudo grub-install –recheck /dev/sda
[sudo] password for $USERNAME:
Installation finished. No error reported.

This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install’.

(hd0)   /dev/sda
(hd1)   /dev/sdb
(hd2)   /dev/sdc

Altering /boot/grub/device.map

It seems that in order for Grub to find my root partition (sdb4) at what Grub calls (hd0,3) (i.e. first disc, 4th partition) then I needed sdb to be called hd0 by Grub. The fix in the end was quite simple – changing the device map to read:

(hd0)   /dev/sdb
(hd1)   /dev/sda
(hd2)   /dev/sdc

and then issuing the Grub update command:

grub-install /dev/sda

to install the boot loader to the first disc on the computer.

She rides!

And that is the end of the saga of how I was pwned by a simple grub2 upgrade.

Postscript – lost a Thunderbird draft email?

To top off all this fun  – I had saved the initial version of this post as a message to my local LUG, saved it as a draft in Thunderbird as I tried rebooting with the altered device.map file. Well, as that fix worked I thought it wold be best to make this post. But Thunderbird had eaten my draft email – it was there. I found it by grep-ing for “grub” in my ~/.mozilla-thunderbird/$PROFILE folder and then copied the raw email code and tidied it up to make this post.

2 Responses to "Grub 2 install – error 15"

1 | chris

September 11th, 2009 at 6:25 pm

So, am I getting that you went back to a legacy version of GRUB at the end? Sounds like you did (if you re-installed GRUB from a pre-9.10 ubuntu CD)

I had trouble installing GRUB2 as well, but it turned out the only problem was in the changes it made to the menu.lst contents for my legacy version of GRUB in the testing stage.

Once I figured that out, I booted into the GRUB2 image and found it to be working. After that, I ran “sudo upgrade-from-grub-legacy” and had no trouble with the new (GRUB2) bootloader.

The trouble with the pre-2 version menu.lst (after being edited by the GRUB2 installer) was that it was pointing the boot loader to an unrecognized device UUID. This was easily by-passed by pointing the boot loader to the correct partitions using the the drive number method – ie “root (hd0,4)” vs. “root some-uuid-number-here”. I imagine adding “UUID=” in front of that string might work just as well, but given that the GRUB2 installer had made all my menu.lst items unbootable, I’d recommend just going with the drive number method I’ve described.

The editing can be done from the bootloader itself by selecting your boot item and hitting the “e” key (“enter” to save changes, “escape” to return to previous screen). If you don’t already know your partition numbers, you can choose them from a list by typing “root (hd”, then hitting “Tab” at the GRUB command prompt or GRUB editing screen – that would be one press of the “tab” button to choose your disk number, a “,” (comma), then another “tab”press to see your partition numbers.

2 | admin

September 15th, 2009 at 12:45 pm

I’m hoping you skimmed over it and that my writing isn’t really that unclear! – the alterations to the device.map file (switching the logical names of the two partitions) fixed it up for me.

Thanks for your input – most of my experience has been with lilo, autocompletion sounds like a handy feature.


About

Flapjacktastic is just a random collection of musings, hints&tips, notes, information ... a collection of stuff really that's overflowed from the brain of this husband, father, potter, business-man, geek ...

past posts