Legacy GRUB Page
(GNU-GRUB 'Legacy' - meaning versions 0.97 and earlier)
Edited Saturday, December 26 2009 Document made with KompoZer

This web page is about  GNU GRUB 'Legacy', and in particular how it can be used in Ubuntu Linux.
GNU GRUB 'Legacy' is the 'old GRUB' ,  used in versions of Ubuntu earlier than 9.10 Karmic Koala.
Information in this web page mainly applies to Ubuntu Hardy Heron, Intrepid Ibex and Jaunty Jackalope users.

Users of Ubuntu 9.10 'Karmic Koala' and later will be booting with the 'new' GNU GRUB, popularly called  'GRUB 2',  (actually GRUB 1.97).  The 'new' GRUB is quite a lot different from the 'old' GRUB. Ubuntu Karmic Koala users should got to this website's GRUB2 pages, GRUB2 Pages.

This web-page is part of a larger site giving examples of how to install Windows+Ubuntu Linux operating systems 'dual boot' in a computer.  Illustrated Dual Boot HomePage



 Ubuntu 8.10 kernel 2.6.27-7-generic                   
 Ubuntu 8.10 kernel 2.6.27-7-generic (recovery mode)
 Ubuntu 8.10 memtest86+
 Other operating systems:
 Microsoft Windows XP Home Edition





Use the up and down keys to select which entry is highlighted
Press enter to boot the selected OS, or 'e' to edit the
commands before booting, or 'c' for a command-line.

The highlighted entry will be booted in 10 seconds.
This is GRUB's main menu which we normally expect to see each time we boot our dual boot computers. It doesn't appear in computers with only one operating system because in that case it's not really needed.

The grub menu is very simple to use, even for beginners.
All that is necessary for most people to do is press your 'Enter' key.
If you don't press 'Enter', your favorite operating system will boot anyway after a number of seconds.
If you want more time you can press any key to stop the count-down timer while you think it over and make a decision.
When you're ready, just use your up or down arrow keys to highlight the line representing the operating system you want to boot and then press your 'Enter' key to boot your selected operating system.

Most of the time those are the only things you need to know to be able to boot with GRUB.
 
However, GRUB, (GRand Unified Bootloader), is much more than just an ordinary boot loader.  
If you ever want to do something special, or if you have trouble booting,  there are a lot of options available in GRUB to help you,

1) GRUB can load a wide variety of operating systems directly by loading their kernels into the computer's memory.

2) GRUB can load 'proprietary' operating systems (unsupported operating systems like Windows) by a process called 'chainloading'.

3) When GRUB is installed, it can detect all operating systems in your computer and correctly configure itself automatically (almost) every time.
Occasionally it needs a small correction to an operating system's entry in the menu.lst file, but not very often. Other boot loaders need to be set up manually every time.

4) The GRUB Menu is completely customizable to suit different computers and individual preferences. The GRUB menu and much of GRUB's behavior is controlled by our /boot/grub/menu.lst (menu list) text files. I'll show you how to find that and some of the things you can do with it further down this page.

PAGE INDEX

Orientation. - a guided tour of some of the most important files needed for booting Linux.

GRUB's Main Menu. - the GRUB menu that you normally see at boot time.

GRUB's Command Line Interface. - GRUB can function as a miniature operating system.

Temporarily Edit the GRUB Menu. - how to edit your GRUB  menu commands 'on the fly'.

Using the GNU/GRUB shell. -  GRUB as a program when the operating system is running.

memtest86+. -it isn't really part of GRUB but it's accessed from the GRUB menu and I like it.


Customizing Your GRUB Menu. - Edit your /boot/grub/menu.lst file, personalize your GRUB.


How to make a dedicated GRUB partition.-  contains only GRUB, no other files  are required.

How to make a separate /boot partition.-contains the Linux kernel, initrd.img and GRUB files.

How to add GRUB to your USB thumb drive. - GRUB in a USB stick  makes a great pet.

How to make your own personalized GRUB Floppy Disk. - you can  play with it and have fun.

How to make your own personalized GRUB CD-RW. - portable - boots in almost any computer.


Re-install GRUB with a GRUB shell. - re-install GRUB from anywhere to anywhere with anything.

Re-install GRUB....................................with the Alternate CD in Rescue mode.

How to back up and restore your MBR. - with a dd command from a live CD.

   Trouble Shooting Section:   Common Booting Errors and Some Possible Cures 


LINKS
The Linux Boot Process - a summary of what is supposed to happen before the login prompt

Here's the link to GNU GRUB's homepage
 
Here's a link to the GNU/GRUB manual, it has lots of good information in it you can refer to.
Also, here is GNU GRUB FAQ

Here are some more links to some other great websites about GNU/GRUB,
GNU GRUB Wikipedia,
Grub Grotto by Steve Litt,
GRUB tips and tricks by Jeremy Turner,
Boot with GRUB by Wayne Marshall, Linux Journal.


Orientation 
Here's where to find some important files to do with booting.
I'm assuming you have Ubuntu or a similar Linux operating system up and running and you're just sitting there staring at your desktop.

To start this tour, you go 'Places'-->'Home Folder', and then look for the 'Up' arrow two times to go up two levels in the file system, to the top of our directory tree.
This what we call the 'root' of our file system.
It's the big main directory (folder) that contains all the rest of them.
Very often the forward slash:  /  , is used for short, to indicate the root file system, instead of typing out the word 'root' every time.
Besides, there's also a directory there called: /root , and we don't want to confuse anybody.
                                   
fig4grub   
fig 4 GRUB
In the top row of folders there's the /boot directory, we'll look inside that in a minute.

While we're here, notice the two files in the bottom row?
Those are 'symlinks', (shortcuts), to the Linux kernel and initrd.img files.  Sometimes we use those for booting with when we don't know the exact name and location of the kernel and initrd.img. 

 

When, you open the /boot directory it should look something like the illustration below.

fig5grub
fig 5 GRUB
The files called vmlinuz-2.6.12-9-386 and initrd.img-2.6.12-9-386 are the Linux kernel and the matching initrd.img that belongs with it.

The Linux kernel is the nucleus of  the operating system.
GRUB needs to be able to load this kernel into the computer's memory to boot the system.
Read more about the Linux kernel:  The Linux Kernel (tldp.org, David A Rusling).

The initrd.img helps the kernel get started, it's something like a road map of the file system or maybe more like a miniature model of it that the kernel loads until it is able to load the real file system. Read more: initrd (Wikipedia).
The initrd and the kernel are a matched pair, we always have an initrd with the same numbers after it's name as the kernel it belongs to.

/sbin/init - very important, (but not shown here), init is a program that is vital for booting. It's the first thing the kernel runs, init runs other scripts needed for booting including /etc/rc scripts.
Here are two links about init, Replacing init with Upstart - linux.com, and Ubuntu's Upstart event-based init daemon - linux.com


See the folder named 'grub'? Open that one now...

fig6grub
fig 6 GRUB
And here's a look at what you should see inside your /boot/grub directory.
 
These files are your important GRUB files needed for booting your Linux kernel.

GRUB's stage1 file is a copy of the one that gets installed in the MBR, (sector 0 of any hard disk).
This file is 512 bytes in size, the size of one sector. I don't know why it's 512 bytes.
The MBR is 512 bytes in size, but 64 bytes are reserved for the partition table, 2 bytes for the 55 aa bootable disk flag, plus there's the 'Disk signature', which GRUB preserves, and possibly some other bits and pieces of code that has to avoid being trampled. The bootloader code has to be far less than 446 bytes to fit in the MBR.

There are six of the stage1_5 files to choose from. Those are the files that GRUB installs to the next twenty-one sectors of the first track of the hard disk, right after the MBR.
The jobs of GRUB's stage1 and (optional) stage 1_5 files are just to 'point to' GRUB's stage2 file in a file system somewhere in a hard disk partition, or if  they can't, print an error message.
GRUB's stage1 can also (or instead), be installed to the first sector of a partition, (called a boot sector). In that case the stage1_5 doesn't go with it, (except if the partition is formatted with ReiserFS).

GRUB's stage2 file can be seen in the above screencap. The stage2 file is the main part of GRUB. That's the big GRUB file that does all the heavy lifting to get the kernel loaded into the computer's memory and boot it. The stage2 file I have is 108 KB, according to the output from the command 'ls -lhS /boot/grub', in my terminal. That's by far the largest file in this directory.

Please read this brief and excellent  link about GRUB's stage1, stage1_5 and stage2 files:   
Grub's stage2 file refers to our /boot/grub/menu.lst file for instructions to bring up our GRUB Menu for us at boot-up which offers us a list of operating systems to choose from.
NOTE: That's 'menu.lst', with an 'L', not a '1', it's short for 'menu.list', not 'menu.first', (a common newbie mistake, I got caught with that one myself when I was new here, (LOL)).

When we select an operating system we want to boot from our GRUB menu, we're really selecting the list of commands in our menu.lst file pertaining to that operating system. The stage2 file then uses those commands and goes into action to boot it.
That's why the /boot/grub/menu.lst file is the most interesting of GRUB's files for most of us.
It's GRUB's 'configuration file'. That's the one that we can edit to change our GRUB settings order to get your computer booting exactly the way we want.

Another file in there that's interesting to people whose computers have more than one hard disk, is the /boot/grub/device.map file. That one shows us which hard disk GRUB thinks is our first hard disk and which hard disk GRUB thinks is our second hard disk and so on.

 You can't just open your /boot/grub/menu.lst file and change it and expect to be able to save the changes. That won't work in Ubuntu because of the Linux file permissions (security settings).
We can edit our /boot/grub/menu.lst file if we open it from the command line.

Open your terminal, go 'Applications'-->'Accessories'-->'Terminal' and either copy the command I used out of the code box below and paste it in yours or type it yourself if you prefer.
Don't include the 'herman@bookpc:~$' part though, only the command after it.
If you're typing your own command out by hand, make sure you realize that's an 'L' for 'list', not a '1' in the filename: menu.lst. New users often find that a little confusing.

Actually, you can use 'tab completion' instead of typing entire commands. Just type the first two or three letters of the file name or command, then press your 'tab' key. Most of the time the terminal will guess correctly what it is you want to type and finish it for you.
Code:
herman@bookpc:~$ sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
That makes a backup copy of our /boot/grub/menu.lst file and saves it as /boot/grub/menu.lst_backup.
We always make a backup copy, especially the first time we edit any important configuration file.

If you ever need to restore your /boot/grub/menu.lst file, just reverse the command,
Code:
herman@bookpc:~$ sudo cp /boot/grub/menu.lst_backup /boot/grub/menu.lst 

Now we'll open the file,
Code:
herman@bookpc:~$  gksudo gedit /boot/grub/menu.lst
After typing that into 'terminal', you'll be prompted for your password.
After typing your password in, the menu.lst text file will open in your monitor.


Customizing your GRUB Menu
by editing GRUB's menu.lst file

You can make your computer temporarily unbootable if you make a mistake editing your /boot/grub/menu.lst file.
Don't let that scare you though, editing your /boot/grub/menu.lst file is fun. It's a bit like learning how to ride a bicycle though, you might 'fall off' a few times at first.
It's interesting and educational to play with the commands in GRUB's menu.lst file. For some people it will be their first introduction to computer programming.
Don't worry, it's easy. I'll show you what to do.

Tip: Before editing your /boot/grub/menu.lst file you can go and download a Super Grub Disk CD, floppy or USB image to make an emergency boot disk with. I recommend having a copy of Super Grub Disk on hand for booting with in case you make a mistake and accidentally make your computer temporarily unbootable in the normal way.

Super Grub Disk Homepage - Official Super Grub Disk Website (external link)

Super Grub Disk Page - this website's Super Grub Disk help page

Below here is an example /boot/grub/menu.lst file.
It contains most of GRUB's commands in roughly the order you'll see them appearing in your own /boot/grub/menu.lst files.
I have hyperlinked each command so that you can click on each one to take you to an explanation about what each command does and how to use it.
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        0

#fallback 5 6 7 8
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
#color cyan/blue white/blue


splashimage=(hd0,1)/boot/grub/Ubuntusplash.xpm.gz
foreground ffe4b5
background f4a460


## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title        Windows 95/98/NT/2000
# root        (hd0,0)
# makeactive
# chainloader    +1
#
# title        Linux
# root        (hd0,1)
# kernel    /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=fe7bf845-7ce9-4733-b6de-f70f2b62076d


## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title    Ubuntu, kernel 2.6.20-15-generic
uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel   /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd   /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title    Ubuntu, kernel 2.6.20-15-generic (recovery mode)

uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d

kernel  /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro single
initrd  /boot/initrd.img-2.6.20-15-generic

title        
Ubuntu, memtest86+

uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d

kernel        /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title        Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Microsoft Windows XP Home Edition
root        (hd0,0)
savedefault
makeactive
chainloader    +1


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title        Windows 95/98/Me
root        (hd1,0)
savedefault
makeactive
map        (hd0) (hd1)
map        (hd1) (hd0)

chainloader    +1

###############################################################
# Additional GRUB tricks for fun, security, and convenience

# below here are some lesser known commands some (silly)? ideas

# added by me - these are not part of your stardard menu.lst
#
(you can try them out if you like)
###############################################################

title     Pretty colours
color     cyan/blue white/blue
title     Matrix

color
     green/black blink-light-green/green
title     Green and Gold
color     black/green yellow/black
title     Leonardo Watermelon

color
     black/magenta white/red

title      Your Boot Message Title Here
cat        (hd0,1)/boot/grub/bootmessage
pause      End of Boot Message, Press any key.

title     Windows Security Check
root      (hd0)
cmp       63+1 24306344+1
title     

Reboot
reboot

title      HALT!
halt
fig 7 grub
Above here is an example of a /boot/grub/menu.lst file.  
It should be fairly typical for a dual boot computer with one hard disk. (Except for a few lines I added at the bottom for fun).
It might look a little scary to a new user when you see it all in one big piece like this. Below here I will be showing snippets of this beginning from the top and working our way down. I will point out the parts that can be edited by the user and comment on how to do so.



How to Change the Default -
set which operating system you want booted by the timer

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        0


fig 8 grub
The number after the default command sets which operating boots by default when the countdown timer reaches 0 if no keys are pressed on the keyboard.

For dual booting with certain operating systems that seem to require rebooting very often, it can be a real pain in the neck after a while to have to be there and manually intervene every time the computer reboots.

There are three possible ways to set this, choose the one you like best,
  1. Paste your Windows entry above the beginning of the debian automagic kernels list
  2. edit the number for the operating system entry to be booted (by the timer)
  3. edit the number and type 'saved' there instead.
1) Paste your Windows entry above the beginning of the debian automagic kernels list
You can cut the entire Windows entry from where it is under the end of the automagic kernels list and paste it above the beginning of the automagic kernels list.
 Above this line: ### BEGIN AUTOMAGIC KERNELS LIST   

What NOT to do-  don't paste your Windows entry anywhere inside the automagic kernels list because it will be deleted when you have a kernel update in Ubuntu.

2) edit the number for the operating system entry to be booted (by the timer)

This little line controls which operating system boots by default, Ubuntu or some other operating system entry like another Linux, or Windows.
If you really want to have some other operating system booting first by default, you need to have a look at the bottom section of your menu.lst file at the operating system entries.
Ubuntu is entry number 0 because the GRUB numbering system begins counting from 0.
(From the top of the list,counting down).
To see the area I'm referring to, look at either,
(a) the bottom  of fig 7, (scroll up to see that)  
or  (b)  see the whole of fig 14 below, click here).
Count down from the top, (from just below where it says '## End Default Options ##').
Begin counting with the number 0,  the number of entries containing the word 'title'.
You don't count the entries the are 'hashed out' (with a # in front of them, skip those).
Stop counting when you reach the Windows entry, and that number you end up with will be the right number to replace the number  0 with after the word 'default'.

In this example, it will be the number 4 which you would use in place of the 0 after the word 'default' to cause Windows to boot by default.
That would most likely be true for  the majority of standard dual boot installations.

Windows is behind the fifth appearance of the word 'title'. Don't forget, you start counting from the number 0. So it's not 1,2,3..., it's 0,1,2,3..., okay? Count each time the word 'title' appears and in this example you will see that Windows is number 4 (counting from 0).

Don't be afraid to experiment if you aren't sure, this won't hurt anything if you don't get it right.  All this setting does is make the highlight rectangle in the GRUB menu appear on a different line, that's all. You can easily change that again if it turns out wrong. It's a safe line to edit.

3) Edit the number and type 'saved' there instead.
Use this method if you want to avoid having to re-edit menu.lst when you have a new kernel added to the list during an update. (Thus changing the number that your default operating system is on the list).

Rather than just replacing the number '0' in the line, 'default    0'  with another number, you can type the word saved in place of the '0'.
For example:    
default        saved
That will cause GRUB to remember whatever menu entry you booted last time.
The highlight (selection) rectangle in your GRUB Menu will appear on that line again next time you reboot.

The way this works is by use of the command 'savedefault', included in most GRUB operating system boot entries at the bottom of menu.lst.
When we type 'saved' rather than a number here, after 'default', it causes GRUB to save that information to the /boot/grub/default file and refer to it next time we boot. 
 
Most people would be content with that, however, if even this isn't good enough for you, it is possible to take the idea one step further and make GRUB boot only one operating system by default.
Here is how to trick GRUB to only remember one particular operating system entry.
Just place a # (hash mark) in front of the 'savedefault' command in the other operating system entries (at the bottom of your menu.lst), that you do not want GRUB to remember.
Then GRUB will only be able to remember (save) the operating system entry that does not have the # mark in front of the 'savedefault' command.



4) fallback
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        0

#fallback 5 6 7 8

The fallback command doesn't appear in Ubuntu's GRUB menu by default, it's a less well known command I have added here just to show everyone how to use it.
For this fallback command to work, you would need to delete the '#' (hash symbol).
You would probably need to make up your own numbers to put after it too. The numbering protocol for the fallback command is the same as the 'default' command uses, (already explained above), (scroll up).

When the fallback command is used, if the first booting entry, (number 5 in this example), fails for some reason, GRUB will read stanza number 6, (the seventh stanza), and run those commands instead. If that boot entry fails, GRUB will try the next boot entry, and so on.

When the 'fallback' command is used, GRUB goes into 'unattended boot mode'. If GRUB encounter an error it wait for the user to do something, it just skips right ahead to the next boot entry.
The trouble with that is, you aren't given an error message, so it's not a command that we would want to use all the time for every-day booting.

The fallback command can be very useful if you are having problems booting some other operating system, (Windows or a different Linux), and you already know your GRUB Error message, but you're not quite sure of the exact solution to your problem.
You can make a whole series of trial boot entries at the bottom of your menu.lst, each with different (hdx,y) numbers in them say for example.
Using the fallback command, GRUB will run through the whole list, trying each boot entry until it finds the one that works and then boot the operating system.
That can save you a lot of time. This avoids the need to keep rebooting a live CD or something and re-editing your menu.lst file, possibly numerous times. That can be a very time consuming process.

How will you know which boot entry worked?
You could insert the 'pause' command in each of your boot entries with a short message to inform you of which entry is which. That will stop GRUB at each entry until you read the message and press 'enter'. The 'pause' command puts GRUB back into 'interactive mode' again and that means you'll see any error messages too!

The way I have it set up here, this command will only work for GRUB errors. Once operating system begins to boot it's out of GRUB's hands if anything goes wrong after that and it's too late for the fallback command to do anything.
Instead, you can put the 'fallback' command in your individual operating system entries, see: Booting fallback systems - GNU GRUB Manual. Then the fallback command will even work when you have booting problems in the operating system.



4) Setting the timer
for the boot loader is the next subject.
#fallback 5 6 7 8

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        10
fig 9 GRUB
Following the word timeout above, you'll see the number 10. This sets the timer for the boot loader to boot the default operating system if no-one presses any buttons on the keyboard.
We can delete the number 10, and in its place type in any number of seconds we'd prefer the timer to be set to.
If we want the computer to boot without waiting so long we can set it to a lower number of seconds like maybe 3, 2 or even down to 1second.
If you are also 'hiding' the GRUB menu, you will have 3, 2, or 1 second to press 'Esc' to show the menu.
To make the GRUB menu wait longer, type a larger number in place of the 10.
If we want to turn off the timer, so that we will have an infinite amount of time to admire our GRUB menu and ponder which operating system we might want to boot today, we just 'hash out' the whole line for the timer.
To 'hash out' the line, we insert a # mark before the commands and this will cause the program to ignore the whole line. Then the GRUB menu will theoretically wait forever until you make a decision, select an operating system, and press enter. (Or until there's a power failure).

WARNING:
Don't set the timer to 0 seconds if you also have Windows set as the default boot option or you might not be able to boot Ubuntu anymore.
If you can't boot Ubuntu anymore, then you won't be able to come back and fix your menu.lst file, so you'll make your Ubuntu system unbootable.
(Unless you are clever enough to be able to think of some other way to boot Ubuntu or access and edit /boot/grub/menu.lst from a LiveCD). Click Here to see how.
Tip:
You can use Super GRUB Disk to boot your computer with if it becomes accidentally unbootable due to some error you may make while editing menu.lst

Super Grub Disk Homepage - Official Super Grub Disk Website (external link)

Super Grub Disk Page - this website's Super Grub Disk help page



Hiding the GRUB menu during bootup

timeout        10
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)

# hiddenmenu
fig 11 grub
The word: hiddenmenu is a grub command.

In computer programming, it is often a good idea to add a comment to advise people reading the program what is going on at certain points in the program.
There are special symbols in various programming languages that are used to denote a comment.
In the case of GRUB's menu.lst and many other files that we edit in Ubuntu, the # symbol is a sign that tells the computer that the words after it are to be treated as comment, and not a command. In other words, they are to be ignored (skipped) by the computer.

# - Hides the menu by default (press ESC to see menu' is a good example of a comment.

# hiddenmenu  - is an example of a command that will be treated as a comment (ignored) for now.

If we want the computer to pay attention to the hiddenmenu command and to hide the GRUB menu on start-up, we could 'uncomment' the  line with the hiddenmenu command on it by deleting the # symbol.
Then we will not see the GRUB menu when the computer boots from now on.

Example:
 hiddenmenu
Some people want to set up GRUB this way when they need to share the computer with others in the office or home who just want to boot Windows and may be distressed by the unexpected appearance of the GRUB menu. (They wouldn't know what to do).
With 'hiddenmenu' activated, they will just see a black screen with a small timer on it.  If you want to make a good job of it, set the timer down to 1 or 2 seconds and set the grub menu to boot Windows by default. The black screen will be there and gone again before anyone has time to notice it. No-one would even guess that GRUB and Ubuntu were in the computer at all.
When you want to boot into Ubuntu, press your 'esc' key during this 1 or 2 second count-down, to show the GRUB menu and select Ubuntu.



Add some color to your GRUB menu

# hiddenmenu

# Pretty colours
# color cyan/blue white/blue

fig 12 grub
GRUB's color command changes the menu colors.
The line for color can be uncommented ( delete the # ) and that will cause the GRUB menu that we see when the computer is starting up to appear in pretty colors, instead of just plain old black and white.

The colors cyan/blue white/blue are only the defaults, (example colors).
There are quite a few other colors you can use, and you can make up your own combinations.
To do that,  just delete the colors given there as an example and type or type or copy-paste in your own color combinations.

An easy way to experiment with the different color combinations for your GRUB menu is to use GRUB's freindly Command Line. That's a lot easier than editing your menu.lst file and rebooting every time

Press 'c' from the GRUB menu when your computer is booting to get  GRUB's Command Line Interface
Type the word color as a command, followed by some colors you want to try.
Syntax for the color command is : color normal [highlight]
and the format of each heading is: foreground/background

For example,
grub>  color light-gray/red blink-white/black

Press 'Enter', then press 'Esc' to go back to your menu and see what your GRUB menu looks like with the colors you're testing.
Then press 'c' again and try some different colors, and so on until you decide on the colors you want.
When you have decided on a combination you like, boot Ubuntu and edit your /boot/grub/menu.lst with your chosen colors.

normal 
foreground/background
(most lines in the menu / table background color)
[highlight]
foreground/background
(selected text / cursor bar)
any of these sixteen color names can be used for foreground (normal text & table border)

black
blue
green
cyan
red
magenta
brown
light-gray
dark-gray
light-blue
light-green
light-cyan
light-red
light-magenta
yellow
white
any of these eight color names can be used for background (normal table area)

black
blue
green
cyan
red
magenta
brown
light-gray

any of these sixteen color names can be used for foreground (hilighted text)

black
blue
green
cyan
red
magenta
brown
light-gray
dark-gray
light-blue
light-green
light-cyan
light-red
light-magenta
yellow
white

You can prefix blink- to foreground if you want a blinking foreground color
any of these eight color names can be used for background (selection bar area)

black
blue
green
cyan
red
magenta
brown
light-gray


Some of the color combinations I have tried are listed below.
 
command          font&border/panel         hilited font/cursor (selection bar)
color           black/brown                  blink-yellow/black
color           black/green                   yellow/black
color           light-green/green          blink-yellow/red
color           black/magenta             white/red
color           white/red                      light-gray/black
color           light-gray/blue              black/light-gray





Ubuntu 8.10, kernel 2.6.27-7-generic                  
Ubuntu 8.01, kernel 2.6.27-7-generic (recovery mode)
Ubuntu 8.10, memtest86+
Other operating systems:
Microsoft Windows XP Home Edition


   Use the up or down arrow keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line.


NOTE: We cannot have a pretty color grub menu and also a splashimage simultaneously, we need to choose one or the other.



Add a splashimage to the GRUB menu


# Pretty colours
#color cyan/blue white/blue


splashimage=(hd0,1)/boot/grub/Ubuntusplash.xpm.gz

foreground ffe4b5

background f4a460
fig 10 GRUB
You can customize your GRUB with a nice splashimage (picture) for your GRUB Menu.
You can either find one you like that someone else has already made and downloading it from the internet, or even make your very own unique one with GIMP!

If you want to have fun making your own splashimages, I have help on how to do that further down this page. Link: Making your own splashimage

If you like any of my splashimages (below) and if you trust this site, you are welcome to download any of my splashimages shown here for free.
Do so at your own risk. I am sure they are safe, I made these myself.
(But I copied the canonical logos and colors, I hope that's okay).


Ubuntusplashthumbnail Kubuntusplashthumbnail Xubuntusplashthumbnail
Ubuntusplash.xpm.gz
Kubuntusplash.xpm.gz
Xubuntusplash.xpm.gz

EurekaFlagthumbnail AboriginalFlag
p15/nightshipThumb.png
EurekaFlag.xpm.gz
Download
The Australian 'rebel' flag, from the miner's strike at Eureka Stockade in 1854.
AboriginalFlag.xpm.gz
Download
try it with fg&bg settings,
foreground ffff00
background 800000
nightship.xpm.gz
Download
looks best with fg&bg settings,
foreground 87ceeb
background 0000ff

p15/eeepcsplash.pngp15/moonlight.voyager.pngp15/jaunty.dot.jackalope.thumb.png
eeepcsplash.xpm.gz
Download
This is my EeePC splashimage
I use fg&bg settings,
foreground 8b2323
background ee8262
moonlight.voyager.xpm.gz
Download
This is der Duyfken, in which Captain Willem Janszoon and his crew discovered Australia in 1606. Historic link
jaunty.dot.jackalope.xpm.gz
Download
Aboriginal dot painting of an Australian jackalope fighting a crocodile

LINKS
Here are some nice websites  where you can download more splashimages already made for you, McGrof'sschultz-net, and schragehome.de
  
This one's a good link, it has lots of nice ones: GNOME-Look.org

Here are some links from Ubuntu Web Forums with nice splashimages you can download
Post your GRUB bootsplash image!
GRUB Boot Splash Screens
GRUB 0.97 and splash screens
Kubuntu Widescreen GRUB Splash
How to: GRUB Splash Image
HOWTO: GRUB splash images.
simple human GRUB splash

When you have downloaded your splashimage and moved it or pasted it into your /home/username directory, you will need a 'sudo' command to copy it to your /boot/grub directory.

Code:
herman@bookpc:~$ sudo cp Ubuntusplash.xpm.gz /boot/grub
And the above command copies my new grub splashimage to my /boot/grub directory.

Then you need to open your /boot/grub/menu.lst file with your text editor (gedit), also using a 'sudo' command,

Code:
herman@bookpc:~$ gksudo gedit /boot/grub/menu.lst

and insert a line similar to the following,
Code:
splashimage=(hd0,1)/boot/grub/Ubuntusplash.xpm.gz
Where: Ubuntusplash.xpm.gz is the name of my splashimage and it is located in my (hd0,1) partition, in my /boot/grub directory. You may need to change this command to suit yourself if your splashimage has a different name or is in a different location.
Note: If you make a mistake in the splashimage line in menu.lst, it can cause you some temporary booting problems until you correct your mistake. You might need to boot with Grub's Command Line Interface or a Super GRUB Disk  to get access to the menu.lst file again so you can correct it.
Another way to get out of difficulty is to run a live cd such as Ubuntu Desktop, Knoppix, Puppy Linux or the like, and mount the Ubuntu partition and edit the file that way. Mount a Ubuntu ext3 or reiserfs filesystem rescue your Linux system with a Live CD

It is not unusual for inexperienced new users or even careless old experienced users to have a few hiccups with getting the command right, but once you get it all done correctly you will have a nice splashimage showing behind your GRUB menu.


Making your own splashimage

The excellent instructions in the following link, http://ruslug.rutgers.edu/%7Emcgrof/grub-images/, will tell you how to do everything with splashimages. That's the original and best GRUB splashimage site. That's the one I got all my information from, and is well worth reading.
The only problem with that site is that the instructions were written for Red Hat Linux and need to be altered a little bit to work for Ubuntu users. Experienced users will have no problems, but for the sake of new users I'll explain some it again here in Ubuntuese to make it easier.

Overview:
Due to the fact that the operating system will not have started yet at the time the GRUB splashimage will be displayed, the operating system's graphics drivers will not be in operation yet. Therefore we are just relying on the simpler video capabilities of the BIOS. Since most computer's BIOSes can't handle fancy, high quality images, we are limited to an image size of 640x480 pixels and a 14 color display, (unless your PC has some kind of special new BIOS).
The file type used for the image file is .xpm, and it is then compressed. This used to be done by applying a gzip command. An easier way to gzip a file in Ubuntu nowadays is to right-click on it, and click 'Create Archive', from your right-click menu.

Step 1:
Pick out an image to turn into a GRUBsplash. Any image file you might have will do, it can be a digital art work you made yourself, or even a picture taken with your own digital camera.

NOTE: Your picture will lose quality when you follow these steps.

Some pictures (photos) and digital art works that look great beforehand will look horribly ugly after they are converted into GRUB splashes. Only a few actually look better, so you can expect to produce a lot of rejects. You will need to use trial and error, patience, luck and good judgment until you learn how to choose images that can be turned into good GRUBsplashes.
I think the simplest images turn out looking the best, such as cartoons, cartoon characters on a plain solid background, or other kinds of digital art with sharp edges.
Even just one or two words in a nice font on a plain or colored background will do fine.
Because of the pixelation, scaley creatures like lizards and dragons or fish look good.
Black and white photos can be good, and can even be color- tinted for extra effect.

Step 2:
Make a copy of the image and work on the copy, preserving the original in good condition so you can make another copy of it and try again if things go wrong. Never use your original image file.

Step 3:
Open the copy of your image with GIMP in Ubuntu, and scale and/or crop the copy of your image until it's 640x480 pixels.

Step 4:Carefully examine your new image to see if it needs any editing, use GIMP to touch up any faults or flaws in your image.HINT: If you want to put some words in your splashimage in fancy text using GIMP, you should first look at 300+ Easily Installed Free Fonts for Ubuntu - Ubuntu Blog by Carthik Sharma, and follow the instructions there to install some beautiful fonts for your splashimage.Step 5:Go 'Image'-->'Mode'-->'Indexed', and set 14 colors as the Maximum number of colors, and set the 'color dithering' spinbox to 'None', and click 'OK'.
Then go 'File'--> 'Save as' and make up your own filename. Be sure to add an .xpm filename extension after it, click 'save', and you're all done. It's that easy!
For example, you might name it something like: bestgrubsplash.xpm
Any name will do as long as it has .xpm after it.

Step 6:
gzip your 640x480 pixel, 14 color .xpm image made with GIMP, here's the command I used to use to gzip mine, you should be able to use a similar command for yours, whatever it's name is,
code:
herman@bookpc:~$ gzip Ubuntusplash.xpm
Where: Ubuntusplash is the name of my .xpm file
Actually, nowadays you don't really need to use the command line for this job anymore. An easier way to gzip a file in Ubuntu these days is to right-click on it, and click 'Create Archive', from your right-click menu, then select .gz in the right-hand spinbox, and click 'create'.

Step 7:
Copy your .xpm.gz file to your /boot/grub directory.
You can actually leave your splashimage anywhere, even in your /home/username directory, as long as you type the correct file path for it into your menu.lst file. If you do leave it in your /home/username directory just remember not to accidentally delete, move or rename it. To avoid the chances of that happening it is probably best to copy it to your /boot/grub directory.
You definitely do need to use the command line for that,
code:
herman@bookpc:~$ sudo cp Ubuntusplash.xpm.gz /boot/grub/
And the above command copies my new grub splashimage to my /boot/grub directory.

Step 8:
Edit your operating system's /boot/grub/menu.lst file with a line to make your GRUB open and display your splashimage at boot time. I already showed you how to do that at the start of this topic, go back.

EXTRA TIPS:
To  look at your splashimages without taking the time and effort to edit your menu.lst file with each one and re-boot each time, you can load them with CLI mode GRUB when you are booting up. Just press your 'c' key for GRUB's Command Line.
Then, type something similar to the following,
Code:
grub>  splashimage (hd0,1)/boot/grub/Ubuntusplash.xpm.gz
Where: (hd0,1) is the partition number of the Ubuntu partition, and Ubuntusplash.xpm.gz is the name of a splashimage file which is located in the /boot/grub directory.
Then press 'esc' to return to your GRUB menu to see how it looks.
When finished, press 'c' again to return to the command line interface.
Type the path and filename of another GRUBsplash you want to look at and press 'Enter'.
Then press 'esc' to return to your GRUB menu to see how it looks.
And so on...

NOTE:  pretty color must be disabled (hashed out) in your GRUB menu or your splashimage will refuse to display. If you have problems, check and make sure you have your color lines all hashed out in your /boot/grub/menu.lst file.
We can however, change the colors of the foreground, background and border for the splashimage.  This can be very effective to compliment and show off an already good splashimage and make the finished job look superb! I highly recommend reading and trying out the instructions in the next article right below here on setting the foreground, background and border colors!


Setting the foreground, background and border colors
for your GRUB menu.
The following several commands only work in graphics mode GRUB (when you are using a splashimage). See 'pretty color' if you aren't using a splashimage.

We can use the commands 'foreground', 'background' and 'border' to specify the colors of the parts of our GRUB display that show up along with our splashimage.

'foreground' means the color of the main upper left faces of all letters and the big text rectangle that has all our operating system titles in it in our GRUB menu.

'background' sets the colors used in the lower-right 'shadowing' for all the letters and the big rectangle around our operating system titles and most importantly the hilite (selection) bar that we shift up or down with our arrow keys to select an operating system to boot.

'border' gives us a chance to set a color for any parts of the screen not used by the GRUB menu. In my computer I'm using 640x480 GRUB splashes that nearly fill the entire screen. There is a column on the left that shows up and a thin line across the bottom of the monitor that shows up if I set a 'border' color that is different from my splashimage. I could leave the border color black or pick a color that will blend in with the splashimage or one that will show up if I want that effect. I imagine if I use a smaller sized splashimage the border will show more.

You can pick any colors out of the sixteen color chart here in this sixteen color chart to begin with, but probably you'll want to use a 256 color chart instead ,that would be even better,
black000000green008000silverc0c0c0lime00ff00
gray808080olive808000whiteffffffyellowffff00
maroon800000navy000080redff0000blue0000ff
purple800080teal008080fuchsiaff00ffaqua00ffff

Here are links to sites that give us the codes for specifying 256 colors. Most computers these days should be able to display 265 colors in VGA mode. I have not tried all 256 colors yet, but I have tested enough to be pretty sure any of them will probably work very nicely.

256 Color Chart - Eloquent Vision

16 Color and 256 Color chart - Web Diner's


For example these can be applied something like this,
# Pretty colours
#color cyan/blue white/blue


splashimage=(hd0,1)/boot/Ubuntusplash.xpm.gz
foreground ffe4b5
background f4a460 

I added these two lines to my menu.lst file right under the splashimage command, although I think it can probably go anywhere.
That gives me 'moccasin' lettering with 'sandy brown' shadowing and selection bar over my nice chocolate and tan Ubuntusplash.

I chose yellow, ffff00 and maroon 800000 with my Aboriginal flag splashimage.


The 'shade' command toggles the shadows to the right-lower side of the rectangle and font.  
shade 0 turns off the shadow effect
shade 1 turns on the font shadows
So with this command you can now choose whether you want to see the font shadows or not.

You can also use these commands from GRUB's Command Line Interface (CLI)  while you are booting up to try out all the colors you like and see what they look like. Just press 'c' from your GRUB menu for a command line and use the same commands to change the colors as you please, then press 'Esc' to go back to your GRUB menu to see how it looks. You can do that as many times as you like until you have a combination you are happy with.

viewport
If you have a nice splashimage but the rectangle in the GRUB menu that the operating system titles are printed in happens to be in the way of an important part of the picture, you can either make a new splashimage with the subject of the picture in a different spot, or you can move that rectangle.
The rectangle can be moved around somewhat and made larger or smaller too.

GRUB's viewport command is for controlling the position and size of the rectangle that the text fits inside in the GRUB Menu when we use a splashimage. (only available in Graphics mode).

for example,
viewport 0 0 66 16
gives a small rectangle in the upper left of the screen.

for example,
viewport 3 3 80 30
means you will have the largest rectangle in the middle of the screen

for example,
viewport 11 6 80 30
gives you a large rectangle in the lower right of the screen

I couldn't get it to accept any numbers for a small rectangle in the lower right though, sorry. You may be able to experiment at the command line like I did until you get the results you want.

The syntax for viewport is like this,
viewport x0   y0   x1    y1

The numbers seem to range between,
viewport  0-11  0-6 66-80 16-30

x0 sets the left-right positioning for the left side of the rectangle.
In my tests the smallest number I could set for this parameter was 0 and the largest was 11,
although sometimes a number less than 11 had to be settled for, depending on the other parameters.

y0 sets the up and down position for the rectangle.
0 entered here makes the rectangle appear as close as possible to the top of the monitor.
The number 6 was the largest number I could get it to accept, which made the rectangle lower.

x1 can be in the range from 66-80 and sets the width of the rectangle.

y1 can be a number in the range between 16 and 30 and sets the height for the rectangle.

This command can also be run from GRUB's Command Line Interface to experiment with it until you get your viewport right for
your splashimage.

After that you can add it to your /boot/grub/menu.lst somewhere around your splashimage command.

You should experiment with these commands at GRUB's Command Line Interface (CLI)  while you are booting up to try out all the parameters until you get the viewport how you like it before adding it to your menu.lst file.
Just press 'c' from your GRUB menu for a command line and use the viewport command to change the rectangle as you please, then press 'Esc' to go back to your GRUB menu to see how it looks. You can do that as many times as you like until you have a combination you are happy with.



Set a GRUB password

splashimage=(hd0,1)/boot/Ubuntusplash.xpm.gz
foreground ffe4b5

background f4a460

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
fig 13 GRUB I recommend the following information, Protecting your computer from cracking,  from the 'GNU GRUB Manual' for how to set your GRUB password. It's a bit dated, we don't actually store our password in plain text in /etc/password these days, a skilled GRUB user can possibly 'cat' sesitive files that you might consider private, but you get the idea.
Here's a Ubuntu Web Forums link by HungSquirrel, HOWTO: Password protect your GRUB entries.
Here is a link to the Feisty Starter Guide too, 1.19.2 How to disable all interactive editing control for GRUB menu.

So, if you have read those links, you probably understand that you should:
  1. boot into Ubuntu and open a terminal and type: sudo grub, for a Grub Shell. (You'll have a 'grub>_' prompt).
  2. After the grub>_ prompt, you just need to type this command: md5crypt
  3. md5crypt will ask for your password, which you can type in
  4. You'll be given your password back in an encrypted form
  5. Copy the encrypted password and type: quit (to close the grub shell)
  6. type: gksudo gedit /boot/grub/menu.lst (to open your menu.lst for editing)
  7. type the word: password on the empty line below '#password topsecret' and make a gap
  8. paste your encrypted password after the word: password
  9. type the word: lock under the word: title in every boot stanza you want password protected
  10. save the changes and close the file.
Be aware that having a GRUB password will be a step in the right direction, but by itself it won't guarantee you 'bullet-proof security'.
It will help to keep casual 'snoops' out, and it will probably be enough to slow down an ordinary spy.
Sometimes if you can slow someone down, that's enough to deter them, they may be afraid of being seen by surveilance cameras or being caught by someone enexpectedly entering the room.
If you're up against a more determined type of spy though, or if you have information that's valuable or confidential, you should look into some better security arrangements, such as an encrypted file system at least. For further reading see: Ubuntu Security - by bodhi.zazen


Examples
#
# examples
#
# title        Windows 95/98/NT/2000
# root        (hd0,0)
# makeactive
# chainloader    +1
#
# title        Linux
# root        (hd0,1)
# kernel    /vmlinuz root=/dev/hda2 ro
#


#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

This part of GRUB's menu/lst file doesn't really do anything. Everything here is a comment.
It's just to show you a couple of examples of how an operating system entry should look.

The line at the bottom of this table is to let people know that they should put operating system entries that are 'static' (in other words, ones that are not to be automagically updated), either above the start of the automagic kernels list or after it, but not in it.
You can paste your Windows entry here if you want Windows to be first in the list and boot by default.
Your Windows entry to be automagically deleted every time Ubuntu is updated with a new kernel if you paste it anywhere between the beginning and the end of the debian automagic kernels list. (Well, it shouldn't have been there in the first place). Many users don't understand that and blame GRUB or Ubuntu for their problems.


DEBIAN AUTOMAGIC KERNELS LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs

This line marks the beginning of the Automagic kernels list
The bottom of the automagic kernels list is marked with a line that looks like the following,
### END DEBIAN AUTOMAGIC KERNELS LIST

The idea of the Debian Automagic kernels list is to allow us to have a new kernel installed as part of an update from the Internet. When we do that, our menu.lst file is updated 'automagically' with the correct details for booting our new kernel. We don't have to edit the file manually each time. It's a wonderful feature!
The debian 'update-grub' script is the program that controls that, but there are a few user
configurable choices we can modify if we need to by editing our menu.lst file. It is relatively rare for anyone to need to modify these, but we'll go through some of them just below here anyway. Stay tuned...

I should also mention here, while we are on the subject, that 'update-grub' can also be run from our terminal, voluntarily, if the occasion requires it. For example, your whole menu.lst file can be completely deleted. Running 'sudo update-grub' in a terminal can generate a brand new one for you! Now isn't that magic?
You might need to edit it with any other operating system entries yourself though.
From here on, inside the automagic kernels list, double hashes (##) are used for preceding lines that are only 'comments', (lines that are there for humans to read and for the computer to ignore).
Lines that affect the computer will have single hashes (#), these are not to be removed. This is very important. Other wise 'update-grub' won't work properly for you.

Okay, now we'll look at a few settings the user can edit for update-grub in the automagic kernels list here,

kopt
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro
kopt stands for 'kernel options'.
'kopt=root=UUID='This line should contain the UUID to point to your linux /  (root) partition, meaning the partition which contains /sbin/init.

'ro' is a 'kernel parameter', and means the file system will start off as 'read only', just for the first part of booting.
If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add 'noapic', 
Code:
# kopt=root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro noapic

Note: If you only want to test kernel parameters for one session, you can just edit the kernel line by pressing 'e' from the GRUB Menu when the computer is booting. Then if that solves your problem you may add it to your menuu.lst here. You should run 'sudo update-grub' after editing the file.
These lines control what is entered automagically in your new operating system entry 'kernel /vmlinuz root=UUID=...' when you receive a kernel update, and make the changes persistent.

Links,
grumpymole: Ubuntu - How To Edit Grub Boot Parameters

The Linux BootPrompt-HowTo
More links on kernel parameters,
10 boot time parameters you should know about the Linux kernel ...
5.2. Boot Parameters
The Linux BootPrompt-HowTo
Cheat Codes - Knoppix Documentation Wiki
Kernel-parameters-2.6.11 - Knoppix Documentation Wiki



groot
## default grub root device
## e.g. groot=(hd0,0)
# groot=
fe7bf845-7ce9-4733-b6de-f70f2b62076d
'groot' is short for 'grub root device'.
By default, GRUB's root device is your /boot partition, the partition your stage2 file and your Linux kernel is installed in. If you have a standard installation, with a /boot directory in your / (root) partition, then the UUID number you will see here will be the same as the UUID number you will see for kopt. 
If you have a special installation with a separate /boot partition, the UUID number you should see here will be the the UUID number of your /boot partition's file system.

It's unlikely you will need to change this unless you have just finished doing some work with your disk partitioning software and changed your file systems somehow, or added a new /boot partition that you might not have had before, or something like that.

In that case you should also check your operating system entry to make sure the GRUB 'root' option is pointing to the correct device as well.



alternative=true

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true
 
Leave this set as 'true' if you want update-grub to keep making recovery mode entries for each new kernel entry when we have a kernel update.



lockalternative=false
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false
Read post #8 by soul_rebel answered in: HOWTO: Password protect your GRUB entries - Ubuntu Web Forums.
According to soul_rebel, if you have a GRUB Password set, you should change 'lockalternative=false' to 'lockalternative=true' here.
That will mean that instead of needing to manually edit your GRUB menu to add the word 'lock' to the recovery mode entry every time update-grub is run, (when we have a kernel update), update-grub will do that automatically for us.



defoptions
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
This means every time a new kernel is added to the list, the new kernel's default entry ( the one we normally use for booting) in menu.lst will be accompanied automagically by the option '=quiet splash'.
quiet means we won't see a lot of white typing scrolling up a black monitor background to explain every step of the process of booting up the system, (unless something special is there we might want to see, like a file system check).
splash means we will see a nice picture in our monitor  while our computer is booting. Some people customize these splash screens too. It's a different sort of splash screen than the one behind the grub menu.
vga= Here is a link to an excellent howto which explains all we need to know about the vga= option, HOWTO: Change bootup resolution, by Indras



lockold=false
## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false
I imagine this is similar to # lockalternative=false, but I haven't tried it out myself yet.
It probably adds the command: lock to the old boot entries.




xenhopt=

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
I don't know what these are for yet, sorry. Here is a link to the Wikipedia about Xen Hypervisor,
http://en.wikipedia.org/wiki/Xen



altoptions

## altoption boot targets option
## multiple altoptions lines are allowed

## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single
Sets the kernel options for the recovery mode entry.



howmany=all

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the

## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all
This controls how many kernels can be listed in the kernels list. Each time a kernel is updated it is added at the top of the list and the old kernel remains in the list, but is moved down.
If you don't like having a big long kernels list and having to hash out or delete kernels, then unhash 'howmany=all', and replace 'all' with a number of your choosing. I like to set mine to 1. That keeps my GRUB menu much tidier. If I ever decide I need to revert to an older kernel I can always do that by booting manually with Grub's Command Line Interface.



memtest86=true

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true
I like having memtest86+ always available in my GRUB menu. It isn't compulsory and some people prefer to keep their GRUB menu brief for appearances sake. Perhaps you have a nice splashimage and want to see more of your pretty picture or something like that. You may have a copy of memtest86+ on a live cd they can run if you need to. Okay then, if that's your preference, just alter this option to 'false' and GRUB won't put it there anymore.



updatedefaultentry=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
See Bigbluecat's entry in the following linked Ubuntu Web Forums thread (post #4), http://ubuntuforums.org/showthread.php?t=426954&highlight=bigbluecat



End Default Options

## ## End Default Options ##

This sign marks the end of the default options used for settings for the automagic kernels list.

Below here are our operating system entries, the list we see and can select from each time our computer boots up. A mistake in any of these entire can cause problems for us when booting. So this is where most of the editing takes place after installing a new operating system or changing our hard disks and/or partitions around.



Native Operating System Entries
title    Ubuntu, kernel 2.6.20-15-generic
uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel   /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd   /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title    Ubuntu, kernel 2.6.20-15-generic (recovery mode)

uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d

kernel  /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro single
initrd  /boot/initrd.img-2.6.20-15-generic

title        
Ubuntu, memtest86+

uuid     fe7bf845-7ce9-4733-b6de-f70f2b62076d

kernel        /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

This area is reserved for our native Ubuntu operating system entries only, these operating system entires will be automagically updated by the /usr/sbin/update-grub script and the debian automagic kernels list when a new kernel is added during an update.

Don't put any of your own other operating system entries in this area or they will be deleted at every kernel update!

If you need to edit your Ubuntu boot entries, you should do so by editing your Debian automagic kernels list setting as explained above here, (within the yellow border), and running /usr/sbin/update-grub to make the changes persistent.



END DEBIAN AUTOMAGIC KERNELS LIST

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title        Other operating systems:
root
This sign marks the end of the automagic kernels list. Above this sign, there should be no entries placed for strange operating systems, or they will be automagically removed next time there is a kernel update.
The 'Automagic kernels list means that when an update gives us a new kernel, it will be automatically added to our GRUB menu. We don't have to manually edit our menu.lst to boot the new kernel or re-install GRUB every time. That's a great feature for GRUB that other boot loaders wish they could imitate!



Other Operating System Entries

# This is a divider, added to separate the menu items below from the Debian
# ones.
title        Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Microsoft Windows XP Home Edition
root        (hd0,0)
savedefault
makeactive
chainloader    +1


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title        Windows 95/98/Me
root        (hd1,0)
savedefault
makeactive
map        (hd0) (hd1)
map        (hd1) (hd0)

chainloader    +1

Other operating system entries are normally added here, below the end of the Debian Automagic Kernels list, or else above the start of the Debian Automagic Kernels list.

These can include boot entries for foreign operating systems such as certain 'proprietary' systems and/or additional installations of Ubuntu and other GNU/Linux distros.

Ubuntu and other GNU/LINUX operating system entries

Ubuntu or Debian operating system entries

Operating System entries for multibooting other Linux Systems

Windows operating system entries

Chainloading on a first hard disk   ...for booting a standard Windows installation

Chainloading on a non-first hard disk  ...using a pair of map commands

More than one Windows on the same disk  ...use hide and unhide commands


Ubuntu Operating System Entries


title
title        Ubuntu, kernel 2.6.20-15-generic
uuid        
fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
The title command means the words on the line after it will be displayed as a boot option in your GRUB menu.  You can replace the words on that line with anything you like and your computer will still boot up okay. You'll just see a different message in your GRUB menu.



uuid

title        Ubuntu, kernel 2.6.20-15-generic
uuid         fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
This needs to be the file system UUID number of your /boot partition.
Your /boot partition is defined as the partition your linux kernel resides in.
The uuid command replaced the old 'root' command, which used to need a partition number after it, such as (hd0,1) or something like that. Sometimes if there was more than one kind of disk it could be confusing which kind of disks should be numbered first. Some computers number the IDE drives first, followed by the SATA drives, and if there's a USB drive plugged in, it will be numbered last. Unfortunately for GRUB, not all computers are made the same when it comes to numbering different kinds of discs, and they don't always send a clear signal to GRUB about their intentions.
The uuid command solves a lot of problems, now GRUB is much better at finding the right device.

You can also use the 'uuid' command from GRUB's Command Line Interface to get a list of file system UUID numbers 'on the fly' and then boot,
For example,
grub> uuid
(hd0,0) ext3 79a5a0ce-499e-4738-9d9b-60590f1b83fe
(hd0,1) ext3 6178d387-9ab5-4f23-a56d-8e0cba0addc3
(hd0,3) reiserfs 4d4939f2-de30-438a-896f-af6a77406eea



kernel
title        Ubuntu, kernel 2.6.20-15-generic
uuid         fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
The kernel command is for telling GRUB which kernel you want GRUB to boot.

The path and name of the linux kernel must be in the line following the kernel command.
There must be no spelling mistakes or syntax errors. One miniscule mistake and your operating system won't boot. In times of olde, this had to be typed in by hand after every kernel update. Now we have the debian automagic kernels list and the update-grub script to write our new menu.lst when we are given a new linux kernel. If you do ever need to edit this line for any reason, just be careful. (It's easy to fix again though).

The 'root=' command is followed by the UUID number for your operating system's 'root' partition.
The 'root' partition is defined as the partition which contains the operating system's /sbin/init file.


After that come 'kernel options', where you tell GRUB how to handle the kernel if you want it loaded a special way.
 
Another way to get a list of these UUID numbers in case you ever need to know that to edit your menu.lst file is to boot your Ubuntu 'Desktop' Install/LiveCD and run the command 'blkid', or 'sudo blkid', 
For example:
You may need to use the numbers listed by the 'blkid' command to edit your /boot/grub/menu.lst file.
herman@work:~$ blkid
/dev/sda1: UUID="f0ff07cb-3064-45fe-8ee5-a65a78cb20da" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb1: UUID="459F-9406" TYPE="vfat"
/dev/hda1: UUID="2629-16F0" TYPE="vfat"
/dev/hda2: UUID="fe7bf845-7ce9-4733-b6de-f70f2b62076d" SEC_TYPE="ext2" TYPE="ext3"
/dev/hda5: UUID="7affdc27-ab39-4b16-91da-e9e8d9b672dd" TYPE="swap"
/dev/hdb1: UUID="44F0-A71B" TYPE="vfat"
/dev/hdb4: UUID="237f0cef-9905-41fb-82ba-bc360fb43a25" SEC_TYPE="ext2" TYPE="ext3"
/dev/hdb5: UUID="191d4618-7b62-41e6-ab41-7bd7a0708244" TYPE="swap"
It's possible to use the file system label after the root= command in the kernel line instead of the UUID number if you prefer. I haven't tested that idea yet myself, but here's the link where I first read about it, menu.lst root= reference - Debian Web Forums.
You can easily set your own file system labels with Parted Magic or GParted LiveCD, or Gnome Partition Editor in your Ubuntu Live CD. You may also want to refer to this website's File Systems and Mounting Page for more info on setting file system labels.



initrd

title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
The initrd command tells GRUB you want to load an initial ram disk.

In the line following the initrd command, you need to have the exact path and filename of the initrd.img that matches the kernel you're going to boot.



savedefault

title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/initrd.img-2.6.20-15-generic
quiet
savedefault
The 'savedefault' command invokes a program called 'grub-set-default', and that records which boot entry you used. It saves that to a file called /boot/grub/default, and you can open that file with a text editor and read it if you are curious.

The 'savedefault' command isn't important, you can boot just as well without it.
It's only used if you type the word 'saved', after the 'default' command, up around the top of your menu.lst file, default.



recovery mode
title        Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro single
initrd        /boot/initrd.img-2.6.20-15-generic
This is the 'recovery mode' entry, as would be obvious to most people.
When you boot into recovery mode your computer will boot up without the splash screen that hides all the text the kernel prints out us as it is booting. If it stops booting half way somewhere and gets stuck, you can at least see what stage it stopped at, and that might help you diagnose the problem.

Hopefully it'll boot all the way though, and when it does, you'll be offered a menu.

You can,
  • resume  - Resume normal boot
  • clean     - Try to make free space
  • dpkg      - Repair broken packages
  • fsck       - File system check
  • grub      - Update grub bootloader
  • netroot  - Drop to a sheel prompt with networking
  • root       - Drop to a  shell prompt
  • xfix        - Try to auto repair graphic problems
If you drop to a shell and you know some Linux commands, you can use nano to edit whatever file needs fixing and reboot. For example, you can fix a mistake in your /boot/grub/menu.lst file, or /etc/fstab, or /etc/X11/xorg.conf files if one of those is stopping you from booting. It's often quicker to use the recovery console that to go find a live CD to do the same things.



Hide items in the GRUB Menu
title        Ubuntu, kernel 2.6.15-23-386
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.15-23-386 root=/dev/hda2 ro quiet splash
initrd        /boot/initrd.img-2.6.15-23-386
savedefault
boot

title        Ubuntu, kernel 2.6.15-23-386 (recovery mode)
root        (hd0,1)
kernel        /boot/vmlinuz-2.6.15-23-386 root=/dev/hda2 ro single
initrd        /boot/initrd.img-2.6.15-23-386
boot
When we receive kernel updates, and the update-grub script makes us a new menu.lst, it doesn't delete the entries to our older kernels. That way if anyone finds they can't boot with the new kernel (maybe if the new kernel has a bug in it and doesn't support their hardware for example), they can just scroll down a few lines and boot up with their older kernel again instead.
Here's an example thread about that, Grub menu.lst shows 2 Linux kernels

Sometimes, we end up with a big long list of old kernel entries that we're never going to use.
You probably don't need to see all of those entries every time your computer boots.
They can get in the way of other boot options at the bottom of the list that we might want to see without scrolling, and our menu.lst file will get messy.

#title        Ubuntu, kernel 2.6.15-23-386
#root        (hd0,1)
#kernel        /boot/vmlinuz-2.6.15-23-386 root=/dev/hda2 ro quiet splash
#initrd        /boot/initrd.img-2.6.15-23-386
#savedefault
#boot
If you're the careful type, you may want to just 'comment them out' by typing a # mark at the beginning of the line you want to hide.  Then you won't see them, but they'll still be there in case you ever do decide you want one of them again for some reason.

I'm more adventurous, and I normally just delete the lines for them from my menu.lst file completely, I can always find them again by searching for them with GRUB's Command Line Interface if I ever need any of them.

If you don't like having old kernel entries left in your boot menu at all in the first place, you can limit the number of kernel entries that show up here by using the # howmany=all setting in the automagic kernels default options section.

That's all most people need to do, especially if you have enough room on your hard disk.
It's easiest and probably best to just leave old retired kernels and initrd.img files alone and let them remain in the file system just in case we might ever need them again for any reason.

If you have Ubuntu installed in a very small hard disk or a USB flash memory drive and you're cramped for disk space though, you can remove old kernels by uninstalling them with Synaptic Package Manager.
Sometimes people with a separate /boot partition run out of room in their /boot partition and might need to uninstall a few old kernels.
Old kernels don't take up very much hard disk space, when you add on the initrd.img files that are supplied with them do take up some. A typical kernel for Ubuntu is a little too big to fit on a floppy disk, but the initrd.img file is a quite a bit larger. You can use ' ls -lhS /boot ' if you want to see for yourself.

For example,
herman@amd46b:~$ ls -lhS /boot
total 18M
-rw-r--r-- 1 root root 7.1M 2007-10-22 02:43 initrd.img-2.6.22-14-generic.bak
-rw-r--r-- 1 root root 7.1M 2007-12-21 09:37 initrd.img-2.6.22-14-generic
-rw-r--r-- 1 root root 1.7M 2007-12-18 17:09 vmlinuz-2.6.22-14-generic
-rw-r--r-- 1 root root 1.1M 2007-12-18 17:09 System.map-2.6.22-14-generic
-rw-r--r-- 1 root root 409K 2007-12-18 17:09 abi-2.6.22-14-generic
-rw-r--r-- 1 root root 302K 2007-12-01 03:53 coffee.bmp
-rw-r--r-- 1 root root 151K 2007-12-01 03:53 debianlilo.bmp
-rw-r--r-- 1 root root 101K 2007-09-28 21:03 memtest86+.bin
-rw-r--r-- 1 root root  67K 2007-12-18 17:09 config-2.6.22-14-generic
-rw-r--r-- 1 root root  24K 2007-12-01 03:53 sid.bmp
-rw-r--r-- 1 root root  24K 2007-12-01 03:53 sarge.bmp
drwxr-xr-x 2 root root 4.0K 2007-12-27 14:43 grub
-rw-r--r-- 1 root root  512 2007-12-01 03:58 boot.0830
lrwxrwxrwx 1 root root   15 2007-12-01 03:53 debian.bmp -> /boot/sarge.bmp

Here are a few links about how to uninstall old kernels, if you have to,
Remove Ubuntu Kernels You Don't Need - Tombuntu, 
Removing Those Extra Kernels in Ubuntu -Alter Ego,
How to: Linux delete or remove kernel - Nixcraft, and,
Remove Old Kernel From Ubuntu - Lahiru Sandakith’s Web Log.

Once again, it is probably not worth the time and effort for most people who have normal sized hard disks to bother uninstalling old kernels. Only someone running Ubuntu in a flash memory device or very in a very small hard disk would probably feel the need to do that. 



memtest86+ 
title        Ubuntu, memtest86+
root        (hd0,1)
kernel      /boot/memtest86+.bin
quiet
This is the entry for memtest 86+, I like memtest86+.  
We can run the memory test when a computer behaves strangely and won't boot.
A memory test can be very useful to find out if a memory module could be faulty, memtest 86 +


Windows Operating System Entries
Windows normally has its entry placed at the bottom, it should not be included in the automagic list. The divider at the bottom of the automagic kernels list is there to protect the Windows entry from being automagically deleted when the automagic kernels list updates itself.
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Microsoft Windows XP Home Edition
root        (hd0,0)
savedefault
makeactive
chainloader    +1
The commands found in menu.lst are the same ones used to boot an operating system from the command line.


These commands are:


title

The title command means the words on the line after it will be displayed as a boot option in your GRUB menu.  You can replace the words on that line with anything you like and your computer will still boot up okay. You'll just see a different message in your GRUB menu.



root   or rootnoverify

I'm not being rude, (LOL) .
The 'root' command tells GRUB what hard disk and partition it is supposed to find for you.
The numbers ands letters following the 'root' command describe your hard drive and partition location in GRUB notation, like '(hd0,0)' for example. That's H D zero zero.

There's no such thing as a 'drive C:\' to GRUB, or to Linux either for that matter.
You might as well pin a tail on a donkey as talk about drive C:\ because the term is completely devoid of meaning except to describe partitions relative to the particular Windows installation you're getting the description from. If you have several Windows installations in in primary partitions the same hard disk, every one of them will think that it is the one that's in 'drive C:\'.
Don't bother trying to describe your booting problem in a Linux forum by using Windows terms like drive letters. (LOL).
We need to know in Linuxese, like: '/dev/sda1', or in GRUB-speak, like: '(hd0,0)'.
Here's a link to a table for converting between Linux and GRUB notation, A Quick Guide to GRUB's Numbering System.

If you have your Windows partition formatted with the FAT32 file system, it is recognized by GRUB and GRUB can 'read' it, so you can use the 'root' command.
If you have your Windows partition formatted with the NTFS file system, you might still be able to use the 'root' command, but it has been known to cause error messages. The NTFS file system is not supported by GRUB. If you have NTFS, it's more proper to use the 'rootnoverify' command instead. That still tells GRUB which partition you want to find, but tells GRUB not to bother to looking at the file system.
GRUB really only needs the location of the boot sector anyway, which is the first sector of the partition, and that comes before the beginning of the file system controlled area.



savedefault

The 'savedefault' command is an important command for Windows users who are dual booting with Linux.
Windows is an operating system that has the annoying habit of wanting to be rebooted all the time, at every little hiccup. Gah! (I hate that!).
Anyway, if you must use Windows, you can ease your pain a little bit by editing the 'default' setting, which is up near the top of the /boot/grub/menu.lst file. Here's a link, default.
The presence of the 'savedefault' command here enables the setting 'saved' to be useful after the 'default' command, and that's a very good way to set your GRUB menu up for Windows users.
That way, GRUB will remember which operating system you booted last time and will automatically keep on booting the same one until told otherwise.



makeactive

Most Windows operating systems can't boot without the 'boot flag'. (I am told that some can).
The 'makeactive' command will try to set the 'boot flag' or 'active flag' in the partition table on the Windows partition that you want to boot.
The 'makeactive' command is mainly needed when there are two or Windows installations in primary  partitions in the same hard disk. If you only have one Windows installation, the 'makeactive' command is just there to make sure, but it really shouldn't be needed.
GRUB's 'makeactive' command only works for primary partitions, so if you have Windows in a logical partition, you need to delete the 'makeactive' command and set the 'boot flag' on the partition with a partition editor instead. If GRUB tries to do it, it will error out and fail to boot your operating system.



chainloader +1

GRUB's 'chainloader' command is special because it loads whichever boot sector the earlier 'root' command directed GRUB's attention to.
In simple words, GRUB boots the Windows boot loader by its boot sector, which then boots Windows.

Windows calls the first sector of it's partition a 'boot sector', and it cannot be booted (easily) without it . The boot sector contains Windows boot loader code which leads to the Windows boot loader, and thus hands over the task of booting to Windows's own boot loader.
GRUB doesn't actually boot Windows at all, it only acts as a 'boot manager', and relays the signal to boot up.


Trouble booting Windows

If you run into trouble booting Windows caused by GRUB and you need Windows in an emergency, you can use Super Grub Disk to help you boot Windows. Super Grub Disk Page.
If you run into trouble booting Windows and you need Windows in an emergency, and GRUB is booting your Windows boot loader but your Windows boot loader can't boot Windows, the best thing to do first is run a file system check. You can do that by booting your the Windows XP Recovery Console, and running CHKDSK /R.
If you still can't boot, Microsoft has a link that might help you. It tells you how to make your own Windows NTLDR boot floppy disk for Windows XP or earlier, with NTLDR, NTdetect.com, and an editable copy of boot.ini in it. How to create your own boot disk for Windows XP.
That will bypass both your MBR and boot sector, (in case those are damaged or misconfigured), and boot your Windows XP regardless of whether the three vital boot files are missing or corrupted.
So it's a very powerful tool!
Unfortunately, it's only 
good if your computer has a floppy drive though.
Here's a better link,
How to fix: NTLDR is missing, press any key to restart. - Tiney Empire, from that site you can download an NTLDR CD, floppy or USB files already made for you with a generic version of boot.ini that will boot your Windows almost no matter what!Vista users, here is another useful link: Windows Vista Recovery Disc Download - Neosmart.net, thanks lswest for the link. Thanks for the download to Computer Guru, of NeoSmart Technologies (the developer of EasyBCD). 

When you have time, take note of the error message you had and go to the Trouble Shooting section of this web page. There, you can look for your error message and hopefully learn how to fix it.
You can also go and get help at Ubuntu Web Forums, especially if your problem is somehow related to your having installed Ubuntu in your computer.


Entries that sometimes need to be corrected for grub to boot Windows.


 Chainloading Windows on a non-first hard disk

code:
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title        Windows 95/98/Me
root        (hd1,0)
savedefault
makeactive
map        (hd0) (hd1)
map        (hd1) (hd0)
chainloader    +1

GRUB's 'map' commands make it easier when you have Windows in a non-first hard disk, (the second, third, or fourth ... hard disk, and you want to boot Windows from GRUB without the need to go and edit boot.ini, or whatever configuration file your Windows system uses.

Since GRUB numbers everything by counting up from zero, (hd0) means your first hard disk and (hd1) is short for your second hard disk, (hd2) is for third hard disk, and so on ...
map   (hd0) (hd1)
map   (hd1) (hd0)
Use this combination for booting Windows if Windows is in your second hard disk.
map   (hd0) (hd2)
map   (hd2) (hd0)
This is the combination to use if you have Windows in a third hard disk.
map   (hd0) (hd3)
map   (hd3) (hd0)
If you want to boot a Windows installation in a fourth hard disk, you should use this combination of map commands.

The 'map' commands mean GRUB will confuse Windows with a quick 'pea and shell' game, and then tell Windows it's in the first hard disk. Windows will believe that and will behave itself and boot up properly then.

People wanting to dual boot with two (or more) hard disks should read this great thread and links provided from it on the subject in Ubuntu Web Forums.
 Thanks confused57 and lha,catlett and all participants for the information in these threads.
Dualboot Two Hard Drives

Here is is a post by lha about how to install Ubuntu with Windows in a computer with two hard disks without overwriting the IPL for the Windows boot loader in the first hard disk's MBR.
If you feel comfortable with reaching inside your computer and unplugging your hard disks physically and changing jumper settings around then possibly this idea would suit you.
This is a very good method if there is an extra hard disk available.
Particularly note post #6.



More than one
Windows on the same disk
title     Microsoft Windows 95
hide      (hd0,1)
unhide    (hd0,0) root      (hd0,0)
savedefault
makeactive
chainloader +1

title      Microsoft Windows 98SE
unhide     (hd0,1)
hide       (hd0,0) root       (hd0,1)
savedefault
makeactive
chainloader +1

GRUB's 'hide' and 'unhide' commands are useful for installing more than one Windows operating system in the same hard disk.
The hide commands don't work for Vista, but they work well for all other Windows: Windows XP, Windows 2000, WIndows 98, Windows 95, and so on.
Windows has a big problem with setting up a dual boot. If you have a Windows operating system already on your hard disk, and you add another Windows, the older installation will become the 'boot partition' for the newer installation. What that means is, the vital boot loader files, NTLDR, NTdetect.com, and boot.ini will be copied out of the new installation, and into the old installation.
The new installation will be installed in a logical partition instead of a primary partition.
Crazy!
That's called a 'Microsoft default dual boot' setup.
The first big problem with that is you we not warned about it.
Secondly, the vital boot loader files are in the older, and weaker, operating system.
Quite often people delete their old Windows 98 say for example, to install Ubuntu dual boot with Windows XP and XP won't boot. WHY? Because they weren't aware that they deleted their boot loader files when they deleted Windows 98!
The same thing still happens with Windows XP and Vista.
If you want to install more than one Windows in the same hard disk, do it the right way, use GRUB.
You use GRUB's 'hide' command to change your partition table so the new Windows won't recognize your previous, existing Window installation. The new installation will go in as per normal, and it will retain it's vital boot loader files.
Now when you want to boot your old Windows, you 'unhide' it, and 'hide' the new one.
When you want to boot your new Windows, you 'hide' your old one, and 'unhide the new installation.
This makes your two Windows installations independent of one another. That's a much smarter way to do things, the last thing you want is to have both of operating systems go at once because one was Dependant on the other to boot through.
There's a nice website explaining all this much better then I can, read this link, Understanding MultiBooting and Booting Windows from an Extended Partition.
The hide commands don't work for Vista, so you'll need to unplug the other hard disk(s) and install Vista by itself.

If you did make a mistake and delete your Microsoft 'boot partition', you might need a special boot CD or floppy disk to boot Windows with for now until you can fix the problem. Microsoft has a link that might help you, it tells you how to make your own Windows NTLDR boot floppy disk for Windows XP or earlier, with NTLDR, NTdetect.com, and an editable copy of boot.ini in it. How to create your own boot disk for Windows XP.
That will bypass both your MBR and boot sector, (in case those are damaged or misconfigured), and boot your Windows XP regardless of whether the three vital boot files are missing or corrupted.
So it's a very powerful tool!
Unfortunately, it's only 
good if your computer has a floppy drive though.
Here's a better link,
How to fix: NTLDR is missing, press any key to restart. - Tiney Empire, from that site you can download an NTLDR CD, floppy or USB files already made for you with a generic version of boot.ini that will boot your Windows almost no matter what!Vista users, here is another useful link: Windows Vista Recovery Disc Download - Neosmart.net, thanks lswest for the link. Thanks for the download to Computer Guru, of NeoSmart Technologies (the developer of EasyBCD). 
Consult the GNU GRUB manual or get help at Ubuntu Web Forums if you still have problems.


Operating System Entries for Multiple Booting Linux Systems
Here are some tips about the best way to use Ubuntu's GRUB menu for booting more Linux distributions in the same computer if you want to multiple-boot. A few people like to do that so they can test the latest pre-release version of Ubuntu or to try out other Linux distros just for fun.  
We can use the GRUB Menu from our Ubuntu operating systems to boot as many other Ubuntu or other Linux systems as we like.

If there are already other operating systems in the computer when Ubuntu is installed they will be automatically added to the GRUB menu of the new Ubuntu installation. That suits most people fine, and works well enough for a while.
The only problem is the type of commands Ubuntu uses in it's GRUB menu for booting other Linuxes, or even other Ubuntus. Ubuntu's GRUB boots other Linux operating systems by their specific kernels. When Ubuntu itself receives an updated kernel, it automagically updates it's own menu.lst file to boot the latest Ubuntu kernel.
When your other Ubuntu system or other Linux distro receives a kernel update though, these are not able to be updated automagically. You have be aware of this and remember to update your menu.lst in Ubuntu manually or you will be booting your other systems by their old obsolete kernels.

There are three possible solutions to this minor problem.

  1. chainloader boot entry  
  2. symlink boot entry
  3. configfile boot entry


1. Chainloader boot entry

GRUB's 'chainloader' command is the King of multi-booting commands.
The chainloader command is used to boot another boot loader. The chainloader command hands over control to the other other operating system's boot loader at the other operating system's partition boot sector.
The other boot loader can then boot whatever operating system it belongs to, (or any others listed in it's menu). Since the other boot loader's menu is kept up to date by it's own operating system, it should always automatically boot the most recent kernel.

In order for this to work, the IPL or stage1 file for a boot loader needs to be installed in the boot sector of the other operating system's partition. Normally, Linux Operating Systems don't have anything installed it their boot sectors unless we install it there ourselves.
  • If the other Linux distro uses GRUB, you can install GRUB to it's partition boot sector at installation time, or after installation with some GRUB commands or with Super Grub Disc, Re-install GRUB with a GRUB shell.
  • We can chainload another Linux operating system with LiLo if the IPL for LiLo is installed in the first sector of the / (root) partition. If the other Linux distro doesn't have the IPL for LiLo installed in its first sector then you might need to Run Liloconfig first to fix that.
  • We can always chainload Windows without doing anything special, because it has its boot loader's IPL in the boot sector by default.
To speed up booting, you can turn down the other boot loader's timer and hide it's GRUB menu if you like. Or, the opposite, take advantage of the opportunity to display another nice GRUB splashimage instead.

Here's an example of a typical chainloader booting command,
code:
title        Ubuntu Karmic Koala
root        (hd0,5)
chainloader    +1
Where: Karmic Koala is a Linux operating system on partition number 6, and it has GRUB or LiLo or some other boot loader installed in the first sector of the partition.

It is also possible to chainload the MBR in another (non-first) hard disk or even in an external USB drive or a pen drive, as long as there is some bootloader or boot manager with its IPL installed to the MBR you plan to chainload.
code:
title        Chainload Third Hard Disk's MBR
root        (hd2)
chainloader    +1


Here's an extreme example of the use of GRUB's chainloader command, by saikee, a moderator in JustLinux Web Forums, A grub menu booting 100+ systems of Dos, Windows, Linux, BSD and Solaris.
Also by saikee, How to install and boot 145 operating systems in a PC. - JustLinux Web Forums.
I highly recommend the above links for anyone interested in multi booting.



2. Symlink boot entry

A third method that works very well would be to make an boot entry that will boot the other Linux by it's symlinks, and not refer to it's kernel or ramdisk specifically. Almost all Linux operating systems have symlinks to the kernel and initrd.img files in the root of their filesystems. A few might not. Obviously you will only be able to use this method if there are such symlinks provided, or if you can make them yourself.
The advantage of symlink booting is that it is very reliable. Even if there is a problem with the GRUB menu in the other operating system and you cannot boot that OS any other way, symlink booting will almost always work.
Here's an example of a symlink boot entry,
code:
title        Ubuntu Edgy Eft
root         (hd0,5)
kernel       /vmlinuz root=/dev/hda6 ro quiet splash
initrd       /initrd.img
boot
Where: Edgy Eft is a Linux operating system on partition number 6.

Can you see that I have altered the 'kernel' line to refer simply to to /vmlinuz, which is a symlink, rather than a specific kernel like '/boot/vmlinuz-2.6.15-23-386'?
Also, the initrd line has been simplified to '/initrd.img' rather than a specific file like '/boot/initrd.img-2.6.15-23-386'.
The symlinks always point to the most up to date kernel and initrd.img files, so there is no need to worry about updating your GRUB menu after a kernel update in your other system when you are using symlink booting.



3.
Configfile Boot Entry
The 'configfile' command can be used sometimes, but only when the other system you want to boot uses the same version of GRUB boot loader as the one you're currently using.
Some other Linux Distros, such as OpenSuse and Linux Mint and a few others, use modified versions of GRUB with 'gfxboot' (fancy graphics) feature, which might not be compatible with our GRUB, I'm not sure.
On the other hand, Ubuntu's GRUB is has the more advanced uuid support feature. Some other operating systems will choke on the uuid command, because their GRUB might not be updated with the ability to handle that command yet.
And then there are a few people already experimenting with GRUB2, even though it's nowhere near ready yet, (at least not at the time of writing this).
I used to like the configfile command best, but now I'm forced to derate it to the third place in my choice of multi-booting commands.

The configfile command will tell GRUB to find the other Linux's menu.lst or grub.conf and run the commands it contains to boot any operating system with.
Since that will be maintained by the OS it belongs to, it should always be up to date.
An advantage of using the configfile command is, all other operating systems listed in the other GRUB menu can be subsequently booted. You can use as many different GRUB menus as you like.
The stage 2 file that will be used will be from the first operating system's GRUB.

Following is an example.
code:
title        Ubuntu Edgy Eft
configfile   (hd0,5)/boot/grub/menu.lst
Where: Edgy Eft is a Linux operating system on partition number 6.
Where: /boot/grub/menu.lst is the exact file path and filename of the configfile for GRUB to load. You may need to check what directory path other distros use for keeping their grub menu.lst in, it could be /GRUB , for example, (no /boot folder, and /GRUB with capital letters). Also, the filename might not always be 'menu.lst, it could be something else, like 'grub.config' or the like. You will need to find out somehow, and alter the details following your configfile command accordingly.

To speed up booting, you can turn down it's timer and hide it's GRUB menu if you like. Or, the opposite, take advantage of the opportunity to display another nice GRUB splashimage instead.

You can have a lot of fun with the configfile command and make entries in the other GRUB menus that refer back to the first GRUB menu. You can also make more menu.lst files of your own and call them 'menu.2nd' or some other name and use them for experimenting with other GRUB commands, for example different splashimages or pretty colors.

NOTE: Sometimes when we try to use an older version of GRUB to boot using the menu.lst of a more modern version of GRUB, the older GRUB can't understand the new GRUB's commands. For example, WinGrub can't handle Ubuntu Grub's 'savedefault' commands, and give it boots to grub error 26: Disk read error if it encounters the 'savedefault command. WinGRUB Page.
GRUB from Ubuntu versions earlier than Intrepid Ibex can't cope with the uuid line in Ubuntu's booting stanza, and give Grub error 15 if the configfile command is used to boot with a newer menu.lst from an older GRUB.  Try using the chainloader command instead.

#############################################
Additional GRUB Menu commands for fun, security and convenience.


color
_
title     Pretty colors
color   cyan/blue white/blue

title     Matrix
color   green/black blink-light-green/green

title      Green and Gold
color    black/green yellow/black

title      Leonardo
color    black/magenta white/red
This is just for fun.
We can change the colors from a title in our GRUB menus to some other color if we use a title command to give our color scheme a name.  For more colr ideas, See: 'Add some color to your GRUB menu'.

Colors won't work if we already have a splashimage enabled because that over rides the color command and puts GRUB in graphics mode.



cat and pause
title      Your Boot Message Title Here
cat        (hd0,1)/boot/grub/bootmessage
pause      End of Boot Message, Press any key.

GRUB's 'cat' command has nothing to do with chasing mice, and pause doesn't mean cat's feet.
The 'cat' command is probably named after Linux's 'cat' command. According to my information, the word 'cat' in this instance is short for 'concatenate', which means something like hitching things up in a series, like making a train or a chain, or a string of beads. I guess they mean gathering up bits and bytes that are scattered around the hard disk and assembling those into a file that we can read in the computer screen.

The cat command is for displaying a message in the computer screen.
It can be inserted anywhere in your menu.lst file, as long as it's somewhere under a line that begins with the word 'title'. You can insert a message in any operating system entry or anywhere you like.
In this example, the message has it's own title, just for demostration purposes.

The 'pause' command follows the 'cat' command to make the message stop on the screen long enough to read it. Any words or characters you type after the pause command will also be displayed on the computer screen. When you press any key you'll be back in your GRUB Menu again.
You can use the 'pause' command by itself if your message is 80 characters or less, (short enough to fit in one line).

Following the word 'cat', we need to put in the path and file name to whatever file we want to be diplayed on the screen. It can be an 'absolute path name' to a file, or a 'block list'.
An 'absolute path name is like: (hd0,1)/boot/grub/bootmessage
A 'block list' is the location of a file in sectors from the beginning of a hard drive or a partition. (More about that later).
GRUB can see any file in any hard disk, and it doesn't even need to be inside a formatted partition, GRUB can even read raw areas of the hard disk, such as the MBR, the first track of the hard disk, and boot sectors.

In this example, I have a text file that I made with a message on it, which I coped to my /boot/grub/ directory in the second partition of my first hard disk.

Below is an example boot message,
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0                                                                             0
0                                                                             0
0           THIS IS YOUR DEDICATED GRUB IN HARD DISK ZERO                     0
0                                                                             0
0         YOU CAN BOOT OPERATING SYSTEMS IN YOUR FIRST HARD DISK              0
0                                                                             0
0         OR BOOT THE MBR OF SOME OTHER HARD DISK OR A USB STICK              0
0                                                                             0
0                                                                             0
0                            HAVE A NICE DAY                                  0
0                                                                             0
0                                                                             0
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000

You can also decorate the message with symbols arranged into various patterns, or even make a rough drawing.

The only important thing about the message is, it will be limited to 80 characters per line and the maximum number of lines will be 23. You can copy mine (above) and use it for a template if you like.

You can use more cat and pause commands if you need a longer message.

You can have fun with the cat and pause commands and I'm sure you will be able to come up with all kinds of novel ideas is soon as you play with it a bit and get the hang of it.



cmp
title     Windows Security Check
root      (hd0)
cmp       63+1 24306344+1
'cmp' is short for 'compare'. We can use this command to compare two files and find out whether they're the same or not.

Windows viruses often write to the Windows boot sector so the virus will load at startup and take over control of the operating system before the antivirus program has a chance to wake up.
There's a backup of the boot sector in the sixth sector of a Windows partition formatted with the FAT file system. In the NTFS file system, the backup bootsector is in the last sector of the partition.
We can find out what sectors are the first and last sectors with 'sudo fdisk -lu' command in Ubuntu.
The boot sector is almost always number 63 because the first partition never starts until the end of the first track of the hard disk.
If you compare your boot sector with the backup and find they are both identical then that's fine.
If you do the same thing another day and there's a difference, and you can't remember doing anything to your boot sector yourself, beware!

The numbers after the word 'cmp' in this example, tell GRUB to start counting from (hd0), which is the MBR of the first hard disk. The MBR is in sector zero.
It counts to 63 then reads one sector. Then, (starting from zero again), it counts up to 24306344 and reads one sector and compares both sectors.
If they match, nothing happens.
If there's any difference, GRUB will display what the differences are. The output is unintelligible human beings, but it will certainly be enough make you aware that something might be wrong.


title     Linux Intrusion Detection
cmp       (hd0,1)/etc/passwd (hd1,1)/etc/passwd.bak
In this example I have a file called /etc/passwd, which I copied and backed up in another partition when the operating system was newly installed. By comparing these two files, I should be able to tell if an intruder has been interfering with my original passwords file.
There's always the chance that files could be changed during an update though.
 
If you're serious about security, you probably have Ubuntu installed in an encrypted file system and therefore you'd have a separate /boot partition. In that case you can't use the cmp command from the GRUB menu, but you would be able to from a GRUB Shell, after the operating system has booted.
The kernel will be in the /boot partition, so GRUB would be able to compare your kernel with a backup of itself in some other partition. I haven't finished testing that yet. More experimening will be needed before I would say that will work for sure.



reboot and halt
title      Reboot
reboot

title      HALT
halt
The reboot command reboots your computer and the halt command will shut it down.
I find it convenient to have those two commands at the bottom of my menu.lst file.


A Quick Guide to GRUB's Numbering System
Description in EnglishGRUB's naming convention


hard drive one
hard drive two
hard drive three
hard drive four
floppy disk drive
GRUB begins counting drives at zero

(hd0) 
(hd1)
(hd2)
(hd3)
... and so on.
(fd0)

GRUB 's naming convention requires the letters and numbers to be enclosed in brackets 


first partition
second partition
third partition
fourth partition
GRUB begins counting partitions at zero

0              
1              

2
3
... and so on

for putting these together see below,  
Description in EnglishLinux termsGRUB terminology
hard drive one, partition one/dev/sda1(hd0,0)
hard drive one, partition two/dev/sda2(hd0,1)
hard drive one, partition three/dev/sda3(hd0,2)
hard drive one, partition four/dev/sda4(hd0,3)
hard drive one, partition five/dev/sda5(hd0,4)
hard drive one, partition six/dev/sda6(hd0,5)
hard drive one, partition seven/dev/sda7(hd0,6)
hard drive one, partition eight/dev/sda8(hd0,7)
hard drive two, partition one/dev/sdb1(hd1,0)
hard drive two, partition two/dev/sdb2(hd1,1)
hard drive two, partition three/dev/sdb3(hd1,2)
hard drive two, partition four/dev/sdb4(hd1,3)
hard drive three, partition one/dev/sdc1(hd2,0)
hard drive four, partition one/dev/sdd1(hd2,0)
hard drive five, partition one/dev/sde1(hd2,0)

 The GNU GRUB manual contains a lot more information than can be put on this page.

Getting Help
If you aren't sure how to edit your GRUB menu.lst to get an operating system to boot, you can usually get help from other users at Ubuntu forums.

You should provide a copy of the bottom section of your menu.lst file, (all the operating system entries), along with a copy of the output from sudo fdisk -l or sudo fdisk -lu to enable someone to help you.

herman@red:~$ sudo fdisk -lu
Password:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes

  Device  Boot      Start        End       Blocks   Id   System
/dev/hda1   *   119154105   149597279    15221587+   c   W95 FAT32 (LBA)
/dev/hda2              63    86028074    43014006   83   Linux
/dev/hda3        86028075   119154104    16563015    5   Extended
/dev/hda4       149597280   154529234     2465977+  83   Linux
/dev/hda5       117194238   119154104      979933+  82   Linux swap / Solaris
/dev/hda6        86028201   115860779    14916289+  83   Linux
/dev/hda7       115860843   117194174      666666   82   Linux swap / Solaris

Partition table entries are not in disk order
herman@red:~$


If you are a person who likes to be a little independent and doesn't mind learning how to do things for yourself, try booting from GRUB's command line and experiment there until you find out which commands will work. GRUB's command line is another great feature of GRUB that sets it well above other boot loaders, GRUB is intelligent! GRUB is practically an operating system by itself! (I have added information about that further down on this web-site.)

The output from 'sudo blkid' might also be useful,
herman@amd64hh:~$ sudo blkid
[sudo] password for herman:
/dev/sdc1: LABEL="GUTSY" UUID="79a5a0ce-499e-4738-9d9b-60590f1b83fe" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc5: UUID="6e9774c7-6881-4e7d-8bbd-38087fc76dfb" LABEL="DEBIAN" TYPE="reiserfs"
/dev/sdc6: TYPE="swap" UUID="4e282580-9d44-408c-1a55-84937b04c643"
/dev/sdd1: LABEL="DATA" UUID="1a206651-0db0-4b89-b468-608dbe379026" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc7: UUID="739f6b17-c155-4bbe-93f4-5af52980694c" LABEL="GRUB" TYPE="reiserfs"
/dev/sdb1: LABEL="HARDY" UUID="6178d387-9ab5-4f23-a56d-8e0cba0addc3" TYPE="ext3" SEC_TYPE="ext2"
/dev/sdc2: LABEL="FEISTY" UUID="9e9e5184-127f-45d2-bf4a-e6f0a112f180" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc4: LABEL="OPENSUSE" UUID="5b326dec-325e-416c-8bd3-5e8523bf259c" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb3: LABEL="INTREPID" UUID="4d4939f2-de30-438a-896f-af6a77406eea" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb5: LABEL="DATA_II" UUID="e81395cd-43bd-4a17-9052-6aa4ad7f9a4d" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb6: TYPE="swap" UUID="88a3c05c-f7d2-4f35-abf6-5e8a9f00a684"
/dev/sda1: UUID="8CD0A946D0A936FC" TYPE="ntfs"
/dev/sda2: UUID="A8ACA546ACA50FBC" LABEL="WINDOWS7" TYPE="ntfs"
/dev/sda3: UUID="a1f420b2-0596-4ae0-a133-ec03ae212241" TYPE="ext4" LABEL="JAUNTY"
/dev/sda5: LABEL="KARMIC" UUID="7cadf97b-d0b9-416d-84a2-fc1027d2b6ac" TYPE="ext4"
/dev/sde1: UUID="a678a230-d764-46f5-b9f3-55be5c1fd207" LABEL="WEBSITE" TYPE="reiserfs"

The Grub manual contains a lot more information than can be put on this page.

Editing GRUB's device.map

Here is what the GNU GRUB Manual has to say on the device.map file, 15.3 The map between BIOS drives and OS devices. That was written quite a long time ago.

Nowadays we have the uuid command in GRUB and use UUID= (file system Universally Unique IDentifiers) to direct GRUB to our /boot and / (root) partitions. Hardly anyone gets GRUB error 17 anymore. See Operating System Entries for more on UUID numbers.

GRUB Error 17 used to occur frequently when people's computers had more than one hard disk, especially if one or some were SATA and others were IDE. Not all BIOSes sent the same signal to GRUB to tell GRUB what the hard disk numbering should be, and sometimes GRUB used to get it wrong.

Some people used to think that editing our /boot/grub/device,map files might be a way of curing GRUB Error 17. Apparently that worked in some older versions of GRUB, or so I'm told. This didn't work in Ubuntu, at least not for me when I tested it.
It doesn't seem to me as if GRUB pays any attention to the device.map file at all during booting.
As far as I have been able to determine, it looks like it would be better to try Changing the hard Disk Boot Priority  instead.

NavyRSt, in this thread, HOW-TO install bootloader from Ubuntu, just  changed the hard Disk Boot Priority and says that worked fine!

The only purpose I can think of for the device.map file was to show what order GRUB thought our hard drives were numbered in.
        (Obsolete information below here)         (Obsolete information below here)
Running grub-install --recheck after adding or removing a hard drive
Some modern computer case designs make it easy and quick to add and remove or swap hard drives.
When grub is getting the device.map right in our computers, which will probably be the case for most of us, and  after removing or exchanging hard drives, it is easier to run a command something like 'sudo grub-install --recheck /dev/hda2', which will cause GRUB to re-check our devices (hard disks) and update our device.map file and re-install GRUB.

For example, (after you've managed to boot with either GRUB's Command Line Interface or with Super Grub Disk),
Code:

After editing your device.map file, you need to re-install GRUB in a special way for the changes to be effective.
First, open a GRUB shell with the device.map file specified in the grub command.
For example:
herman@amdxz:~$ grub --device-map=/boot/grub/device.map

Then we install GRUB,
herman@amdxz:~$ sudo grub

grub> root (hd0,0)

grub> setup (hd0)

grub> quit

herman@amdxz:~$ sudo grub-install --recheck /dev/hda2
Where: /dev/hda2 is my Ubuntu partition, (this will install the IPL for GRUB to the first sector at the same time as it fixes the device.map, or you can install GRUB to any MBR you like instead).

Probing devices to guess BIOS drives. This may take a long time.
It will probably take a few minutes...

...and then,
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'.

(fd0)   /dev/fd0
(hd0)   /dev/hda
(hd1)   /dev/hdb
(hd2)   /dev/sda
(hd3)   /dev/sdb
(hd4)   /dev/sdc

This command will reverse the changes made when editing device.map by hand and re-install GRUB.
It gives you GRUB's own natural device.map again.
If it's not correct then we might need to edit it by hand and re-run grub-install, as the message already tells us.




 
GRUB's Command Line Interface (CLI)

fig2grub
fig 2 GRUB
This is GRUB's 'Command Line Interface', you get this by pressing your 'c' key from the GRUB menu.
You can return to the GRUB menu by pressing your 'Esc' key.  Another way to return to the GRUB menu is to type the command 'reboot' after the GRUB prompt to reboot the computer.
 
The command line interface is not necessary to use everyday, but can be extremely useful for getting an operating system to boot which GRUB isn't automatically set up for. You can experiment with commands at the command line interface until you succeed in getting it to boot. Once you find the right commands then you can add those to your /boot/grub/menu.lst file to make it boot from the GRUB menu after that. 
 
The GNU GRUB manual contains a complete list of commands you can use.

Also be sure to read this great website: Grub From the Ground Up by Steve Litt.
Especially check out the part about: Having Grub Do Your Research For You.
My article here is based on information I originally learned on Steve Litt's web page, and the original work by the Steve Litt contains a lot more explanation and information than I have here.
The only thing I'm trying to do here is make a quick how-to for it that's more 'Ubuntu-specific'.
There are a few other small difference that come down to personal preferences.
I would like to encourage everyone to go and explore Steve Litt's site.




This Section's Menu
Booting Operating Systems from Command Line GRUB
How To Boot Linux from GRUB's CLI (Ubuntu)There are three different ways we can use GRUB to boot Linux:
How To boot Windows using GRUB's 'CLI






How to use GRUB's Command Line - to investigate a computer
GRUB is almost a miniature operating on it's own, it can take quite a few commands and perform some useful tricks. It's well worth a little of anyone's time to learn how to work with GRUB at the command line.
We'll see how to boot operating systems in a few minutes. First, here are a few useful tricks to help you learn to use GRUB interactively if your computer's BIOS supports that.  This is how to use GRUB to take a look around inside a computer.


Tab completion is a very useful feature of GRUB.  In the example shown below I want to use Tab completion to find out what hard disks and partitions ane in my computer,
grub>  root (hd_
There are some numbers that are supposed to follow '(hd' that we may not already know, so after we type: 'root (hd' we press our 'Tab' key. We use 'Tab' completion to allow GRUB to suggest some possibilities.

grub> root (hd
 Possible disks are:  hd0 hd1
Okay, I know my Linux partition in in my first hard disk, so I typed '0,' (zero, comma) in after '(hd' and pressed 'Tab again for a list of partitions,
grub> root (hd0,
 Possible partitions are:
   Partition num: 0,  Filesystem type is fat, partition type 0xc
   Partition num: 1,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 3,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 4,  Filesystem type unknown, partition type 0x82
These are a list of partitions in my first hard disk. I want to choose one with a Linux kernel in it that I will be booting. It will likely be one of the partitions with the ext2fs file system, from here I can make a good guess.



Find Hard Disks
Here's another way to get GRUB to list all hard disks and partitions and give information on what filesystems are in a computer,
grub>  geometry (hd_
'Tab completion' is a very handy feature in GRUB's Command Line Interface. Make sure you use it as much as you can! In this example, I have typed the command 'geometry', and the first part only of a GRUB designation for a hard disk, without the number that normally belongs at the end of it, and press my tab key.

grub>  geometry (hd  Possible disks are: hd0 hd1
After pressing my 'Tab' key with the disk designation half typed, I get a list of all the hard disks currently in use by the machine.

Find PartitionsNow I want to find out what partitions are in the first hard disk,
grub>  geometry (hd0)
I completed the rest of the command and then pressed 'Enter' to see what partitions GRUB can detect on the first hard disk.
grub>  geometry (hd0)
drive 0x80: C/H/S = 1023/255/63, The number of sectors = 156301488, LBA
     Partition num: 0, Filesystem type is fat, partition type 0x1b
     Partition num: 1, Filesystem type is ext2fs, partition type 0x83
     Partition num: 3, Filesystem type unknown, partition type 0x7
     Partition num: 4, Filesystem type unknown, partition type 0x82
     Partition num: 5, Filesystem type is ext2fs, partition type 0x83

     Partition num: 6, Filesystem type is ext2fs, partition type 0x83
     Partition num: 7, Filesystem type is ext2fs, partition type 0x83
Okay, those are my partitions on the first hard disk, now I want to find out what partitions are on the second hard disk.

grub>  geometry (hd1)  drive 0x81: C/H/S = 1023/255/63, The number of sectors = 58605120, LBA
     Partition num: 2, Filesystem type is fat, partition type 0xb
     Partition num: 3, Filesystem type is ext2fs, partition type 0x83     

Now I know what partitions are in second hard disk.
I use these commands often to determine one hard disk from another before installing GRUB to a hard disk's MBR, to make sure I install the right GRUB to the right MBR.

NOTE: In Ubuntu Intrepid Ibex and later, there is an added 'uuid' command which can also do this job.
Just type 'uuid' (without the inverted commas), and press your 'enter' key.
grub> uuid
(hd0,0) ext3 79a5a0ce-499e-4738-9d9b-60590f1b83fe
(hd0,1) ext3 6178d387-9ab5-4f23-a56d-8e0cba0addc3
(hd0,3) reiserfs 4d4939f2-de30-438a-896f-af6a77406eea





Find out which partitions contain a Linux kernel
To find more information we can use the 'find' command, for example:
grub>  find /vmlinuz

The feedback from the above command should give you one or more answers like:
grub>  find /vmlinuz (hd0,1) (hd0,5) (hd0,6)
or something similar. These answers are all partitions that contain a Linux kernel.
Well, really, to be accurate, they are partitions which contain a symlink to a Linux kernel.
These partitions could be /boot partitions if an installation has separate /boot  and / (root) partitions.



Find out which partition is your '/' or 'root' partition
grub>  find /sbin/init

The results from the above command might appear as shown below,
grub>  find /sbin/init (hd0,1) (hd0,5) (hd0,6) (hd0,7)


There are ways to have GRUB find out even more interesting information for us if it might help. We can open plain text files in any of those partitions we may be interested in with the 'cat' command. For a few examples,
grub> cat (hd0,1)/etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"
The /etc/lsb-release file in Ubuntu will tell me which version of Ubuntu I'm looking at, and I can easily take a peek at that file with the 'cat' command. (As shown above).

grub> cat (hd0,5)/etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.04
DISTRIB_CODENAME=hardy
DISTRIB_DESCRIPTION="Ubuntu 8.04.1"

 
grub>  cat (hd0,7)/boot/grub/menu.lst
The installation's menu.lst file is certain to contain information useful to know for booting the machine's operating systems.
and,
grub>  cat (hd0,7)/etc/fstab
The /etc/fstab file usually contains good information that might be useful to know for booting purposes

and also:
grub>  cat (hd0,7)/boot/grub/device.map
The device.map file might occasionally be interesting to be able to see.

By the time you have tried out some of those extra commands you will be getting the idea that you can find out almost anything about any computer with GRUB's CLI.
 
That's probably all the information we need for getting GRUB to boot any Linux system.




How To Boot Linux from GRUB's CLI (Ubuntu)
First method: 'direct boot'.
This procedure is the most reliable method for booting any Linux operating system that is bootable.
We directly boot the Linux kernel and initrd.img, or boot then via their symlinks in the root of the file system. This bypasses the MBR, menu.lst or a non functional boot loader.
  • This method bypasses the MBR and the menu.lst file.
  • You can use this method to boot the operating system to repair the boot loader.
  • An operating system can even be booted in this way when it has no boot loader installed at all. This should boot any Linux operating system as long as the system has at least a Linux kernel, and for most Linuxes, an initrd.img is also needed.
The only disadvantage of using this method is just that it takes a minute or two.

A GRUB entry or a series of commands to boot from a GRUB command line includes the following four essential commands:
root (hdx,yAfter the 'root' command,  a partition that contains a Linux kernel needs to be specified.
kernel /vmlinuz root=/dev/hd?,?After the 'kernel' command, the path and name of a kernel or to a symlink to a kernel is needed.
After the word 'root' , a partition containing /sbin/init is required.
initrd /initrd.imgAfter the 'initrd' command, the path and name of a initrd.img or to a symlink to an initrd.img is needed.
The file path and file name for the initrd.img goes here. 
boot(last but not least, the 'boot' command)
If you know at least those those five minimum basic details required to boot the operating system you should be able to boot it right away.
If you  don't know those things, don't worry, because GRUB has commands you can use to find out.
 
1) The first command is 'root (hdx,y)' to set GRUB's root device to the partition that contains a Linux kernel. Our kernel is normally found in our /boot directory. This is usually the same partition as the rest of our operating system, but if we made a separate /boot partition, our kernel will be there instead.
For example,
grub>  root (hd0,1)
Where (hd0,1) is the partition my kernel is in. How to use GRUB to find out if you aren't sure

and in some computers Grub might reply by identifying the file system and partition type:
grub>  root (hd0,1)            Filesystem type is ext2fs, partition type 0x83

2) The second command is
'kernel /vmlinuz' to load the kernel image, and 'root=/dev/hda2' to specify the '/' (root partition, which contains the matching /sbin/init file. How to use GRUB to find out if you aren't sure
grub>  kernel /vmlinuz root=/dev/hda2
(Presuming /dev/hda2 is the partition of my root file system (containing /sbin/init)

grub>  kernel /vmlinuz root=/dev/hda2
           [Linux-bzImage, setup=0x1c00, size=0x157812]
And GRUB may return some feedback about the Linux kernel it has found.

3)The third command will be 'initrd'
grub> initrd /initrd.img

grub> initrd /initrd.img
          [Linux-initrd @ 0x1f96a000, 0x675773e bytes]
And GRUB should return some feedback about the initrd.img it has found.

4)The fourth and final command is 'boot',
grub> boot_

grub> boot_           uncompressing linux... OK, booting the kernel
and your Linux operating system should begin to boot!  
Right after this we  should see a lot of white print appearing and scrolling up our monitor too quickly to be read, it's always very exciting! After a minute or so we should see our Linux operating system's login screen.


Second method, 'configfile boot' This series of commands brings up the GRUB menu of an operating system that has GRUB installed in it by having the GRUB you are using read it's /boot/grub/menu.lst file.
This is an quick and easy way to boot.
It will work as long as the entries in the menu.lst file are correct.
You can easily use this to boot any other operating system that happens to have a valid entry in that menu as well, so this can be a handy trick to know about.

First, use GRUB's 'find' command to look for a menu.lst file in the computer,
grub>  find /boot/grub/menu.lst
This command is to get GRUB to find out which partitions have a /boot/grub/menu.lst file.

grub>  find /boot/grub/menu.lst (hd0,1) (hd0,5) (hd0,6) (hd0,7)

GRUB tells me I have four partitions with a /boot/grub/menu.lst file that I can use for booting with.
grub>  configfile (hd0,1)/boot/grub/menu.lst
This command will bring up my GRUB menu from a Ubuntu or other Linux operating system regardless of whether or not GRUB is installed to MBR, I can boot my Ubuntu and I can boot any other operating system listed on that menu as well.

When we're using the 'configfile method' for booting with GRUB, it's interesting to know that the GRUB we're using does not hand over control to the operating system's GRUB.
So if you're using an older GRUB version such as the one used in GRUB for DOS (WinGRUB), it might not be able to handle some of the new commands that might be found in the menu.lst file for GRUB version 0.97, like the 'savedefault' command. WinGRUB Page.
Of course, it's a waste of time to even bother thinking about trying to boot some other boot loader's configuration file with a configfile command. That would just be stupid. ...well, unless you know some special circumstances.


Third method, 'chainloader boot'.
GRUB's 'chain loader' command is special because it hands over the job of booting to another boot loader.
The other boot loader can be another GRUB, or it can be LiLo, Syslinux, or whatever boot loader is installed inside the operating system to be booted.

Normally, the chainloader command is used to boot another boot loader via the other boot loader's code installed in a 'boot sector'. (The first sector of that operating system's partition).
Linux doesn't necessarily need to use it's first sector for booting. Installing boot loader code there is optional.
This method requires that your have a boot loader; GRUB, LiLo, Syslinux or some other boot loader installed to the first sector of your partition, otherwise nothing will happen, you'll get Grub error 13.

It's also possible to point the chainloader command at the MBR of any hard disk, or a USB flash memory device. If it has code for a boot loader installed in it, GRUB's chainloader command will boot it.

For this example, I'll pretend we already know what hard disk and partition we want to boot.
If you don't know what hard disk or partition you want to boot, go back to How to use GRUB's Command Line - to investigate a computer, and start there, then come back here when you know.

grub>  root (hd0,5)  Filesystem is ext2fs, partition type is 0x83
This 'root' command is for telling GRUB which partition we want to boot.

grub>  chainloader +1
Here's the chainloader command. This points GRUB to the operating system's first sector, also called the boot sector, where control is passed on to some other boot loader.

grub>  boot
There's the 'boot' command, and the operating system's boot loader should take over and boot the operating system up.

 ...but what do we do if we get: Error 13?

 If the operating system has GRUB files in it, we can use the install the operating system's GRUB to the first sector of the operating system's partition and then chainload it.
The 'find' command is a test to remind me what partitions contain GRUB files.
grub>  find /boot/grub/stage1 (hd0,1) (hd0,5) (hd0,6) (hd0,7)
Even though GRUB may be installed in the operating system, we may need to install GRUB's IPL or 'stage1' to the first sector of the partition before we can chainload it.

Okay, I decided I want to install the GRUB in (hd0,5) somewhere,
grub>  root (hd0,5)  Filesystem is ext2fs, partition type is 0x83
This 'root' command is tell GRUB which partition has GRUB in it that we want to install.
If (hd0,6 has Kubuntu in it and we did 'root (hd0,6), that would install Kubuntu's GRUB somewhere.
If (hd0,5) has Ubuntu in it and we do 'root (hd0,5), that will mean we're installing Ubuntu's GRUB somewhere.
grub>  setup (hd0,5)
Now we have specified the partition (hd0,5), so GRUB will be installed to the first sector of (hd0,5).

Checking if "/boot/grub/stage1" exists...yes
 Checking if "/boot/grub/stage2" exists...yes
 Checking if "/boot/grub/e2fs_stage1_5" exists...yes
 Running "embed /boot/grub/embed/e2fs_stage1_5 (hd0,5)"...failed (this is not fatal)
 Running "embed /boot/grub/embed/e2fs_stage1_5 (hd0,5)"...failed (this is not fatal)  
Running "install /boot/grub/stage1 d (hd0,5) /boot/grub/stage2 p /boot/grub/menu.lst"... succeeded Done.
This is just an example of the sort of feedback to expect.
It's telling us it has failed to install stage1_5 but don't worry about it. It says that when it installs to most partitions because there's no place for the stage1_5 file to go.
The stage1_5 file is instalable in a ReiserFS partition or when we install to the MBR of a hard disk.
 
grub>  chainloader +1
Here's the chainloader command. This points GRUB to the operating system's first sector, also called the boot sector, where control is passed on to some other boot loader.

grub>  boot
There's the 'boot' command, (again), and the operating system's boot loader should take over and boot the operating system up this time.




How To boot Windows using GRUB's 'CLI': Sometimes after a new install when Windows won't boot this might come in handy. Sometimes menu.lst gets written with an error in it. I don't know how that can be caused.
grub>  find /boot.ini  (hd0,0)
GRUB's 'find' command will only work for Windows with the FAT32 file system, it doesn't work for NTFS.


Chainloading Windows the simple way,
for a single Windows installed on a first hard disk,
grub>  rootnoverify (hd0,0)
1) Set GRUB's root device to the partition by the command 'root (hd0,0)', or 'rootnoverify (hd0,0)'.
It is most common to expect Windows to be allocated the partition number 1, and remain that way, even if you 'move' it with partitioning software to the other end of your disk.
If you aren't sure, it won't hurt anything if you try guessing it, and, if you still have trouble, an easy way to find out where all your partition are is to boot up a  GParted LiveCD and take a peek.

Use the command 'root' if you are booting a Windows version with the FAT32 filesystem such as Windows 95, Windows 98, Windows ME, or Windows XP Home Edition.

Use the command 'rootnoverify if you aren't sure, or if you are booting a Windows system that has the NTFS filesystem. Windows XP Home Edition, Windows XP Professional, WIndows NT and Windows 2000.
grub>  makeactive
2) GRUB's 'makeactive' command sets the 'boot flag'  to mark the partition as 'active'.

grub>  chainloader +1
3) Point GRUB at the boot sector loader with the command 'chainloader +1'

grub>  boot_
4)Boot Windows with 'boot', and Windows bootloader NTLDR should boot Windows.

If Windows is allocated a different partition number, either accidentally or on purpose, you may need to edit boot.ini with the changes and it will usually boot up fine.

TIP: You should make your own Windows XP boot floppy disk with ntldr, ntdetect, and boot.ini on it if you have Windows XP and you are playing around with partitioning software. That way you can always access boot.ini on the floppy disk and edit that if required, and boot Windows when you cannot access your regular boot.ini because you can't boot Windows because you can't edit boot.ini because...  (especially if you have the NTFS filesystem). How to make your own Windows Xp boot floppy, Click Here. (Microsoft).

EVEN BETTER TIP: Go to http://tinyempire.com/notes/ntldr by Miles Comer and read 'How to fix: NTLDR is missing, press any key to restart', and download yourself a copy of Miles Comer's Super NTLDR Disk, burn one of those to a CD, or make a floppy disk out of it. Read that web page by Miles Comer, that should help you boot Windows sooner or later if you keep trying.



Chainloading Windows using map commands
when it is installed on a non-first hard disk.

If you have Windows installed on a second or third hard disk, you will need to trick Windows into thinking it is on the first hard disk, or it will sulk and refuse to boot. To do that you can use the map  command (twice).
map (hd0) (hd1)
map (hd1) (hd0)

grub>  rootnoverify (hd1,0)
(Where (hd1) is the (second hard disk) Windows is on.)
(Where (hd1,0) is the partition Windows is in.)

grub>  makeactive

grub>  map (hd0) (hd1)

grub>  map (hd1) (hd0)

grub>  chainloader +1

grub>  boot_




GRUB and MultiWindows

GNU/GRUB is actually a far better boot loader to use for setting up a Windows multiboot than Windows own bootloader. Windows is the operating system that insists on being the only one on the hard disk, but ironically it still doesn't have any 'hide' feature of it's own.
The default Windows method for multibooting is to copy the new installation's vital files needed for booting into an older, existing Windows installation in a primary partition. Then the newer Windows install will be made in a logical partition without any bootloader file of its own. Needless to say, if the user ever has a problem with the older operating system it means the newer operating system will be ruined too. For more info read this link,  Understanding MultiBooting and Booting Windows from an Extended Partition Dan Goodall
You use GRUB for booting Windows with rather than Windows own bootloader, especially if you want to set up a Windows multi boot.
You install the first Windows, then use GRUB to 'hide' it, then you install the other Windows.

When more than one Windows is installed on the same hard disk, you can use GRUB's 'hide' and 'unhide' commands to hide one Windows install from another, and boot.

For example if one Windows installation is is the first partition and another Windows installation is added to the fourth partition, you would boot the first partition this way,
grub>  hide (hd0,3)

grub>  unhide (hd0,0)

grub>  root (hd0,0) 

grub>  chainloader +1

grub>  makeactive

grub>  boot
And Windows in partition 1 should boot.



Now when I want to boot the other one, I just do the reverse,
grub>  unhide (hd0,3)

grub>  hide (hd0,0)

grub>  rootnoverify (hd0,3)

grub>  chainloader +1

grub>  makeactive

grub>  boot



A Quick Guide to GRUB's Numbering System
floppy disk drive = (fd0)
 First hard drive = (hd0) 
second hard drive = (hd1)
  third hard drive= (hd2) ... and so on.
 First partition = 0              
second partition = 1              
 third partition = 2 ... and so on
To combine these now:
first partition on first hard drive = (hd0,0)    = /dev/hda1 in Linux
  2nd partition on first hard drive = (hd0,1)    = /dev/hda2 in Linux
  3rd partition on first hard drive = (hd0,2)    = /dev/hda3 in Linux
  4th partition on first hard drive = (hd0,3)    = /dev/hda4 in Linux  
  5th 
partition on first hard drive = (hd0,4)    = /dev/hda5 in Linux
  6th partition on first hard drive = (hd0,5)    = /dev/hda6 in Linux  
  7th 
partition on first hard drive = (hd0,6)    = /dev/hda7 in Linux  
  8th 
partition on first hard drive = (hd0,7)    = /dev/hda8 in Linux  
  9th 
partition on first hard drive = (hd0,8)    = /dev/hda9 in Linux  
 10th 
partition on first hard drive = (hd0,9)    = /dev/hda10in Linux  
first partition on second hard drive= (hd1,0)
   = /dev/hdb1 in Linux         
  2nd partition on second hard drive= (hd1,1)
   = /dev/hdb2 in Linux        
  3rd partition on second hard drive= (hd1,2)
   = /dev/hdb3 in Linux
  4th partition on second hard drive= (hd1,3)    = /dev/hdb4 in Linux  
... and so on
GRUB makes no distinction between sda and hda drives


The Gnu Grub manual contains a lot more information than can be put on this page.  




Temporarily Edit the GRUB Menu


  

Ubuntu, kernel 2.6.15-26-386                                   
Ubuntu, kernel 2.6.15-26-386 (recovery mode)
Ubuntu, memtest86+
Other operating systems:
Microsoft Windows XP Home Edition


   Use the up or down arrow keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting,
or 'c' for a command-line.


The highlighted entry will be booted in 10 seconds.
This is an illustration of GRUB's Main Menu, which remains for ten seconds in most computers, before Linux (Ubuntu) begins to load by default.
You can press any key to stop the timer when you're at the GRUB menu.
If you read the text underneath the GRUB menu it says you can press 'e' to edit the commands before booting.
You can make non-persistent changes to the GRUB menu by pressing your 'e' key, and editing commands and options in your GRUB menu.

So press your 'e' key.


Now you should see a different Grub menu,

  

  root   (hd0,5)                                                    
kernel  /vmlinuz-2.6.22-14-generic root=UUID=51ba7905-7da5-4079-b8b6-->
initrd  /initrd.img-2.6.22-14-generict
quiet












Use the up or down arrow keys to select which entry is highlighted.
Press 'b' to boot, 'e' to edit the selected command in the
boot sequence,'c' for the command-line 'o' to open a new line
after ('0' for before) the selected line, 'd' to remove the
selected line, 'd' or escape to go back to the main menu.
   
This gives you another sort of GRUB menu, it's sort of like your 'behind the scenes' GRUB menu.

You can move the highlight bar over any line you need to and press 'e' to edit it.

Booting problems are often caused by just one wrong number in a line in your /boot/grub/menu.lst file.
Normally you just need to edit that one hard disk or partition number and you can boot. If you already know what you're doing it's often quicker to use this 'e' for edit method to temporarily correct the error and boot than using the 'c' key for GRUB's Command Line Interface. With the 'e' for edit menu,  your boot-up commands are displayed already complete, so you don't need to type each command out again from scratch.  This way you can just edit what you need. That often saves time and effort.

For another example, you might need edit your kernel line and add kernel options.
Press your down arrow key to go down to the second line, the one beginning with the word 'kernel' and press 'e' again.
Scroll across to the end of that line and it should say 'ro quiet splash_', those are kernel options that are passed from GRUB to your kernel  during boot-up. You may need to add some more kernel options to the end of the kernel line because of some hardware issue, perhaps.
Probably the most frequently needed kernel parameter would be: xforcevesa , which essentially means you'll be able to boot into 'safe graphics mode', in case your monitor went blank at the login screen due to a video driver problem.
Here's a link to 'The Linux BootPrompt-HowTo' - by Paul Gortmaker.
Here's a more Ubuntu-specific link: Ubuntu - How To Edit Grub Boot Parameters - grumpymole.

When the computer is first booting, the display functions in 'VGA' mode, which is run by a simple video driver from the BIOS.  GRUB uses the BIOS's VGA driver too.
As soon as a Linux kernel begins to boot, we can use the vesa video driver, that's used to give a slightly better resolution during the starting up phase of booting. During this period of time, the 'usplash' screen is normally displayed. Usplash - Wikipedia, the free encyclopedia
Then when Ubuntu boots, it loads the operating system's hardware specific video card drivers and you have much nicer graphics by the time you get to your login screen.

Sometimes we don't see the usplash, but instead we see the kernel's rantings and ravings about the hardware as it's booting. That information is strored in log files in /var/log as well. The kernel's feedback is sometimes useful for troubleshooting purposes. Usually, the kernel drops the usplash as we can see what's wrong if it encounters an error and cannot completely boot up. Sometimes it'll drop you to a shell prompt instread of booting.

In some rare cases, the vesa driver isn't working during the middle phase of the boot-up.
What would happen if you can't see anything at all?

Normally, even if you had a blank screen during boot-up, there would be no harm in that. You just wouldn't see anything for a while and then when it gets to the part where the video driver kicks in and Ubuntu comes up, you'd get your display back.
That's okay if your computer does boot eventually, but what happens when the computer fails to boot, and just sits there with a black screen? The main concern is, it could be stopping at some error and you can't read the error message because you have no display whatsoever at that stage.
You could first try simply waiting a while in case it's just doing a file system check.
Maybe try pressing 'Enter', followed by 'Ctrl'+ 'D', in case it's hanging at the file system check. That would get you over that.

You'd still need to wait a minute for it to finish booting.....
Okay, so you tried waiting for ages already and still nothing....

The answer is to reboot and add 'vga=ask' as a kernel option.
Here is a link to an excellent howto which explains all we need to know about the vga= option, HOWTO: Change bootup resolution, by Indras

At the end of the 'kernel' line, make a space and then type: vga=ask
Then press the 'Enter' key.
Press 'b' to boot.
On the next screen, it should say,
Starting up . . .
Press<RETURN> to see video modes available, <SPACE> to continue or wait 30 secs



Press 'Enter'.  !Don't press you space bar or you'll have to do it all again!

It should give you a choice of vga settings you can try in an effort to get some display during boot-up.
Video adapter: VESA  VGA
Mode:  COLSxROWS:
0  0F00  80x25
1  0F01  80x50
2  0F02  80x43
3  0F03  80x28
4  0F05  80x30
5  0F06  80x34
6  0F07  89x60

Enter mode number or 'scan': _
In my laptop I can type in 'scan', which doesn't do anything for me, but it might fix yours. I'd say try that first.
Then, there's a choice of numbers between 1 and 6 that correspond with different capabilities of your display.
Hopefully that will sooner or later let you to be able to see the text messages that normally run behind the boot splash screen during a regular boot-up, but show up to tell you what's wrong when there are errors. Then whatever the problem is that's holding up the booting procedure can be solved, depending on what the exact problem turned out to be.

That was just one example of how to use the 'e' for edit feature to temporarily edit the GRUB menu for one boot-up. This way it's possible to make any changes to the GRUB menu you need in order to  boot your operating system.
Once the operating system is booted then it will be easy to edit the /boot/grub/menu.lst file and make more permanent changes.
Back to top


GRUB shell
herman@red~:$ sudo grub
You get a 'GRUB shell' by typing 'sudo grub' after a command prompt.


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported.   For
the   first   word,  TAB  lists  possible  command
completions.  Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> help
blocklist FILE                         boot
cat FILE                               chainloader [--force] FILE
clear                                  color NORMAL [HIGHLIGHT]
configfile FILE                        device DRIVE DEVICE
displayapm                             displaymem
find FILENAME                          geometry DRIVE [CYLINDER HEAD SECTOR [
halt [--no-apm]                        help [--all] [PATTERN ...]
hide PARTITION                         initrd FILE [ARG ...]
kernel [--no-mem-option] [--type=TYPE] makeactive
map TO_DRIVE FROM_DRIVE                md5crypt
module FILE [ARG ...]                  modulenounzip FILE [ARG ...]
pager [FLAG]                           partnew PART TYPE START LEN
parttype PART TYPE                     quit
reboot                                 root [DEVICE [HDBIAS]]
rootnoverify [DEVICE [HDBIAS]]         serial [--unit=UNIT] [--port=PORT] [--
setkey [TO_KEY FROM_KEY]               setup [--prefix=DIR] [--stage2=STAGE2_
terminal [--dumb] [--no-echo] [--no-ed terminfo [--name=NAME --cursor-address
testvbe MODE                           unhide PARTITION
uppermem KBYTES                        vbeprobe [MODE]

grub>

To see a list of commands that are available in a grub shell, try typing 'help'.

Re-install GRUB
The following thread is the most popular about this subject in Ubuntu Web Forums, How to install Grub from a live Ubuntu cd. - catlett.

The two most popular methods are,
  •  grub-install command - installs GRUB files plus MBR or PBS (Partition Boot Sector)
  • grub's setup command - installs MBR or PBS only
1) grub-install command
The advantage of the grub-install command is that it can be used to install or refresh grub files in the /boot/grub directory, at the same time as it installs the IPL for GRUB to a hard disk's MBR or to a partition's boot sector.

(i) If you can boot your Linux operating system somehow, the command is simple,
herman@red~:$ sudo grub-install /dev/sda
Where: /dev/sda is the appropriate hard disc MBR or partition boot sector for where you want the IPL for GRUB to be installed.

(ii) If you need to run the grub-install command from a Live CD,
Contrary to what many people think, there's no need to chroot from a live CD into a hard disk installed Linux operating system to re-install GRUB. When we're in a Live CD or a different operating system (such as a USB disk or a different hard-disk installed Linux), to install some other operating system's GRUB somewhere you just need to do something like the following command,
Example:
herman@red~:$ sudo grub-install --root-directory=/media/disc /dev/sdb
Where: /dev/sdb is the appropriate MBR or partition boot sector for where you want the IPL for GRUB to be installed.
Where: /media/disc is the file path for the directory where you want the GRUB files to be installed.

If you're looking for an example about how to chroot, look in my LiLo Page, it is necessary to chroot to install LiLo. LiLo Page.



2) GRUB's setup command
The grub shell method explained below here for re-installing GRUB is very flexible.
It can just as easily be used from a live CD or DVD, from a GRUB floppy disk, from GRUB's Command Line Interface or a hard disk installed operating system or just about anywhere there is already a GRUB installation present with the necessary GRUB files.
That often makes it much more convenient than running the grub-install command.

The GRUB shell method is for re-installing GRUB's IPL to a hard disk's MBR or the boot sector of a Linux partition, most of the time that's all we need to do. It doesn't actually refresh the grub files in /boot/grub.
The most common use for this operation is to fix your MBR after another operating system has been installed and it has taken over your MBR, or if your partition numbers have been accidentally changed and you're getting GRUB Error 17.

Here's how to use the GRUB shell to re-install GRUB.
The first step is to open a terminal and open a grub shell with root priveleges,
Code:
herman@red~:$ sudo grub
I typed 'sudo grub' and pressed 'Enter'.
In Ubuntu,  it is important  to use 'sudo' before the 'grub' command.
If you forget, you will get a GRUB shell okay, but you won't have root priveleges.
You won't be able to do very much with a grub shell without root priveleges.
If you try, you will probably just get some confusing error messages.

Output:
     GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the   first   word,  TAB  lists  possible  command completions.  Anywhere else TAB lists the possible completions of a device/filename. ]

grub>_

This is a GRUB shell, it has a GRUB prompt, like this, 'grub>_'    
grub> find /boot/grub/stage1
   (hd0,1)
   (hd0,3)

Here, I typed 'find /boot/grub/stage1'. That's a test to find out or confirm which partitions in my computer have GRUB installed in them.
This gives me a clue as to exactly where the necessary GRUB files may be located that I can install GRUB from. (In case I have more than one Linux operating system).
grub> root (hd0,1)
 Filesystem type is ext2fs, partition type 0x83

The 'root (hd0,1) will tell GRUB which operating system partition contains the GRUB I want to install from.  
It has to be one of the ones listed by the 'find' command (above).
If I know I have Ubuntu in partition 2 and Debian in partition 4 and I want Ubuntu's GRUB installed to MBR, I set (hd0,1) as GRUB's root device here. If I chose (hd0,3) that would install Debain's GRUB somewhere.  Quick Guide to GRUB's Numbering System.
GRUB should recognize the filesystem, and will reply with an output similar to the one shown above. If not, then check to make sure you didn't make a mistake.

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage
2 /boot/grub/menu.lst"... succeeded
Done.

The 'setup' command is the command that tells GRUB exactly where to install Grub to.You may have a variety of different devices that you might want to install GRUB to.
Installing GRUB to MBR:

'setup (hd0)' is the command to install Grub's stage1 to MBR in the first hard disk.
Stage1_5 will also be installed to the 15 sectors following the MBR in the first track of the hard disk.
Installing GRUB to a partition:
To install GRUB to a partition, you would use a command like, 'setup (hd0,1), or 'setup (hd0,3)', where (hd0,1) and (hd0,3) are Linux partitions. If you do that, you'll be able to boot your operating system using the 'chainloader' command.
Installing GRUB to a non-first MBR:
The BIOS normally only boots the MBR of whichever disk is set in the BIOS as the first hard disk.
If you have more than one hard disk in your computer, you can install GRUB to the MBR of some other hard disks instead.
You can then use a chainloader command from your first hard disk's GRUB to boot GRUB or any other boot loader in any other hard disk. This is useful for people who have a lot of operating systems and they want to spread them over several GRUB menus.
To install GRUB to a second hard disk, you would use 'setup (hd1)', and for a third hard disk 'setup (hd2)', and so on.
Installing GRUB to a floppy disk:
That's a seperate subject, covered further down this page.
How to make your own personalized GRUB Floppy Disk........................................ GO
Installing GRUB to a usbdisk: That's another seperate subject, also covered further down this page.
How to add GRUB to your USB thumb drive...........................................................GO

grub> quit
This is just to take you back to the regular terminal prompt again.

NOTE:
You can use Super GRUB Disk to reinstall GRUB with. 
Super GRUB Disk Page..........................................................................Super GRUB Disk Page



Memtest86+
         
fig3grub
         fig 3 GRUB
In Ubuntu, one of the options GRUB can load is called 'Memtest86+', a series of tests to check your computer's memory and make sure it is okay.
This results in a very impressive blue display, as pictured above , with hashes '#'  progressing across the monitor and strange numbers and letters appearing and disappearing again.  It will continue unattended as long as you like until you press the 'Esc' key
There are eight tests in the series. (Just highlight 'Ubuntu, kernel memtest86+ on the GRUB Menu).
It took about 25 minutes to run through one complete cycle of eight tests with my 400 Mhz computer. My 3.0 Gz computer (3000 Mhz) took 25 minutes to run through all these test twice. Memtest 86+ will keep on cycling through these tests for as long as you let it run, in case you're checking for intermittent errors.
Normally, one cycle of eight tests is enough to find out if you have a memory problem or not.
 
The tests are:
#1 [address test, own address]
#2 [moving inversions, ones and zeros]
#3 [ moving inversions, 8 bit pattern]
#4 [moving inversions, random pattern]
#5 [block move, 64 moves]
#6 [moving inversions, 32 bit pattern]
#7 [random number sequence]
#8 [modulo 20, ones and zeros]
 
These tests could be very useful for troubleshooting purposes, especially if your computer freezes up or
crashes now and again.
Error messages that might possibly (but not necessarily) be associated with faulty RAM modules include 'parity errors', 'general or global protection faults', 'fatal exception errors', and 'divide errors'.

I have read that memtest 86+ tests not only the RAM modules, but the machine's CPU caches as well.
If you want to make sure you're only testing the computer's memory modules, before you run memtest86+ you can go into the machine's CMOS (BIOS) settings and disable all caching, such as 'L1' and 'L2' or 'CPU Internal Cache' and 'External Cache'. Save the changes and reboot. Then run memtest86+.

If you find any errors and you have more than one RAM module, remove all but one RAM module and test one RAM module at a time to determine which one is faulty.
Be sure to unplug the power cable from your PC, and wait for the motherboard LED light to go out before touching anything. If it's a laptop, make sure you remove the battery too.
Be aware of ESD, wear an ESD wrist strap if you have one, or touch the computer's frame first.
Often just removing and reseating the RAM modules can cure the problem if it is caused by dirt or a bad fit in the socket. (That has worked for me before).
When you're finished, don't forget to go back into your CMOS (BIOS setup), and re-enable caching, and save the changes and reboot, otherwise your computer might run very slowly.

For more information on memtest86+, Memtest86+,   Memtest forums, memtest86.com.


How to make a GRUB CD-RW  
(with an optional splashimage)

This is a "copy & paste" HowTo!
The easiest way to follow this exercise is to open your own command line (terminal) and simply copy and paste the commands, (except where you have to provide own specific information like disk and partition details, hostnames, passwords,...). This saves you a lot of time and effort and helps to avoid typos.

You should only copy and paste the commands, (don't copy the herman@red:~$ part, that's not part of any command).

Many of these tables shown for illustration also include the outputs or feedback from the commands. These can vary from one machine to another but should still serve to give an idea what should happen. You should be careful not to copy any of these example outputs as part of your commands.
The commands are usually only in the top line, results, feedback or output is normally underneath.

This works for CD-R or CD-RW disks, but I prefer to use CD-RWs for this.

1) I made a new empty directory named iso, then I made another directory inside it called boot with another one inside boot called grub.
code:
herman@red:~$ mkdir iso herman@red:~$ mkdir -p iso/boot/grub


2) I copied my /boot/grub/menu.lst to my new /iso/boot/grub directory,
herman@red:~$ cp /boot/grub/menu.lst iso/boot/grub/ 


3) and also I copied a file called 'stage2_eltorito' to my new /iso/boot/grub directory.

NOTE: The exact location of this file may not be the same for all versions of Ubuntu, so I recommend you find it first, with the 'locate' command, like this,
code:
herman@red:~$ locate stage2_eltorito
/usr/lib/i386-pc/stage2_eltorito



Now that Linux has found the file for me, I copied it to my /grub directory inside my /boot directory in my new iso directory,
herman@red:~$ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub/

Where: '/usr/lib/i386-pc/stage2_eltorito' is the correct path and file name, found with the 'locate' command in your own computer. (It may be different in your compared with mine).


3 (a) This part is optional,
I added a nice splashimage. My splashimage is called Ubuntusplash. To add this all I did was open my iso/boot/grub directory in my /home/herman folder and copy and paste it in there.

If you don't have your own splashimage, you can make your own, or download one from the internet via the link already given under splashimages on this page, ........................Go Back

Or, if you want, you can just download any of the ones I made from here, Splashimages.



4) I opened my menu.lst with my text editor and edited the file to make sure everything will work properly from the CD.
Some modifications need to be made to the menu.lst since things will not work the same from a CD as from a hard disk.

4 i) THIS IS IMPORTANT.
We need to delete all instances of the savedefault command.
 The 'savedefault' commands in each operating system's boot entry will cause GRUB to fail to work from a CD. That's because the 'savedefault' command tells GRUB to run a program called grub-set-default, which tries to write to a file called /boot/grub/default, and record which menu entry was booted last time GRUB was used. That works great in a hard disk, USB or floppy disc, or any media GRUB can write to.
Unfortunately, the only way to write to a CD is to burn a new CD. GRUB can't write to the file in the CD. That stops GRUB from completing it's tasks and GRUB will return an error message instead.   
So, for our GRUB CD to work we need to: open the new copy of menu.lst with 'gedit' text editor, and delete all instances of the command 'savedefault' from the boot entries.  

4 ii) Another (recommended) idea would be to edit your Ubuntu entries so that the CD-RW will boot Ubuntu via the symlinks to the Linux kernel and initrd.img rather than the actual files specifically. That avoids the need to make a new CD-RW after each kernel update.
(Well, it will probably still boot as long as you still have the out-of-date kernel and initrd.img, but it's best to always be booting with the most advanced kernel and initrd.img, for lots of reasons).

For example, change this,
title        Ubuntu 8.10, kernel 2.6.15-25-386
uuid         
fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel       /boot/vmlinuz-2.6.15-25-386 root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd       /boot/initrd.img-2.6.15-25-386
savedefault
boot

To something like this,
title        Ubuntu 8.10
uuid         
fe7bf845-7ce9-4733-b6de-f70f2b62076d
kernel       /vmlinuz root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd       /initrd.img
boot

The savedefault command has been deleted.
References to a specific kernel and initrd.img have been deleted and the paths have been changed to point to the symlinks (shortcuts to the current kernel and initrd.img) instead, (by deleting the word '/boot').
That avoids the need to make a new GRUB CD-RW after each kernel update.

Intrepid Ibex's GRUB replaced the command 'root', (the command in the second line, under 'title'), with the 'uuid' command. You have the option of leaving that alone.
If you leave it that way, your GRUB CD will look for the Ubuntu installation with the designated file system (with the UUID number you specified), and boot it no matter what disk it might happen to be in.
Even if you want to boot Ubuntu in a USB flash memory stick and if it's plugged into a hub with a lot of other USB devices, and GRUB will find the right disc for you and boot it.

Earlier versions of Ubuntu, or other Linux distributions's GRUBs might not feature the uuid command yet.

4 iii) Add another operating system entry which will be more generic.
title       Symlink Boot on Ubuntu in (hd0,1)
root        (hd0,1)
kernel      /vmlinuz root=/dev/sda2 ro quiet splash
initrd      /initrd.img
boot

I added another boot entry by copying and pasting my first one and then I edited the words after the title command, you can type in whatever you like there, I typed in 'Symlink Boot on Ubuntu in (hd0,1)'.
I reverted from the uuid command to the old root command, and replaced the UUID number with '(hd0,1), (you may need to type in something else here as appropriate for your own needs).
I also changed the 'root=UUID' part in the kernel line to be non-specific by replacing the exact UUID number with '/dev/sda2' instead, so the CD will boot whatever is in the second partition, regardless of the exact file system UUID. It's up to you, you don't have to do that, but now it can still boot Ubuntu again if Ubuntu has been re-installed, or replaced with a newer version. (Or whatever Linux installation is in the first hard disk, second partition).

4 iv) You can also add a third boot entry something like this instead if you like,
title       Chainloader Boot, First Hard Disk
root        (hd0,1)
chainloader +1
That will boot whatever boot loader is installed in the first hard disk, second partition of any PC.
You could add more of these to boot any operating system in more different hard disks and other partitions if you want.

and/or, you might find a boot entry like this one useful someday,
title       Ubuntu Configfile Boot configfile  (hd0,1)/boot/grub/menu.lst
This will bring up your current GRUB menu in whatever operating system is in (hd0,1) and that will then offer you a GRUB menu with the most up to date kernel and a list of all of the operating systems currently installed in the computer. Your GRUB CD will never be out of date if you add an entry like this to it. You can add this in addition to the other above suggested entries.
You could add more of these to boot Linux installations in more different partitions if you want.

It would do no harm and possibly some good to have all kinds of different boot entries.

Don't forget you will still have the options of
so there's no need to go too crazy with adding a lot of unnecessary boot entries.

If you're doing it for fun though, feel free to as as many different kinds of boot entries as you like. You can probably think of lots more possibilities, let your imagination run wild!

Also, do a last minute check to see if there is anything else you might want to edit in your menu.lst file and do that now. If you are not using a splashimage, you can enable pretty colours instead if you like.


4 v ) This is optional, you need to do this for the splashimage if you are using one.

The name of my splashimage in this example is Ubuntusplash.xpm.gz

You need add a line in your menu.lst file for the splashimage you are going to use. For example, splashimage=(cd)/boot/grub/yourgrubsplash.xpm.gz as shown in my example menu.lst snippet shown below. (Where 'yourgrubsplash' is the name of your splashimage. Replace 'yourgrubsplash' with the name of the splashimage you will be using.

It does not necessarily need to be between #hiddenmenu and #Pretty colours like mine, but that's where I always put mine and it seems to work okay.
For example,
Code:
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

splashimage=(cd)/boot/grub/Ubuntusplash.xpm.gz

# Pretty colours
#color cyan/blue white/blue

End of OPTIONAL section.

 5) The next command is to make the new grub directory into an .iso file.
Note: Copy and paste this command into your terminal, don't try to type it.
Code:
herman@red:~$ genisoimage -R -b boot/grub/stage2_eltorito  \
-input-charset iso8859-1  \
-V "GRUB CD"  \
-no-emul-boot \-boot-load-size 4 -boot-info-table -o grub.iso iso



Here's what it should reply:
herman@red:~$ genisoimage -R -b boot/grub/stage2_eltorito  \
> -input-charset iso8859-1  \
> -V "GRUB CD"  \
> -no-emul-boot \
> -boot-load-size 4 -boot-info-table -o grub.iso iso
Using MENU000.LST;1 for  iso/boot/grub/menu.lst~ (menu.lst)
Size of boot image is 4 sectors -> No emulation
Total translation table size: 2048
Total rockridge attributes bytes: 921
Total directory bytes: 4096
Path table size(bytes): 34
Max brk space used 0
239 extents written (0 MB)
herman@red:~$



6) After that I just exited the terminal and put my CD-RW in the drive, went through my /home/herman directory, right-clicked on the newly made grub.iso file and clicked 'write to disk'.

7) Test your new GRUB boot CD-RW disk. It should boot all your operating systems from the GRUB menu or from the GRUB command line interface.

8) If you do any work with a partition editor that causes your file system UUID number to be changed then your GRUB CD won't work any more and you'll need to make a new one. 
That's one of the reasons I prefer to use a CD-RW for this rather than a CD-R disk.
GRUB's Command Line Interface is available from the CD though, so if you can use CLI GRUB, you'll still be able to use the CD, (to boot any computer).

Only use 'Parted based partition editors, it is not advisable to touch your hard disk with any partition editors designed only for Windows. Just opening one of those to take a look at your partitions can make your Linux installs unbootable, as they might change your file system UUID numbers without your knowledge or permission.
'Parted based partitioners like GParted, QTParted, Partman and Parted are okay for both Windows and Linux.

NOTE:
You can use Super GRUB Disk to make your own bootable CD with, and add your favorite live operating systems to it, like Knoppix, Puppy linux, or GParted LiveCD, and combine it with your own personal GRUB CD that you just learned how to make.

Build a CD/DVD with SGD on it.............................................Build a CD/DVD with SGD on it



How to make your own personalized GRUB Floppy Disk.

 
This is a "copy & paste" HowTo! The easiest way to follow this exercise is to open your own command line (terminal) and simply copy and paste the commands (except where you have to provide own specific information like disk and partition details, hostnames, passwords,...). This saves you a lot of time and effort and helps to avoid typos.

You should only copy and paste the commands. Those don't begin until after the $ (prompt).
Many of these tables shown for illustration also include the outputs or feedback from the commands. These can vary from one machine to another but should still serve to give an idea what should happen.
You should be careful not to copy any of these example outputs as part of your commands.
The commands are usually only in the top line, results, feedback or output is normally underneath.

This will make you a GRUB boot floppy with your own GRUB menu in it, so it that suits your computer already.
You can also play with it and personalize it even more after it has been made. It's a safe way to experiment and learn how edit the GRUB Menu without interfering with your hard disk install's everyday booting. You can try out all the tricks on this web page, add a splashimage to your GRUB floppy, and anything you like. Conduct weird experiments, have fun!

First, of course, you need to insert your new, blank floppy disk in your computer's floppy disk drive. Check to make sure it is not 'write protected' at the moment. (The little plastic slider should be covering (closing) the hole in the left rear corner). How to Write-Protect a Floppy Diskette - HelpDesk (external link).

Code:
herman@red:~$ sudo mkfs /dev/fd0
This code is an example of the famous mkfs command, to format the floppy disk with a file system. You may need to wait a minute for this to be done.

Code:
herman@red:~$ sudo mount /dev/fd0 /media/floppy0
This is to 'mount' your floppy disk's new filesystem under your Ubuntu operating system's filesystem so that it can be seen, and written to.
An icon can be expected to appear on your desktop that looks like a floppy disk.

herman@red:~$ sudo mkdir -p /media/floppy0/boot

This command makes an empty directory (folder), in your floppy disk named /boot

herman@red:~$ sudo cp -r /boot/grub /media/floppy0/boot
Now we are copying our operating system's /boot/grub directory and all it's contents, and pasting it in our floppy disk's new /boot directory.

herman@red:~$ sudo umount /media/floppy0
This unmounts our floppy filesystem from under  our Ubuntu filesystem.

herman@red:~$ sudo grub
Now we open a GRUB shell, we will have a GRUB prompt.

grub> find /boot/grub/stage1
   (fd0)
   (hd0,1)

   (hd0,3)
   (hd1)
We check to make sure we have a stage1 file in our floppy disk. (This is just a routine check, you don't have to do this, but it's a good habit to do so).

grub> root (fd0)
This 'root (fd0) command means it will be the floppy disk's grub that will be installed in our floppy disk's first sector. (Not some other GRUB installation from our hard disk).

grub> setup (fd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (fd0)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (fd0)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.l
st "... succeeded
Done.

grub>_

This 'setup (fd0) command installs GRUB's IPL or stage1 in our floppy disk's first sector.
The rest of the text you see here is the feedback from the system, so we can see what happened.

grub> quit

herman@red:~$ exit
That's it, your new GRUB floppy disk is made! Reboot to try it out!

If you want to edit the menu.lst in the floppy disk, so you can customise it, play with it, update it or correct it, use this code:
herman@red:~$ sudo mount /dev/fd0 /media/floppy0
This is to 'mount' our floppy disk's filesystem under our Ubuntu operating system's filesystem so that it can be seen, and written to. An icon will appear on the desktop.
herman@red:~$ sudo chmod -R 777 /media/floppy0
This is optional, it relaxes the file permissions on the floppy disk so that you an just open your floppy disk by clicking the desktop icon and you can edit it easily. You won't be restricted to having to open it with a sudo command from a terminal every time. I think the security risk would be negligible, since your system is still protected with a password. It just means anyone can edit your floppy disk.
herman@red:~$ gksudo gedit /media/floppy0/boot/grub/menu.lst
If you choose to leave your floppy disk secure, so that only you can alter it, you'll have to open it the old fashioned way when you want to make changes.

herman@red:~$ sudo umount /media/floppy0
Always remember to unmount it when you are finished.

It is good practice to remove any boot floppies before shutting a computer down, and to 'write protect' the disk unless you are working on it. Never share a floppy disk between computers. In the old days, bootsector viruses used to spread that way, at least between Windows computers. I'm not sure about linux computers and boot sector viruses. It is best to 'keep our guard up' anyway.
How to Write-Protect a Floppy Diskette - HelpDesk (external link).




How to make a dedicated  GRUB Partition  

Also see the excellent web page by Steve Litt, Making a Dedicated Grub Partition.
My article here is based on information I originally learned on Steve Litt's web page, and the original work by the Steve Litt contains a lot more explanation and information than I have here.
The only thing I'm trying to do here is make a quick how-to for it that's more 'Ubuntu-specific'.
There are a few other small difference that come down to personal preferences.
I would like to encourage everyone to go and explore Steve Litt's site.


A dedicated GRUB partition is a special partition just for GRUB, it just has GRUB files in it.
This will mean GRUB will be 'operating system independant'.
In other words, even if you delete your Linux operating system, you'll still have your GRUB bootloader.

A 'dedicated GRUB partition' is not the same things as a 'separate /boot partition' because a separate /boot partition contains the operating system's kernel as well as the bootloader files and is mounted in the /etc/fstab file as  /boot in a particular operating system. A 'separate  /boot' partition  is only useful for curing GRUB error 18 in older computers, by forcing the kernel to be located close the the beginning of the hard disk. A separate /boot might not necessarily have GRUB files in it, it could have LiLo instead. How to make a separate /boot partition.

A 'dedicated GRUB' partition,
  • is operating system independant.
  • can serve any number of operating systems.
  • is great for people who multiple boot with more than two Linux distributions.
  • is the best way to dual or multiple boot more than one Windows if there is no Linux operating system in the computer. Refer to this link, Understanding MultiBooting and Booting Windows from an Extended Partition, by Dan Goodell. 
A dedicated GRUB partition will be a lot better than a separate /boot partition for most people.

The rest of this article is about how to make a dedicated GRUB partition.

1) Just make a small partition anywhere on your hard drive with any 'parted based partition editor you like. LibParted base hard disk partitioners include Parted, GParted, Parted Magic, Gnome Partition Editor, QTParted, Partman and others.

Probably a 100 MiB partition would be way more than large enough. GRUB by itself  takes up very little space on your hard drive.

Format it with any file system that GRUB supports. GRUB supports FAT32, Ext2, Ext3, ReiserFS and others as well. GRUB does NOT support NTFS.

Most Linux tutorials show the ext2 file system being used for GRUB, without explaining why. I think it's just to save hard disk space. Some of those tutorials are very old, from way back when a typical hard drive was smaller than 5 or 8 GB. The ext3 journal does occupy a tiny wee bit of room on the hard disk, but most of us would never notice it with the hard disk sizes that are common today.

Just in case someone is installing in a small hard disk or a flash memory stick, I'm going to use ReiserFS for this how-to, but you can use whatever file system you like. The Reiser File System takes up even less room than ext2 and works particularly well in flash memory.  

For the rest of this how-to you will need to remember the Linux term for your new partition.
Make a note of what Linux calls your new partition, (like '/dev/sda8' or something like that), before you close your partition editing program.

2) Label your file system.
You can call it anything you like, but I'm going to name mine 'GRUB'.

With the Reiser File System, we use the reiserfstune command, like this,
herman@amd64hh:~$ sudo reiserfstune /dev/sda8 -l "GRUB"
Where: Your new partition you just made has the partition number '/dev/sda8'.
Yours will most likely have a different partition number than mine. Look with your partition editor or use the 'sudo fdisk -lu' command to check. Replace the '/dev/sda8' part of this command with whatever partition numbers apply to you and your own unique partition numbering.

The reason for setting a file system label is to get our file systems to be automatically mounted in our /media directories with a nice descriptive name for the mount points.
That's a good idea now that Hardy Heron and newer version of Ubuntu feature the new automated mounting method. Just go ' Places'-->'Removable Media'-->'GRUB', to mount your new file system.

If you made an ext2, ext3 or a FAT32 file system for your dedicated GRUB partition, see:
Make a label for your ext3 file system - give your ext3 file systems descriptive names. FAT32 usbdisk volume label give your FAT32 usbdisk a pet name or How-to get your removable device mounted under an explicit and persistent name - Debian/Ubuntu Tips & Tricks.

If you are using an older versionof Ubuntu, or if you are using some other Linux distro, you should be able to make your own mount point and mount your file system manually.
If you're not sure how to do that, refer to the following link, Mounting Filesystems with the mount command - Traditional olde reliable method.

2) Reboot your computer, and mount the new GRUB partition.
Click-Icon Mounting  -  The new easy way to mount file systems in Hardy Heron and Intrepid Ibex.

If you use the 'ls' command to check the names of your mount points in your /media directory, you should find that your new dedicated GRUB partition will be automatically mounted as 'GRUB' ,
herman@amd64hh:~$ ls /media
BACKUPS  cdrom  cdrom0  DATA  GRUB floppy  floppy0  WEBSITE

3) Make a directory named /boot in your new GRUB partition, (in /media/GRUB),
herman@amd64hh:~$ sudo mkdir /media/GRUB/boot

This is just done for the sake of uniformity.


4) Copy your  /boot/grub directory to the new partition,
herman@amd64hh:~$ sudo cp -r /boot/grub /media/GRUB/boot/

5) Get the new GRUB partition's menu.lst file with,
herman@amd64hh:~$ gksudo gedit /media/GRUB/boot/grub/menu.lst
6) Delete all the old operating system boot entries in the new GRUB partition's menu.lst file and replace them with Operating System entries for multibooting other Linux Systems instead, and Windows Operating System Entries.
You can also delete the entire Debian Automagic Kernels List too. Since the menu.lst file isn't in an operating system anymore, the Debian Automagic Kernels List won't be needed.


7) Re-install Grub from your new GRUB partition to MBR.
herman@amd64hh:~$ sudo grub

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]

grub> find /boot/grub/stage1
 (hd0,1)
 (hd0,5)
 (hd0,6)
 (hd0,7)
 (hd1,1)

grub> root (hd0,7)

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,7)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.

grub> quit


8) Give all your operating systems a test boot-up to make sure everything's working fine and dandy.
If everything's good, you can (when you are ready) delete or hash out your extra operating system entries in your other menu.lst files if you won't use them any more. (Or just leave them there if they look neat and tidy enough and they don't bother you).

If you have a complex multi-boot set-up, with  several hard disks and lots of operating systems, you might not want all of your operating systems to be squeezed into one GRUB menu, (if they're all in one menu it might become too congested).
Instead you could have several dedicated GRUB partitions, one for each hard disk.
Make entries in your first hard hard disk's GRUB menu to boot only the operating systems in the first hard disk and chainload the MBR of each of the other hard disks.
Each hard disk's GRUB can list just the operating systems in it's own disk and chainload the first hard disk's MBR.
It would be kind of like going up and down in an elevator.
That would be a nice way to spread the number of operating system entries out over a number of GRUB menus because if they're all in one menu it might become too congested.


How to make a separate /boot partition

A sep