How To Install GRUB 2 On Ubuntu 9.04

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Sun, 2009-08-30 17:29. :: Ubuntu

How To Install GRUB 2 On Ubuntu 9.04

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 08/26/2009

This tutorial shows how you can upgrade your GRUB bootloader to GRUB 2 on Ubuntu 9.04. GRUB 2 has been rewritten from scratch to clean up everything for modularity and portability.

GRUB 2 targets at the following goals:

  • Scripting support, such as conditionals, loops, variables and functions.
  • Graphical interface.
  • Dynamic loading of modules in order to extend itself at the run time rather than at the build time.
  • Portability for various architectures.
  • Internationalization. This includes support for non-ASCII character code, message catalogs like gettext, fonts, graphics console, and so on.
  • Real memory management, to make GNU GRUB more extensible.
  • Modular, hierarchical, object-oriented framework for file systems, files, devices, drives, terminals, commands, partition tables and OS loaders.
  • Cross-platform installation which allows for installing GRUB from a different architecture.
  • Rescue mode saves unbootable cases. Stage 1.5 was eliminated.
  • Fix design mistakes in GRUB Legacy, which could not be solved for backward-compatibility, such as the way of numbering partitions.

I do not issue any guarantee that this will work for you!

 

Upgrading To GRUB 2

Open a terminal (Applications > Accessories > Terminal)...

... and start the upgrade as follows:

sudo aptitude install grub-pc

You will see the following questions:

Chainload from menu.lst? <-- Yes
Linux command line: <-- ENTER

Afterwards reboot the system:

sudo reboot

At the beginning of the boot process, you will most likely see this error - press a key to continue:

Select Chainload into GRUB 2 and press e:

Select the root entry and press e:

Now replace the string root...

... with the string uuid and press ENTER:

Select the uuid entry and press b to boot:

This is how your GRUB 2 boot menu should look now, and your Ubuntu system should now boot without problems:

Back on your Ubuntu desktop, open a terminal again and finish the GRUB upgrade as follows:

sudo upgrade-from-grub-legacy

Output should be as follows:

falko@falko-desktop:~$ sudo upgrade-from-grub-legacy
[sudo] password for falko:

Installing GRUB to Master Boot Record of your first hard drive ...

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

GRUB Legacy has been removed, but its configuration files have been preserved,
since this script cannot determine if they contain valuable information.  If
you would like to remove the configuration files as well, use the following
command:

  rm -f /boot/grub/menu.lst*

falko@falko-desktop:~$

You can now reboot...

sudo reboot

... and the system should restart without problems. If you still have problems booting, take a look at the troubleshooting section here: https://wiki.ubuntu.com/Grub2#Errors

 

Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by wildevil (not registered) on Mon, 2010-03-01 13:24.
some people in here that's complicated this way , i found easy and good , will maybe for new windows and microsft world comers will found that complicated , because they are used to found everything ready and easy just some clicks and it's done , that's the bad side of windows , don't give chance to count on yur self and found out things , just next + next + finish and some like that i'm a newbie on ubuntu i was using windows xp for years but i like linux world because all the time you find out things and yu need all the time to work hard to stuff , and that good because i want to learn this good and free world .
Submitted by David Tangye (not registered) on Mon, 2009-12-07 14:27.

This is too complicated.

A better way is:

  1. In synaptic or using apt-get or aptitude, install package grub2. Accept the message to chainload from menu.lst
  2. Reboot and check that the system starts OK
  3. Optional, recommended: "sudo upgrade-from-grub-legacy", as advised in step 1
  4. Optional, if you have extra OSes: Convert any menu items from menu.lst for other OSes to entries in /etc/grub.d/40_custom as per https://help.ubuntu.com/community/Grub2. Run command "sudo update-grub". Reboot and check that the extra menu items appear. Remove /boot/grub/menu.lst* as also advised in step 1.


Submitted by safwan erooth (not registered) on Tue, 2010-03-30 05:27.
even after installing for synaptic i got the error, "unrecognized device string", it got corrected after following the steps in this article(changing root to uuid)... now everything is fine for me...  i removed legacy grub!
Submitted by Rasputin Paskudniak (not registered) on Tue, 2010-02-09 07:44.

David,

I prefer your suggestion, of course. The simpler the better. However, I would still be chicken and must be prepared to follow the long instructions as well. BTW, I find the replacement step - root --> uuid - to be extremely error-prone. It is very easy to mistype a digit out of all that an totally mess yourself up.

Since my primary OS has been Windows-XP and I only boot  Ubuntu about 20% of my time, I really would like to see these instructions showing the Windows menu item so I really have an example to follow.  Otherwise, I may stay stuck with legacy grub forever out of fear of being unable to boot Windows.

Submitted by (illegible) (not registered) on Fri, 2009-11-20 20:22.

Perhaps this is obvious (though NONE of this is obvious to me - I'm lost after Extended BASIC), but this shiny new grub eradicated the pesky grub 1.5 Error 18 problem which had been keeping my newfound love of Ubuntu from flowering.

Thanks!

Submitted by Hein van Dam (not registered) on Thu, 2009-10-22 07:20.

I found this article searching for the Error 11 problem and got the first useful answer here. It still didn't seem to work for me until I realized that updating by Ubuntu always gets my partitions wrong (e.g. (hd1,0) instead of (hd0,0) etc.) and this tradition seems to be continued. I just mention this in case others have similar problems: fiddle with partitions.

 

Submitted by Langleyo (not registered) on Tue, 2009-10-20 10:40.

Great walkthrough, I had no problem doing this in VMware with my Jaunty Virtual Machine upgrade. Only mistake I made was rebooting before making changes (sudo upgrade-from-grub-legacy) permanent.

Thanks, Falko and Howtoforge.com! One day I hope to be able to contribute something useful here myself!


 

 


Submitted by John T. (not registered) on Tue, 2009-09-22 00:25.
worked great thanks
Submitted by fonzy (not registered) on Tue, 2009-09-08 07:31.

I didn't even get an error 11, just welcome to Gub ! ,

actually still running 8.04, so... the install maybe a little different;

i did~$ sudo grub-install "(hd0)" && update-grub

to write grub2 to MBR, after install

-- (it didn't recognize the command: upgrade-from-grub-legacy)

and then the system said run: /usr/sbin/update-grub as root

then did a rm -f /boot/grub/menu.lst*

and all work-ed perfectly xD

Submitted by octav hendra (not registered) on Mon, 2009-09-07 13:20.
it`s work in my computer and no problem found, thanks
Submitted by Another Anonymous (not registered) on Sat, 2009-09-05 00:40.
Thanks Falko, this worked perfectly for me -- and your graphical follow-up! (Ubuntu 9.04)
Submitted by seo wales (not registered) on Fri, 2009-09-04 21:51.
I followed your howto and ended up with an "error 15" and a non-booting system that wouldn't even get me to a grub command prompt - but I learnt stuff so it's not all bad. TBH I expected it wouldn't go smoothly, boot loaders are always a bit edgy to play with - anyway here's my review of grub 2 on kubuntu, error 15 and my solution of it.
Submitted by Anonymous (not registered) on Tue, 2009-09-01 19:58.

Apparently one must edit a file in /etc/ and then run a command to modify grub2's behavior.

The nightmare that was lilo is reborn as grub2!!!

Submitted by Anonymous (not registered) on Tue, 2009-09-01 17:28.

EXACTLY following your instructions, I loaded Grub2...

 I rebooted, and low and behold, the chain load page did not come up!!

 The page that came up, started with 'when you verified...' which I could not do, since the 'chain load...' had not come up...

 Several attempts to get around this page (which was only one that initially came up) failed. I found following instructions from that point, useless, since there were no readily available 'grub programming instructions' which might have worked, if they had any hints to wtf they were talking about...

 I must assume, you are a typical linux instruction writer. That means you understand what you are doing, to the point, you keep all the important little bits, that you know 'everyone knows, since you do' and don't put them into the instructions. 

 I did, finally, get the thing to work. I now have both grub and grub 2 running in the boot box. I had to install an older version of my OS and get the grub working from there (I have multi partitions)...

 Pulleeeeze learn that writing instructions that work, depends on your ability NOT to forget the little bits you ass-u-me everyone knows. If linux commenters and instruction writers would finally learn that one thing...

 Linux might become the big OS much sooner...

Until then, it has a big problem.

 NOTE: I didn't say which distro I am running... I didn't specify 32 or 64 bit...

I didn't specify which processor... Why should I? YOU DIDN'T

And you didn't allow that there might be differences accordingly. (Which, blind fool that I can be, I didn't take into account... But, I know how problems can be fixed... Which you didn't set up for... before the instructions.

Submitted by David Freehug (not registered) on Wed, 2009-09-02 12:46.

Um. Why didn't you publish any information about what your problem was and how you fixed it ? It's all very well moaning about how Linux writers don't write helpful instructions but Linux is a *collaborative* effort. If you spent less time whinging that you find life a bit tricky and actually put the useful things you'd discovered here then perhaps someone else won't have to go through the same frustrations you did...

 

Submitted by ferry (not registered) on Fri, 2009-09-04 08:00.

It was a shock to get into the familiar bootmenu coupled with this chainload thing.. because I did not study all instructions before.

I really did not know what to do anymore but fortunately another computer with internet access was at hand so I could read the instructions again :-)

Everything is ok now. Thanks!

 (But eh.. the what-if-things-go-wrong' section in the instruction is a bit small.)

 

Submitted by luigibianca (registered user) on Wed, 2009-10-21 20:33.

my 2  cents about this:

1)  HowtoForge howtos (and peoples) are extremely serious and reliables :-)

2) If You want to work with computers you must have at least 2 computers :-)

if you cannot or You are not interested in became professional is good thing make a written copy of the howto :-) before to start

hth,

Luigi

Submitted by admin (registered user) on Wed, 2009-09-02 09:51.
The instructions are working for me - otherwise I wouldn't have published them. And for this tutorial it doesn't matter if you are on an i386 or an x86_64 system.
Submitted by Anonymous (not registered) on Mon, 2009-10-26 22:51.

Worked perfectly for me.  The instructions seemed very thorough.