Working With The GRUB Menu

Want to support HowtoForge? Become a subscriber!
 
Submitted by Cargoship (Contact Author) (Forums) on Fri, 2007-07-27 18:48. :: Linux | Ubuntu

Working With The GRUB Menu

This tutorial describes how to edit the GRUB menu. It will also show how to add operating systems and how to add splash screens.

What everything means

To start off I will go over why you would use GRUB and what it all means.

The reason anyone would use the GRUB menu is to dual-boot two different operating systems. All it is is a simple DOS menu that you select which operating system you want to load during boot-up.

To open it type -

gksudo gedit /boot/grub/menu.lst

This will open up the menu.lst (the file in which you edit the GRUB Menu) in a simple text editor while giving you the ability to make changes and save them.

You will see a bunch of lines at first that all begin with "#". That tells the file to skip over these lines when reading the file. Scroll down into you stop seeing them.

Title - This is what is shown when the menu loads at boot up. Editing this will only change what is written on the screen.

Root - You likely have something along these lines "(hd0,1)". "hd0" refers to the your hard drive while 1 points to the partition. Note that for GRUB, partitions start at 0 and not 1. for example 0=Partition 1, 1=Partition 2 and so on.

Kernel -Pretty self-explanatory. This just is to ask what kernel version you would like to boot with.

Initrd - This is simple a temporary file system used by the kernel during a boot till the real file system can be mounted.

That is the basics of what all those lines mean.

Adding an OS

Adding an operating system to your grub menu is by no means difficult. Just fill in a few lines and you are done!

1. Open up Terminal (Applications>Accessories>Terminal) and run -

gksudo gedit /boot/grub/menu.lst

Once menu.lst opens up, scroll down to the button of the page. For this example I will be adding "Windows XP".

First add the title, which should look like what is shown bellow -

title        Microsoft Windows XP

Now to add the root for the OS. For me it is on the 1st disk and the third partition so I will put the following -

root        (hd0,2)

To finish it off add the following lines -

makeactive
chainloader    +1

Definitions -

The final product should look something like this (with your options of course) -

title        Microsoft Windows XP
root        (hd0,2)
makeactive
chainloader    +1

Save and reboot to make sure it worked correctly

Installing a Splash Screen

As you have probably noticed, the default look of GRUB is nothing too exciting. But fear not, you can install splash screens to spice it up a bit!

To start off find a image that pleases you (9 beautiful screens). Make sure it meets the requirements though -

  • .xpm file
  • 640x480
  • 14 colors only

1. Download an image and add it to a directory.

2. Open up your GRUB file again -

gksudo gedit /boot/grub/menu.lst

3. To keep it organized, add the following line under "Pretty colours" -

splashimage=(hd0,1)your/directory/splashimage.xpm

Remember to change the above line accordingly and reboot to test.


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 anlogtek (not registered) on Mon, 2013-12-16 03:47.

This tutor is for grub 1.Not current for grub 2 the current one in use by the majority.

Submitted by Anonymous (not registered) on Thu, 2009-05-28 23:51.

This needs lots of cleanup.  E.g.:

Scroll down into you stop seeing them.    ? ? 

That tells the file to skip over these lines  ? ?   file reading itself ?  ?

Anyway - I wanted dto know where this thing is stored, how the boot up finds this, and how to use it in win.

This tells me the obvious, but nothing more.

Submitted by Joe (not registered) on Sun, 2009-06-21 08:15.

If you actually were following what it said, the article would make much more sense, im totally new at this, but somehow (thanks to this great article) now understand grub.

 

Ubuntu 8.04 Jaunty

Submitted by leric (registered user) on Fri, 2007-08-24 15:37.
Grub has as far as I know nothing to do with DOS. Why not just call it a "text menu"?
Submitted by ales_t (not registered) on Fri, 2008-11-14 11:14.

Exactly, this has absolutely nothing to do with DOS and it's a complete nonsense to call it that way.

Thanks for the article though, helped me because I couldn't remember the name of the menu file

Submitted by Ivor (not registered) on Mon, 2008-10-06 14:54.
most people in the know use the term DOS to refer to any command line OS (where the specific OS is not germain to the point being made)  not just MS-DOS. We knew what he meant.
Submitted by Anonymous (not registered) on Wed, 2009-09-09 13:05.
The term DOS menu used here is for a non graphical menu i.e it looks a lot like the menus seen in the old days before GUIs.
Submitted by stychokiller (registered user) on Thu, 2007-08-02 09:45.
What I could really use however is some sort of tutorial on how to migrate an existing installation from LILO to GRUB (safely!).  Until I find such a thing, I'll stick with LILO.
Submitted by hottbuttaz (registered user) on Wed, 2007-08-01 18:54.

This howto describes the path to the grub configuration file as:

"/boot/grub/menu.lst"

 In other distros (CentOS 5 in my case) the filename may be different:

"/boot/grub/grub.conf" 

Submitted by theumang (registered user) on Fri, 2008-05-30 13:08.

The way you have Explained it is Clear and Simple!

Great work Cargoship..