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!
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
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.
So the last bit is to run
and then reboot with
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).
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.
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???
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’.
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:
and then issuing the Grub update command:
to install the boot loader to the first disc on the computer.
And that is the end of the saga of how I was pwned by a simple grub2 upgrade.
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.