ubuntu dual boot illustrated site ubuntu dual boot windows 7 maverick meerkat
Legacy GRUB Page
(GNU-GRUB 'Legacy' - meaning versions 0.97 and earlier)
Edited Tuesday, March 09 2010 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 you are installing a new Ubuntu operating system, the Ubuntu installer runs programs to detect other operating systems in your computer and it sets up GRUB automatically for you.
Most of the time the installation scripts work perfectly and all of their other operating systems will boot.
Due to various computer technical difficulties, some computers give the wrong information and a small correction will be needed to an operating system's entry in the menu.lst file. This doesn't happen all that often when it does happen the computer users who are affected tend to make a lot of noise in web forums about it. At least they should be thankful that GRUB was set almost perfectly for them automatically. Other operating systems have boot loaders that need to be set up manually every time if you want to dual boot.

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 separate /boot partition is not the same thing as a dedicated GRUB partition.  
The main reason for needing a separate /boot partition is for curing GRUB error 18.
GRUB error 18 most commonly occurs when a hard disk is larger than the computer's BIOS was designed for.

Here is a list of BIOS hard disk limits and some approximate dates when these ways to overcome these limits were invented.
2.11 GB or 4095 cylinder limit
3.26 GB or 6322 cylinder limit
4.22 GB or 8192 cylinder limit                                        .................(around 1997 or earlier)
8.45 GB Standard INIT13 limitation (CHS[1024x256x512)....................(around late 1990s)
33.8 GB or 66,060,287 LBAs limitation...........................................................(August 1999)
137 GB or 268,435,455 LBAs limitation (28-bit limit)...............................(September 2001)

So let's say for example, you have an older computer that has an 8.45 GB hard drive size limit.
You can install a larger hard drive in your computer, but the BIOS can only boot an operating system that has its kernel located within the first 8.45 GB of the hard disk.
The reason is, older BIOSes plot the location of information on the hard disk using a system called 'CHS' addressing.  'C.H.S.' stands for 'Cylinders, Heads and Sectors'.
CHS addressing works a little bit like co-ordinates on a map, but using Cylinders Heads and Sector numbers for a 3D representation of a hard disk.
When this system was invented, it was thought to be wonderful, no-one ever dreamed it would ever be possible for hard disks to exceed 8 GB in size! Unfortunately, 8.45 GB is the largest the CHS system can address before that method simply runs out of numbers. Therefore, any Linux kernel that happens to get placed outside the 8.45 GB limit can't be 'seen' by the BIOS, so it can't be booted, and we get GRUB error 18.

There is also the 137 GB BIOS hard drive size limitation, which is caused by a different BIOS quirk, but results in a similar type of problem when people fit a larger hard drive to their computer than it came with from the store.

Sometimes you can download a BIOS update from your motherboard manufacturer's website and 'flash' your BIOS with it to overcome these hard drive limits and get other improvements for your BIOS as well.  See also  Grub error 18, on this web page.

One way to cure GRUB error 18 is to force the Linux kernel to be located in an area of your hard disk within the area that the BIOS can address.
The way to do that is to make sure it is contained within a partition that is situated somewhere close to the beginning of your hard disk. That's what a separate /boot partition is all about.

I would not recommend making a separate /boot partition for any reason than for overcoming GRUB error 18. For most people, a dedicated GRUB partition would be much more useful.

The easiest way to make a separate /boot partition if you need one is to have the installer make you one when you install Ubuntu or any Linux operating system.

If you didn't make one during your install, (probably you didn't know you needed one),  you can make one any time. That's what this article will be about.  It will be a little bit more work than doing it during the install, but quite do-able for most people.

First, you will need to use Partition Editor in your Ubuntu 'Desktop' Live/Install CD. Go System'-->'Administration'-->'Partition Editor'.  A GParted -- LiveCD will also work.
Resize a partition to make some free space anywhere within your hard drive limit. Around a quarter of a GB to half a GB should be plenty. You can format it with an  ext2 or ext3 file system.

Then you need to mount both your hard disk installed Ubuntu and your new /boot partition in your Ubuntu LiveCD operating system, (or GParted LiveCD).
See this link first, Mounting Linux  ext3 or reiserfs filesystems  and mount your new /boot partition's file system.

For example, my new /boot partition will be /dev/sda2,
Code:
herman@red:~$ sudo mkdir /media/boot
Code:
herman@red:~$ sudo mount -t ext3 /dev/hda2 /media/boot
Where: hda2 is the right partition designation for the new /boot partition, if not then substitute this number for something else, like /dev/hda1 or /dev/sda3 or whatever is right for your computer.


See this link second and mount your Ubuntu hard disk installed operating system  Mount a Ubuntu ext3 or reiserfs filesystem.
Code:
herman@red:~$ sudo mkdir /media/ubuntu
Code:
herman@red:~$ sudo mount -t ext3 /dev/hda1 /media/ubuntu
Where: /dev/hda1 is the hard disk installed Ubuntu's partition designation. Otherwise feel free to replace this number for something else, like /dev/hda2 or /dev/sda5 or whatever is right for your particular computer.

Copy all the files from the /boot directory in the installed system into the new empty partition.
Do not copy the directory itself, just all the stuff inside it.
You will probably need to use a sudo command for that,
Code:
herman@red:~$ sudo cp -r /media/ubuntu/boot/* /media/boot/

You would also need to add a line for the new partition in your /etc/fstab file, registering it as /boot. You can edit your installed operating system's /etc/fstab file from the Ubuntu Live CD too, the above link shows you how to access it. See Mount a different Linux filesystem (ext3) in Ubuntu
Code:
herman@red:~$ gksudo gedit /media/ubuntu/etc/fstab

Now you can add a line something like this in your /etc/fstab file,
# /etc/fstab: static file system information.
#
# <file system> <mount point>       <type>           <options>                <dump>  <pass>

   proc          /proc               proc             defaults                  0       0


# /dev/hda2
UUID=
9e9e5184-127f-45d2-bf4a-e6f0a112f180   /booext3 defaults,errors=remount-ro  0       1

#
/dev/hda1      
UUID=61e29deb-c5c3-4401-8557-81482aedc839
  /   ext3    defaults,errors=remount-ro 0       1

# /dev/hda5
UUID=a08d44f6-d681-4901-a7cc-345fc9fa9eb6 none  swap     sw                       0       0

/dev/cdrom      /media/cdrom0     udf,iso9660         user,noauto                 0       0

/dev/fd0        /media/floppy0      auto             rw,user,noauto               0       0

Where: 9e9e5184-127f-45d2-bf4a-e6f0a112f180 is the correct file system UUID number for the file system, you can use: sudo vol_id -u /dev/sda2 to find out your own UUID number. You must use your own unique UUID number for your own computer. You'll need to open a second terminal to do that.  See also: About /etc/fstab files with UUID filesystem ID added
Where: /dev/hda2 is the partition to be mounted as the /boot partition on start-up from now on.
herman@red:~$ sudo vol_id -u /dev/hda2


You will  also need to edit your /boot/grub/menu.lst file with the new partition information with the new path for your Linux kernel, see Mount a different Linux filesystem (ext3) in Ubuntu
Code:
herman@red:~$ gksudo gedit /media/boot/grub/menu.lst

When your /boot/grub/menu.lst file is open, scroll down to around the bottom of the file and look for your Ubuntu boot entries. They should look something like mine, below,
title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,0)

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

Change this (above),

to this (below),
title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,1)
kernel      /vmlinuz-2.6.20-15-generic root=UUID=
fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd       /initrd.img-2.6.20-15-generic
quiet
savedefault

Where: (hd0,1) will be the GRUB notation for your new /boot partition (dev/hda2 in my case).
If you're not sure, see: A Quick Guide to GRUB's Numbering System
NOTE:  Since the new /boot partition doesn't have a directory named /boot in it, I removed the '/boot' from the path to the kernel and initrd.img in the two middle lines.

And don't forget to make the 'root (hd0,1)' change persistant during kernel updates when update-grub automatically generates a new /boot/grub/menu.lst file.
You do that by editing your 'groot' line, in the debian automagic kernels list area of our /boot/grub/menu.lst file. Scroll up to somewhere closer to the middle of the file to look for that. Refer to this link for more information, # groot=(hd0,1)
Code:
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
Change this (above),

to this (below),
## default grub root device## e.g. groot=(hd0,0)
# groot=(hd0,1)

Where: (hd0,0) was my old GRUB designation for the partition my kernel lives in and (hd0,1) is the GRUB designation for where I want any new kernels installed from now on.
Make sure you find out the right partitions for your computer and replace these example numbers with whatever is correct for your special machine.
Don't forget to save your menu.lst file before closing.

You will need to re-install GRUB, see: Re-install GRUB with a GRUB shell eg; with Live CD
You will need to set your new /boot partition as the root device in GRUB and install GRUB to MBR in your first hard disk.
sudo grub

grub> find /boot/grub/menu.lst
This will find your old partition, we aren't interested in that anymore, so don't root GRUB to that.

Do this instead,
grub> find /grub/menu.lst
This will find your new GRUB partition, because the partition will already be mounted in /boot, we didn't want another directory in it named /boot as well, so we copied the files without the directory, remember?
Your output from the above command should tell you the input for the next command, below.
grub>root (hd0,1)
That means GRUB from (hd0,1) will be the one we are asking GRUB to install somewhere, and not some other GRUB that might happen to also be in the machine somewhere.

grub> setup (hd0)
This command installs the stage1 (IPL) for the GRUB we just specified, to the MBR of the first hard disk.

grub> quit

Then, at last, you can reboot. Don't forget to remove your Ubuntu Live CD.

That's it!

WARNING: Do not try to delete your old /boot directory in Ubuntu after you reboot, because your new fstab file has already mounted your new /boot partition using your /boot directory as the mount point.
Your old /boot (directory) files will now have been over written automatically.
That means your new /boot (partition) will look the same as your old /boot (directory), for all intents and purposes.

There is no need to delete anything.
If you do delete any files, thinking you are deleting old files from your old /boot directory that you don't need anymore, you will be in fact deleting the files in your /boot partition! So you will lose your boot! :(
Don't do that.

The main disadvantage of having to use a separate /boot partition is that is you want to dual boot more than one Linux installation, it is a bit tricky to get two or more linuxes to share the same separate /boot partition.
If you try, any files with the same name in the new system you might be installing will overwrite files belonging to your existing system and you will lose the boot of your existing Linux.
The main problem is the /boot/grub/menu.lst file, as the other files will either have different names, or else can probably be shared without any problems.
One workaround is to rename the existing /boot/grub/menu.lst file to some other name, for example 'boot/grub/menu.lstb', or something like that.
herman@amd46b:~$ sudo cp /boot/grub/menu.lst /boot/grub/menu.lstb

Then you need to go into your /usr/sbin/update-grub script to look for a line to edit to make update-grub look for a file named 'menu.lstb' instead of menu.lst from now on.
Update-grub is the script that runs automatically when we get a kernel update, to make us a new updated menu.lst file, (or maybe a menu.lstb file instead now).

The trouble is, update-grub is a very big script, and the line we want to find is about the 280th line, and it's hard to find by simple scrolling and eye-balling if we open the file in gedit text editor.
It's a lot easier to use the text editor nano instead, here's one way to do that, 
Code:
herman@amd46b:~$ sudo nano /usr/sbin/update-grub

When the nano text editor opens the file for you, you will see the top portion of the file.

To find the right line quickly and easily so you can edit it, you press your 'Ctrl' + 'W' keys.
If you read the clues nano gives you in the black hightlighed text at the bottom of the page, (called the 'shortcut list'),  you'll see that '^W' , (CTRL+W) means "Where is?" in nanoese.

That gives you a search bar, and after the word 'Search:', if you type 'menu.lst' (without the inverted commas), and press 'Enter', nano will take you instantly to the line we need to edit!
Isn't that neat?

Use your arrow keys to move the cursor to where you want to type.
Now you can just add a 'b' after 'menu.lst' (without the inverted commas).
To save the changes, you type: ^o (nanoese for CTRL+O), for 'write out'.
And to close the file  then: ^x , which is nanoese for 'eXit' (CTRL+X).

# Full path to the menu.lst
menu_file_basename=menu.lst
menu_file=$grub_dir/$
menu_file_basename

Change this (above),

to this (below),
# Full path to the menu.lst
menu_file_basename=menu.lstb
menu_file=$grub_dir/$
menu_file_basename



Then you can install another Linux and let it share the same /boot partition.

Unless you have room for another separate /boot partition, they aren't very big, but restrictions in the hard disk partitioning rules like how many primary partitions you can have and where logical partitions have to be located (in a series), could mean you to have no choice but to share the same separate /boot partition if you want to install more Linux operating systems.

If you want to quickly learn a little more about how to use nano, you can start by taking a look at this link, How to use nano. You can skip the ssh/telnet part and just do the exercise in your own computer if you want, or just read it and do your own thing.
 
Nano is a really cool text editor and well worth practicing with and getting to know.
Here's the link to Gnu Nano's homepage, http://www.nano-editor.org/
Don't forget to look up the documentation there and play with nano a little bit more.
Here's the nano Command Manual
Since nano doesn't require a GUI to work, knowing how to use nano might get you out of a scrape some day if your operating system is sick and your GUI won't start until you edit some file.
Ubuntu Community Docs Nano


How to add GRUB to your USB thumb drive.
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 USB thumb drive is to be used for booting operating systems in the hard disk, in a similar way to using a GRUB CD or Grub floppy disk. This will add GRUB to a USB thumb drive with your own GRUB menu in it. It may need some editing of the menu.lst file to make it boot your computer's OSes. Some people might prefer it to booting from a CD or floppy drive or maybe they have no floppy drive and their CD drive isn't working at the moment. You can still use your USB thumb drive to store and transfer files as you would normally. GRUB does not occupy very much room.

NOTE: not all BIOSs support booting from USB disk, so not everyone will be able to use this method either.

You can keep a USB disk installed GRUB as a pet. It requires no feeding and doesn't make any mess on the carpet. Play with it and personalise 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 USB GRUB menu, and anything you like. Conduct weird experiments, have fun!

First, of course, you need to plug your USB disk into one of your computer's USB ports.

In Ubuntu, a USB disk is usually automatically mounted by the operating system a few seconds after it is plugged in.

If your USB thumb drive is already used, you already  have a filesystem on your USB disk, so you can just install GRUB to it. 

If your USB thumb drive is brand new,
Check to make sure it has been formatted with a filesystem if it is new and you just brought it home from the store and unpacked it. I recommend GParted -- LiveCD for all disk partitioning and filesystem work. Just re-boot the computer with the USB thumb drive already plugged in and when GParted LiveCD is fully booted, over in the upper right-hand corner you'll find a 'spinbox' for selecting a different hard disk. Your USB thumb drive should show up in a list there, and you can use GParted LiveCD to format it with a filesystem. Fat32, ext2 or ext3 will be fine.
herman@red:~$ sudo mkdir -p /media/usbdisk/boot
This command makes an empty directory (folder), in your usbdisk named /boot

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

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

grub> find /boot/grub/stage1
   (hd0,1)
   (hd1,1)
   (hd2,0)
This command prints out a list of  partitions in GRUB notation that have a copy of GRUB's stage1 files. In this example, I have two hard disk drives inside the computer, plus the USBdisk, so I am a little confused as to which one is which. We have to try to pick out which one of these represents the USB disk. I will use a special GRUB command to find out. It is called the 'geometry' command.

grub> geometry (hd1)
drive 0x81: C/H/S = 3648/255/63, The number of sectors = 58605120, /dev/hdb
   Partition num: 0, Filesystem type is fat, partition type 0xb
   
   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

Here is how I used the 'geometry' command, in the GRUB shell, I typed 'geometry' (without the inverted commas), followed by the hard disk number I want to check out, (in GRUB's notation).

The feedback from this command can be seen right under where the command is shown in the above illustration. That doesn't look like my USB thumb drive to me, my USB thumb drive only has one single partition in it.  I recognise that partition information as being that of my second hard disk inside my computer, so (hd1) is not the disk I want to install GRUB to right now.

Let's take a look at (hd2),
grub> geometry (hd2)
drive 0x82: C/H/S = 7936/1/32, The number of sectors = 253952, /dev/sde
   Partition num: 0, Filesystem type is 
ext2fs, partition type 0x83
   

Now we're getting somewhere, (hd2) is the correct disk to install GRUB to. That's obviously my USB thumb drive alright! Look, it has '/dev/sde' on the end of the top line (for most people it might be '/dev/sda' instead), and it has just one partition. The cylinders, heads and sectors numbers (geometry) indicate that this is only a small drive, and so does the number of sectors.
This is the right hard disk to install GRUB to.

grub> root (hd2,0)
This 'root (hd2,0)' command means it will be the usb disk's grub that will be installed in our usbdisk's first sector. (Not some other GRUB installation from our hard disk).
Yours might be different to mine, so be careful here, use one of the GRUB partition designations you see shown in the feedback from your 'find' command, three tables up from here.

grub> setup (hd2)
 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 (hd2)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 d (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage
2 /boot/grub/menu.lst"... succeeded
Done.

This 'setup (hd2)' command installs grub's IPL or stage1 in our usbdisk'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
This is to quit the GRUB shell and go back to our regular terminal prompt.

herman@red:~$ sudo chmod -R 777 /media/usbdisk/boot/grub
This relaxes any file permissions on the USB thumb drive's GRUB directory and its contents for conveniences to make it easier for you to read and write to.
This is optional, but you can now have fun playing with the GRUB in your USB drive without having to worry about it affecting your hard disk install's GRUB.
If you prefer to leave your USB disk's GRUB secure, it will just mean you will need to use the sudo commands from a terminal every time you want to make changes.

herman@red:~$ exit
Always remember to unmount your usbdisk if you want to unplug it while the computer is running by right-clicking on the desktop icon and clicking 'eject'. Otherwise, it's quite okay to leave it plugged in as the computer shuts down and unplug it afterwards.

Remember that you will probably need to make sure that 'USB device' is in the list of bootable devices in your BIOS's hard disk boot priority before you can use the USBdisk for booting up your computer with.
Or, press your F8 or F12 key (depending on your brand and model of computer) during boot-up for a boot menu of hard disk drives to boot from and select the usbdisk.

Now that Ubuntu's GRUB uses file system UUID based booting, we should not have any problem with booting a USB device like we used to in the past. We can have all sorts of drives all plugged in and GRUB can easily find the right / (root) and /boot partition now.


How To Re-install GRUB Using The Ubuntu 'Alternate Install' CD

If you have installed Ubuntu first and Windows later,  Windows will write it's version of  MBR code to the first sector of your first hard disk.
This makes the MBR point to it the Windows boot sector and from there to the NTLDR and boot.ini files in Windows. You'll need to re-install GRUB to MBR if you still want to dual boot.
There are numerous ways to re-install stage1 (pointer to GRUB), to your MBR.
That will make your first hard disk's MBR point to GRUB files in your Ubuntu  /boot directory again.

You can also use Super GRUB Disk to reinstall GRUB with.
Super GRUB Disk Page..........................................................................Super Grub Disk Page
Another way you can re-install GRUB is with Ubuntu 'Desktop' Live/Install CD, using the GRUB shell method. If you want to see that, Click Here.

Re-installing GRUB using Rescue mode in the 'Alternate Install' CD Before I start I want to know which disks and partitions I have, and which filesystems are on each one. Many people can remember this information, but others will need to check and confirm. (Recommended). Of course when you can't boot your Ubuntu install you will need to do this using a Live CD.
 The 'sudo fdisk -lu command is the best way to check. (Illustration below).
herman@work:~$ 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   *          63    41576219    20788078+   c  W95 FAT32 (LBA)
/dev/hda2        41576220   153276164    55849972+  83  Linux              
/dev/hda3       153276165   156296384     1510110    5  Extended
/dev/hda5       153276228   156296384     1510078+  82  Linux swap / Solaris

Disk /dev/hdb: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders, total 58605120 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *          63     2104514     1052226    b  W95 FAT32
/dev/hdb3        56725515    58605119      939802+   5  Extended
/dev/hdb4         2104515    56725514    27310500   83  Linux
/dev/hdb5        56725578    58605119      939771   82  Linux swap / Solaris

Partition table entries are not in disk order

My main Ubuntu partition in this computer are /dev/hda2. Windows is on /dev/hda1. The other partitions are not important to the subject being described right now.

Once this is noted, it's okay to re-boot with the 'Alternate Install CD in the CD-ROM drive.

alternateCDsplash
                   re_GRUB_1

I boot the 'Alternate Install' CD and select 'Rescue a broken system'.

[!!] Choose language

Please choose the language used for the installation process. This language will be the default language for the final system.

This list is restricted to languages that can currently be displayed.

Choose a language:
                                       Bulgarian
                                       Catalan
                                       Chinese (Simplified)
                                       Chinese (Traditional)
                                       Croation
                                       Czech
                                       Danish
                                       Dutch
                                       English          
 
<Go Back>
Choose your language

[!!] Choose language

Based on your language, you are probably located in one of these countries or regions.

Choose a country, territory or area:
                                                            Australia       ^
                              Botswana        I
                              Canada          
                              Hong Kong        
                              India            
                              Ireland          
                              New Zealand      
                              Phillipines      
                              Singapore        
                              South Africa    
                              United Kingdom  v
<Go Back>
Choose your country

!] Ubuntu installer main menu

You can try to have your keyboard layout detected by pressing a series of keys. If you do not want to do this, you will be able to select your keyboard layout from a list.

Detect keyboard layout?
<Go Back>                                          <Yes>     <No> 
Choose your keyboard layout

[!!] Ubuntu installer main menu
The origin of the keyboard:

    Russia
    Serbia and Montenegro
    Slovakia
    Slovenia
    South Africa
    Spain
    Sri Lanka
    Sweden
    Switzerland
    Syria
    Tajikistan
    Turkey
    U.S. English            
<Go Back>                                         


[!!] Ubuntu installer main menu

There are more than one keyboard layouts with the origin you selected. Please select the layout matching your keyboard.

Keyboard Layout:

  U.S. English - Alternative international (former us_intl)
  U.S. English - Classic Dvorak
 
  U.S. English - Dvorak
 
  U.S. English - International (with dead keys)
 
  U.S. English - Left handed Dvorak
  U.S. English - Macintosh
 
  U.S. English - Right handed Dvorak
 
  U.S. English - Russian phonetic
 
 
U.S. English                                              
<Go Back>                                         

[!!] Ubuntu installer main menu

There are more than one keyboard layouts with the origin you selected. Please select the layout matching your keyboard.

Keyboard Layout:

  U.S. English - Alternative international (former us_intl)
  U.S. English - Classic Dvorak
 
  U.S. English - Dvorak
 
  U.S. English - International (with dead keys)
 
  U.S. English - Left handed Dvorak
  U.S. English - Macintosh
 
  U.S. English - Right handed Dvorak
 
  U.S. English - Russian phonetic
 
  U.S. English                                              
<Go Back>                                         

detecting hardware to find CD-ROM drives

                                21%                                
Loading module 'floppy' for 'Linux Floppy'...

     re_GRUB_7
Scanning CD-ROM

                                19%                                

Scanning /cdrom/pool/main/l...


Loading additional components

                                 45%                               

Retrieving Partman


Detecting network hardware 

                                21%                                
Detecting hardware please wait...


[!!] Configure the network

Your system has multiple network interfaces. Choose the one to use as the primary network interface during the installation. If possible, the first connected network interface found has been selected.

Primary network interface:

 eth0: Silicon Integrated Systems [SIS] SiS900 PCI Fast Ethernet  
 eth1: Broadcom Corporation BCM4318 [Airforce One 54g] 802.11g Wir
<Go Back>                                          
            This one only appears if you have more than one network card.


Configuring the network with DHCP

                                21%                                
This may take some time...

 <Cancel>

                 re_GRUB_8
[!] Configure the network

Please enter a hostname for this system.

The hostname is a single word that identifies your system to the network. If you don't know what your hostname should be, consult your network administrator. If you are setting up your own home network, you can make something up here.

Hostname:

 rocky_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
<Go Back>                                              <Continue>

Detecting disks and other hardware

                                21%                                

Starting PC card services
...


[!!] Enter rescue mode

Enter a device you wish to use as your root file system. You will be able to choose among various rescue operations to perform on this file system

Device to use as root file system:
/dev/sda1
/dev/sda10
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5
/dev/sda6
/dev/sda7
/dev/sda8
/dev/sda9
<Go Back>                                          
 I selected '/dev/discs/disc0/part2 here because I know that is my main Ubuntu partition, that is confirmed by referring to the sudo fdisk output at the top of this series of images. If I wasn't sure I would have made a note of that on a scrap of paper.

[!!] Enter rescue mode

Rescue operations
Execute a shell in /dev/sda2
Execute a shell in the installer environment
Reinstall GRUB boot loader
Choose a different root file system
Reboot the system

<Go Back>                                          
                      
[!!] Enter rescue mode

You need to make the newly installed system bootable, by installing the GRUB boot loader on a bootable device. The usual way to do this is to install GRUB to the master boot record of your first hard drive. If you prefer, you can install GRUB elsewhere on the drive, or to another drive, or even to a floppy.

The device can be specified using GRUB's "(hdn,m)" notation, or as a device in /dev. Below are some examples:
- "(hd0)" or "/dev/hda" will install GRUB to the master boot record of your first hard drive (IDE);
- "(hd0,1)" or "/dev/hda2" will use the second partition of your first IDE drive;
-"(hd2,4)" or "/dev/hdc5" will use the first extended partition of your third drive (SCSI here);
-"(fd0)" or "/dev/fd0" will install GRUB to a floppy.

Device for boot loader installation

 (fd0)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  
<Go Back>                                              <Continue>
Just read the sign and follow the instructions. It is quite clear and self- explained.
For example I have inserted a blank floppy disk and typed "(fd0)" on the line. 

Installing GRUB boot loader

                                 50%                               

Running "grub-install (fd0)"
...

       
[!!] Enter rescue mode

Rescue operations
Execute a shell in /dev/sda2
Execute a shell in the installer environment
Reinstall GRUB boot loader
Choose a different root file system
Reboot the system                            
<Go Back>                                          
Just be quick to remove the your 'Alternate Install' CD from your CD drive before your computer reboots with it again.




MBR Backup and Restore Recommended - Especially for all Microsoft Vista users, this backup will include your MBR 'disk signature' - vital for Vista's boot loader!  :)

This is also good for Windows/Linux dual booters who might need to re-install Windows while leaving your Ubuntu install in place. Normally Windows will automatically over-write GRUB's 'IPL' in your MBR, and you will need to re-install GRUB. If you want to take a shortcut, you can easily back up your MBR in Ubuntu using some 'dd' commands.

code:
 sudo dd if=/dev/sda of=/home/herman/MBR.img bs=446 count=1
Where:  herman is my username (you must substitute your own username in place of 'herman' unless your name is herman too),
You may substitute anything you like for a name for the file. I don't always call mine 'MBR', I recommend something descriptive, possibly including a date in the file name. It might also be an idea to make your own 'readme' text file to remain in a folder where the MBR back up is stored to explain what the file is. For example, whether it has GRUB or LiLo on it, or Windows IPL. This may come in handy if you end up with several similar files.

quote:
      1+0 records in
   1+0 records out
   446 bytes copied,  4.3e-05 seconds, 10.4 MB/s

When I open /home/herman directory, I should find a file named MBR.img there somewhere, and I can then copy it anywhere I like to store it until it need to be used.
Notice:
The command shown here does not back up the entire 512 bytes of the MBR, just the first 446 bytes.
That is to deliberately exclude the partition table.

Some people may prefer to include the partition table. That may be useful for some purposes, but be sure you destroy that copy of your MBR if you decide to re-partition your disk later. If you accidentally restore your MBR backup with an out of date partition table, it will not match your new filesystems. It will cause your disk to be unreadable.  
You should be able to recover your partition table with TestDisk, but please, it would be best to avoid any possible inconvenience. TestDisk Page.

If you only want the to make a backup copy of the bootloader code, you only need the first 466 bytes of the MBR, so it will not include the partition table. That is much safer. That is what I do, and what is shown here. 

Restore command:
code:
     sudo dd if=/home/herman/MBR.img of=/dev/sda bs=446 count=1
Where:  herman is my username (you must substitute your own username in place of 'herman' unless your name is herman too),and where: GRUBMBR.img is the name of your MBR backup file.

Of course, you would need to plan in advance how you will access this MBR back-up on your hard-disk when you can't (automatically) boot Ubuntu. You could still boot from GRUB's Command Line, or from a GAG Boot Manager CD, or just use a Live CD to mount your Ubuntu partition and issue the command to restore your MBR that way.



                 TroubleShooting                  
Common Booting Errors and Some Possible Cures
This section is a work in progress.
I scan Ubuntu Web Forums regulary and try to keep it up to date
as the software changes and as I learn something new about each error message.  
This should help most people solve many of the most common and simple booting problems.

This is even becoming useful for some slightly more obscure or peculiar problems as time goes on. Just remember this is not a complete or exhaustive list of problems and solutions by any means, (far from it), at least but it's somewhere to start from.

When troubleshooting booting problems, recognizing where the error message comes from is almost as important as what the error message is trying to tell us.
For that reason I have divided this section up according to where the error messages can come from.
If you don't know you will be able to click on any of these links and look for your error message in the next menu. If you don't see if, click your browser's 'back' button to return here and try another link to a different menu.

Index

Normal GRUB startup text  here's an example of what you are supposed to see

Error messages from the BIOS

Error messages from GRUB

Error messages from LiLo (these have now been moved to this website's LiLo Page).

Error messages from Windows ...(Windows begins to boot, but fails with message "...)

Error messages from Linux (Ubuntu)...(Ubuntu begins to boot, but can't because "...)


Normal Grub startup text
If you are quick enough, in some computers you may see these messages flash past in your monitor during a normal, healthy grub boot-up,
Grub Loading stage1.5.
_

Grub loading, please wait...
_

Then you should see your 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 menu remains for ten seconds in most computers, before Linux (Ubuntu) begins to load by default.

If you selected linux, or allowed it to load by default, here is what you should see blink up in your monitor just before the usplash screen loads,
  Booting 'Ubuntu, kernel 2.6.17-10-generic' root (hdo,1)  Filesystem type is ext2fs, partition type is 0x83 kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda2 ro quiet splash    [Linuz-bzImage, setup=0x1c00, size=0x18bd49] initrd /boot/initrd.img-2.6.17-10-generic    [Linux-initrd @ 0x1fabe000, 0x521cf5 bytes] boot

If you selected Windows,
  Booting 'Microsoft Windows XP Home Edition'

root             (hd0,0)
 Filesystem type is fat, partition type 0xc makeactive chainloader +1 _

Once again, unless you are extremely quick with your pause/break key, you need to be extremely fast to catch these text messages.
However, when there is a boot problem, it is likely you will see your system pause with one of these text messages partially completed and probably an error message to give you a clue about why the process stalled.


BIOS Boot Up Errors

The BIOS (short for 'Binary Input/Output System) is the first thing you need to have working properly right after you press your computer's power button.
The motherboard BIOS is located in a small chip on the motherboard. BIOS - Wikipedia.
The PC's BIOS contains the motherboard's clock and calendar and runs from a watch battery on the motherboard so it continues to run even when the rest of your computer is shut down.
Before the computer can boot, the BIOS must perform a P.O.S.T. (Power-On Self Test), which is sort of like a role call to check and make sure all the important computer parts are there and in a fit condition for booting.
If the signals returned by each of the important parts of the computer indicate they are there and they are all okay, the BIOS will look for the MBR in the first hard disk and start to boot the computer.
See: P.O.S.T. -  Power On Self Test - Wikipedia.

If there is something wrong like a vital part of the hardware is missing or damaged, the BIOS won't let the computer start. Instead it will  give a beep code through the motherboard speaker and/or print an error message on your screen.

HINT: The BIOS battery on the motherboard needs replacing every two or three years or so.
If the computer's time and date are out and the computer doesn't boot maybe the battery is getting old.


Index
BIOS beep codes -

Disk boot failure, insert system disk and press enter.

Non-System disk or disk error replace and strike and key when ready.

Disk I/O error.

NTLDR missing.

Hard disk boot sector invalid, press H to retry hard disk or any other key for floppy

External link, see also: PC Guide: Troubleshooting Boot-Time Error Messages


BIOS beep codes

If your computer beeps at you when you try to start it, you should count the numbers of beeps and look up the code in your motherboard manual or on the internet to find out what the beep code means to find out what your motherboard is trying to tell you.

Here are a few web pages that might help for a start,

Power On Self Test  Beep Codes for AMI and Phoenix BIOS   - PC Hell

Computer POST / beep codes - computerhope.com

BIOS Beep Codes - pantherproducts.co



"DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER"

The BIOS has looked around in the list of devices listed in the BIOS boot sequence you set in the CMOS and has not found a bootable device.

1) Check your BIOS boot order in CMOS and make sure this computer is set to boot from the device (eg, hard disk, cdrom drive, floppy drive, or the like), that you are trying to boot.
2) After that, check that the device has a bootable media present. For example, if it is a cdrom or floppy drive, is the media bootable in some other machine?
 3) If it is a hard disk, if the drive has been newly installed, has it been plugged in and jumpered correctly and set up in the BIOS?
4) Is the MBR is okay?



"Non-System disk or disk error
replace and strike and key when ready"

Example thread: http://www.ubuntuforums.org/showthread.php?t=295098&highlight=grub



Disk I/O error

There was an error trying to read from or write to your hard disk.
Your hard disk might not be plugged in properly or your hard disk may have some other kind of hardware problem.
You may want to check on the health of your hardware with a Linux live CD, Hardware Detection and Testing.



NTLDR missing

There are two kinds of 'NTLDR is Missing' errors.

One kind comes from the BIOS and this appears before any bootloader loads, (whether it will be GRUB or NTLDR), so you do not see the GRUB menu yet. That's the one I'm talking about now.

The other kind of 'NTLDR is Missing' error comes from Windows, after GRUB has done its work and chainloaded Windows by its boot sector okay, but there is something wrong in Windows. That's listed under ' Error messages from Windows .....(Windows begins to boot, but...)...'

This section is about when that error comes from the BIOS.
Your computer gives this message when it has found a non-bootable disk and it is trying to boot from it.

Check to make sure you don't have a floppy disk in the floppy disk drive. That can often interfere with booting. The same goes for USB devices.

Make sure your hard disk is properly detected in your BIOS.

Check both your Hard Disk Boot Priority and your bootable devices boot sequence in CMOS.

It is probably not true that NTLDR is missing at all, you should be able to see all your Windows booting files if you mount your Windows filesystem in Linux (LiveCD or installed OS), and take a look for yourself. It will look like the illustration on this link, A Birds's eye view of Windows XP (showing the bootloaderfiles)



Hard disk boot sector invalid, press H to retry hard disk or any other key for floppy.


Try settiing the boot flag on the partition with Super Grub Disk . Go 'English Super Grub Disk'-->'Boot and Tools'-->'Activate Partition of, then select your hard disk number from a list, then your partition number to be activated.
You can also set the boot flag with disk partitioning software like GParted or Gnome Partition Editor in the Ubuntu Live CD.

Example thread: http://www.ubuntuforums.org/showthread.php?t=296137&highlight=grub






GRUB Errors
The basic information in this section has mostly been copied from the official GNU/GRUB Manual, which is not my work.
I have used that as a foundation to work from and I am adding additional comments that I
am collecting by helping in and observing Grub related threads in Ubuntu Web Forums.
I hope that Ubuntu users especially will refer to this list and find the solution to their GRUB problem or that of someone they may be trying to help.
 
Here's a link to the GNU/GRUB manual, it has lots of good information in it you can refer to.
Also, here is a link to GNU GRUB FAQ.

See also: Gentoo GRUB Error Collection - external link

Errors reported by stage1
Stage1 of GRUB is the part that is written to the MBR, and uses the optional stage1_5 which understand file systems to find stage2 in a file system (partition) somewhere and boot. If you have an error message from stage1 it means you didn't get very far when you tried to boot up. Looking at the bright side, at least your MBR part of GRUB is okay :)
Pressing 'Ctrl'+'Alt'+'Del' keys will reboot.

GRUB hard disk error    

Floppy error

GRUB Loading stage1.5   
Read Error

GRUB  geom error                

Grub loading stage1.5    
Grub Loading...Please wait...

Starting up...

GRUB_ in the top left corner, and it freezes there

grub grub grub ... - (all over your entire monitor, and keeps scolling)


Errors reported by stage1_5 or stage2
Stage1_5 of GRUB is the (optional) part of GRUB that is written in the first track right after the MBR, and which understands file systems. The main job of stage1_5 is to help find stage2 in a file system (partition) somewhere and boot stage2.
If you have an error message from stage1 it means you didn't get very far when you tried to boot up. Looking at the bright side, at least your MBR part of GRUB is okay :)
Pressing 'Ctrl'+'Alt'+'Del' keys will reboot.

If your booting stops here, pressing 'Ctrl'+'Alt'+'Del' keys will reboot.

Stage2 of GRUB is the main, sophisticated part of GRUB that is too large to fit in either the MBR or in the first track so it must be housed somewhere in a file system (partition).
If you have reached stage2 of GRUB it means you have almost succeeded in booting but not quite. Press 'Esc' key to return to your GRUB menu or 'c' key for GRUB's Command Line Interface and keep trying to boot from there.

Operating System not found
 
Returns to a grub_  prompt instead of trying to boot

Grub error   1.       Grub error   2.     Grub error   3.    Grub error   4.    Grub error   5.

Grub error   6.       Grub error   7.     Grub error   8.     Grub error   9.    Grub error 10.

Grub error 11.       Grub error 12.     Grub error 13.     Grub error 14.     Grub error 15.

Grub error 16.       Grub error 17.     Grub error 18.     Grub error 19      Grub error 20.

Grub error 21.       Grub error 22.     Grub error 23.      Grub error 24.      Grub error 25.

Grub error 26.      Grub error 27.      Grub error 28.      Grub error 29.      Grub error 30.

Grub error 31.      Grub error 32.      Grub error 33.      Grub error 34.

'Stuck in the middle' Errors and Symptoms (GRUB doesn't quite chainload Windows)

disk I/O error. (after trying to boot Windows)



GRUB Stage1 Error Messages


GRUB hard disk error

Quoted from the GNU/GRUB manual
The stage2 or stage1.5 is being read from a hard disk, and the attempt to determine the size and geometry of the hard disk failed.

Check that your hard disk has been properly detected and set up in your BIOS.

Make sure your hard disk is properly detected in your BIOS.

According to these links the best hope is to try updating your BIOS,

 GRUB hard disk error

 GRUB fails to load (GRUB Hard Drive error)

 UPDATE: Look at page 4 of that first thread, where it has been found that re-installing GRUB with GRUB's install command solved this error for some people. The idea of using that command is to make stage1 point directly to stage2, without any stage1_5.




floppy error
The stage2 or stage1.5 is being read from a floppy disk, and the attempt to determine the size and geometry of the floppy disk failed. It's listed as a separate error since the probe sequence is different than for hard disks.

I don't know anything I can add about this error message.



GRUB Loading stage1.5 Read Error

Quoted from the GNU/GRUB manual,
A disk read error happened while trying to read the stage2 or stage1.5.
According to this link, you need to make sure your hard disk(s) are properly detected and set up in your BIOS, GRUB Loading stage 1.5 ...... Error 25 - LinuxQuestions.org

Another link I read but can't seem to find again said to re-install GRUB with the grub-install command, because that refreshes the GRUB files in /boot, and also in the MBR and first track case something had been corrupted somehow.
For example:
sudo grub-install  /dev/sda

Here's the best link I have found so far about GRUB Loading stage 1.5read error,
Nabble - Grub - Bugs - fixing the "grub loading stage1.5" hanging error
adrian15, the author if Super Grub Disk, says to re-install GRUB without the stage1.5 by renaming the stage1.5 to some other name, then re-installing GRUB. Stage1.5 is optional, so that should work.

My idea is to try running a file system check on the /boot or /root partition and see if that helps,
Running a filesystem check on an ext3  filesystem  |   Running a filesystem check on a reiserfs filesystem. A file system check is always a good idea.



GRUB  geom error

Quoted from the GNU/GRUB manual,
The location of the stage2 or stage1.5 is not in the portion of the disk supported directly by the BIOS read calls. This could occur because the BIOS translated geometry has been changed by the user or the disk is moved to another machine or controller after installation, or GRUB was not installed using itself (if it was, the Stage 2 version of this error would have been seen during that process and it would not have completed the install).

See this link: SDB:The Boot Process Hangs with the Message GRUB Geom Error


   
GRUB loading stage1.5

Looks like,
GRUB Loading stage1.5.


GRUB loading,please wait...

or you might see this message instead,
loading stage2
When your computer is booting up it stops at either of these messages in white print on a black background and does nothing more...
You can try to reboot by pressing your Ctrl + Alt + Del keys, but it will just do the same thing again.
First, the simplest thing -please check your CD drive and make sure there isn't an unbootable CD-ROM still  left in there from last time you used the computer, same goes for floppy disks too. I don't know why, but sometimes they can interfere with booting. (It's rare, but can happen).

This problem is more likely to occur when trying to boot up a newly installed system or after an internet update.
It can be caused by corrupted files in the /boot/grub directory.

You'll need to boot with Super Grub Disk, use the feature 'direct boot'

If you have only one Linux or a standard dual boot with one Linux and one Windows install 'English Super Grub Disk'-->'Gnu/Linux'-->'Boot Gnu/Linux Directly' will bypass those corrupted files and boot your operating system. (Even if they are not there at all)!

For advanced users who might be multiple booting or have a non-standard arrangement, go 'English Super Grub Disk'-->'Advanced'-->'Gnu/Linux Advanced'-->'Boot Gnu/Linux Directly'.
That will give you the opportunity to manually select the disk and partition of the operating system you need to boot.

Once you are booted up and running the system, it's easy to fix if you know the right terminal commands to use.   Just remove the corrupted files and replacing them with new ones.
First, save your menu.lst (or grub.conf), to your /home/username folder to get it in a safe place until you are ready to restore it again.  Then remove all those bad files in /boot/grub. Copy back your menu.lst, and reinstall GRUB. Here are the commands,
Code:
sudo cp /boot/grub/menu.lst .
sudo rm /boot/grub/*
sudo cp menu.lst /boot/grub
sudo grub-install /dev/hda
Where: /boot/grub/menu.lst is the correct file name and path for GRUB's configuration file in your Linux distro. If your distro has a different name for menu.lst, such as grub.config, and it's in a different directory, such as /GRUB, please feel free to alter these commands accordingly. Not all Linux distros require the use of the word sudo before each command either.
Note: It is best if you can copy and paste these commands to aviod typing errors.
If you do decide to type in your own commands, be aware that the '.' following the space at the end of the first command is a way of abreviating '/home/username' (directory), so the command will not work without the space and . after it.



Starting up...


Looks like this,
Starting up . . .




This error has been reported by Ubuntu user Erik when trying to boot Windows XP.
Erik solved this problem himself by unplugging a sata drive cable from the motherboard and  plugging it into a different sata port, where it used to be originally.
For details, see this Ubuntu Web Forums thread: Boot problem.




GRUB_ 

Looks like this,
grub>_


(With a non-blinking underscore).

If you see this GRUB error just after you installed Linux with Windows XP on a Toshiba laptop, and if it has an 'Express Media Player' partition, this is reported to conflict with GRUB, as it uses the first track of the hard disk which is normally reserved for boot loaders.
GRUB uses the first 15 sectors following the MBR for the optional stage1_5 of GRUB to be installed there. 
Deleting 'Express Media Player', has been reported to have successfully solved this problem.
 
If you don't want to delete your 'Express Media Player' partition, you can instead try doing without the optional stage1_5 of GRUB in the first track of your hard disk. Super Grub Disk has the ability to install grub without the 1.5 stage files: http://www.supergrubdisk.org/wiki/WindowsErasesGrub
Thanks goes to meierfra for the above information.

Otherwise, you might have to give up the idea of using GRUB installed to that hard disk. Restore the Windows Bootloader instead, with Super Grub Disk. English Super Grub Disk--> Windows --> Fix Boot of Windows, and try to find some alternative way of dual booting.
You can just boot your Linux with Super Grub Disk for now, and as soon as you feel like it, make a GRUB CD of your own.
The following website has advice peculiar to dual booting Windows Xp and Ubuntu when you have a Toshiba Laptop, Matthew J. Miller's HOWTOs: Dual Booting Ubuntu Linux and Windows on a Toshiba Laptop.



grub grub grub ...

Looks like,
grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_  grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_    grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_  grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_  grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_  grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_ grub>_
Check to make sure your hard drive(s) is/are properly detected and set up in your BIOS.

Try re-installing GRUB to MBR without stage1_5 by using GRUB's install command.

Refer to the following links,
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. -LinuxQuestions.org

GRUB GRUB GRUB GRUB - Scatter Gather Thoughts by Johan Petersson

Gentoo GRUB Error Collection


GRUB Stage1_5 and Stage2 Error Messages




Returns to a grub_  prompt instead of trying to boot

 A GRUB CLI prompt looks like this,
[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>_


(With a blinking underscore). This is a GRUB command line. You can type commands here to try to boot again, or to try to find clues about what might be wrong.
You can investigate a computer with  GRUB's command line. Type help for a list of commands you can use. Here is a link that will teach you how to use Command Line Interface (CLI).

Usually, this means GRUB's stage1 and stage1_5 files were able to find GRUB's stage2 in the operating system's partition but the stage2 can't find a menu.lst file to load a menu from.
Did you delete or rename the menu.lst file?
Did you move your menu.lst out of the /boot directory?

I had this problem while trying to boot Windows in a second hand computer I bought from a friend for a test computer. Even though I had though I had done a clean re-install, after several reboots I began to notice things were abnormal. Soon, it wouldn't boot Windows and left me at a GRUB prompt.
I found out that the entire Windows partition had been corrupted and looked as if it had been encrypted. (All the files were scrambled up and had strange filenames that consisted of a mixture of parts of words mixed with stange fonts amd symbols).
I have re-installed again and I am waiting to see if it happens again by itself. If not, it might have resulted from some experiments I was doing that could have corrupted the filesystem. I will repeat those experiments and see what happens.
Update: The problem has never returned, I think it probably was a virus in Windows and clean-re-installing Windows has removed the virus.



Operating System not found

Looks like this,
[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> root (hd1)

grub> chainloader +1 grub> boot
Starting up  . . .
Operating System not found

I got this message when I tried to boot a USB flash memory stick when it had an empty MBR.
Consider installing a boot loader to the MBR of the disk you are trying to boot.



Quoted from the GNU/GRUB manual
 1: Filename must be either an absolute filename or blocklist.
         This error is returned if a file name is requested which doesn't fit the syntax/rules listed           in the Filesystem
Link to the GNU/GRUB Manual on file system syntax and semantics: Filesystem

One way to produce this error on purpose at GRUB's Command Line Interface is to type something like 'kernel (hd0,1) vmlinuz'
The correct way to type it is with the forward slash to indicate the root of the file system, like this, 'kernel (hd0,1)/vmlinuz'

Check to make sure your menu.lst doesn't have a silly syntax error like that.



Quoted from the GNU/GRUB manual
2 : Bad file or directory type
This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO. 
Grub Error 2 seems to be a rare one.

Here's a link to the first instance of it I've noticed, [ubuntu] GRUB error 2... I want to kill my laptop.
Note the explanation by caljohnsmith in post #6 there, quote:
The reason why is because Intrepid now formats its partitions to use a 256 byte inode file system size, whereas previous Ubuntu verions used 128 bytes. The older Grub versions choke on the newer ext3 partitions that use 256 byte inode sizes, and Grub returns an error 2


Quoted from the GNU/GRUB manual
3 : Bad or corrupt data while decompressing file
This error is returned if the run-length decompression code gets an internal error. This is usually from a corrupt file. 
Try booting a different (maybe an older) kernel.



Quoted from the GNU/GRUB manual
4: Bad or incompatible header in compressed file
This error is returned if the file header for a supposedly compressed file is bad. 
Try booting a different (maybe an older) kernel.


Quoted from the GNU/GRUB manual
5: Partition table invalid or corrupt
This error is returned if the sanity checks on the integrity of the partition table fail. This is a bad sign. 
Check the partition table by running fdisk as root ('sudo fdisk -lu) in Linux, or use your favourite partition editing software to make sure one of your partitions has been marked 'active'.

GRUB's 'makeactive' command is used for setting a boot flag on a partition, so you can also do it with GRUB. Windows in particular requires a boot flag or it won't boot.

If more than one partition has already been marked as active, you might need to remove the 'active' flag from one of them, as only one is supposed to be set as active at a time. Use your favourite partition editing software for that.

If nothing else works, you might be able to use TestDisk to write you a brand new partition table.
TestDisk is an excellent Linux program that can scan you hard disk for partition starting blocks and identify those and offer you the chance to have the one you select written to a new partition table for you. TestDisk can do lots of other useful jobs as well. This website has its own page about TestDisk, TestDisk Page.

You should always back up your data before using any software to work on your partition table.
If you can't boot any operating system you might need to use a Live CD for doing that, and you can visit these links to learn how, File Systems and Mounting Page, SSH Network.


Quoted from the GNU/GRUB manual
6: Mismatched or corrupt version of stage1/stage2
This error is returned if the install command points to incompatible or corrupt versions of the stage1 or stage2. It can't detect corruption in general, but this is a sanity check on the version numbers, which should be correct. 
Run 'sudo grub-install /dev/sda', or 'sudo grub-install /dev/hda'.
The GRUB program lives in Ubuntu inside /usr/sbin, and the grub-install command runs a script that refreshes the GRUB files in /boot or overwrites the corrupted ones with files stored in /usr/sbin and re-installs GRUB's stage1 file to a MBR or boot sector and possibly stage1_5 (to the first track of a hard disk).

You will need to do a direct kernel (or symlink) boot from a GRUB CD or Super Grub Disk to boot into the operating system to run the grub-install command.
Another solution would be to 'chroot' into the system from a Live CD.



Quoted from the GNU/GRUB manual
7: Loading below 1MB is not supported
This error is returned if the lowest address in a kernel is below the 1MB boundary. The Linux zImage format is a special case and can be handled since it has a fixed loading address and maximum size. 


Quoted from the GNUu/GRUB manual
8 : Kernel must be loaded before booting
This error is returned if GRUB is told to execute the boot sequence without having a kernel to start. 
For example, it is normal to issue the series of GRUB commands for booting a Linux kernel in the following sequence,
  1. root
  2. kernel
  3. initrd
  4. boot
Code:
grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub>  kernel /vmlinuz root=/dev/hda2
           [Linux-bzImage, setup=0x1c00, size=0x157812]

grub> initrd /boot/initrd.img-2.6.15-25-386
         
[Linux-initrd @ 0x1f96a000, 0x675773e bytes]

grub> boot_
          uncompressing linux... OK, booting the kernel

You would get GRUB error 8 if you tried to boot without first specifying a kernel, for example,
Code:

grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub>  boot
Starting up ...
 
           Error 8: Kernel must be loaded before booting


Quoted from the GNU/GRUB manual
9: Unknown boot failure
This error is returned if the boot attempt did not succeed for reasons which are unknown. 


Quoted from the GNU/GRUB manual
10 : Unsupported Multiboot features requested
This error is returned when the Multiboot features word in the Multiboot header requires a feature that is not recognized. The point of this is that the kernel requires special handling which GRUB is probably unable to provide. 


Quoted from the GNU/GRUB manual
11 : Unrecognized device string
This error is returned if a device string was expected, and the string encountered didn't fit the syntax/rules listed in the Filesystem
For example, this error can be intentionally reproduced at GRUB's Command Line Interface by typing something like, 'root hd0,1' instead of 'root (hd0,1)'.  Look for a typo or syntax error.

This Ubuntu Web Forums thread contains a good example, GRUB: Error 11: Unrecognized device string. See how logos34 spotted the syntax error? Syntax errors can be very sneaky and it often takes a good eye to spot them.


Quoted from the GNU/GRUB manual
12 : Invalid device requested
This error is returned if a device string is recognizable but does not fall under the other device errors. 
It looks like this,
Error 12: Invalid device requested

Press any key to continue..._

I received this error after running GRUB's 'makeactive' command while trying to boot Windows XP in a logical partition.
GRUB's 'makeactive' command is for setting the boot flag on a partition, to make that partition 'active'.
GRUB can't set a boot flag in a logical partition as far as I know,and that's why it gives error 12.
Normally, Windows is only bootable in a primary partition. However, the Windows  default method of dual booting more than one Windows system deleted the vital boot loader files from the new Windows system being installed and copies them into the old existing system.
The subsequent Windows installation can only boot via the original installation. In this case, Windows users call their original installation their 'boot partition'.
Unfortunately for Windows users, once the installation has been completed that way, it means if they delete thier original installation, it becomes impossible to boot their new installation, which is normally in a logical partition, just to make things even worse.

For more information see, Understanding MultiBooting and Booting Windows from an Extended Partition Dan Goodall.

That is why Windows users are better off dual or multi booting with GRUB.
GRUB is a much better bootloader and boot manager than Windows' own bootloader when it comes to dual or multi booting. GRUB provides Windows users with special tools such as the ability to hide and unhide partitions to allow a subsequent Windows to be installed independantly of an existing installation. Then each installation retains it's vital boot loader files and remains independant.

There are lots of ways for Windows users to use GRUB, even without installing Linux.
They could install WINGRUB, GRUB4DOS and WINGRUB Project Homepage. WINGRUB is very good, I have tested it in a FAT32 filesystem Windows XP Home Edtition and it is currently working very well for me. Otherwise it is easy to download and use Super Grub Disk or make their own GRUB floppy disk or CD.

If Windows is already installed, the damage has already been done. There are two ways to make a Windows installation in a logical partition bootable again.
 
One way to possibly recover your Windows installation might be to make a lot of room on the disk somewhere with GParted -- LiveCD or Gnome Partition Editor in a Ubuntu Live CD. Make a new primary partition big enough to copy and past the whole Windows partition into, so it will be in a primary partition now.
Then make a Windows Xp boot floppy, Click Here for a how-to. Then try to boot it.
A website that is extremely helpful when Windows XP is impossible to chainload is this one, How to fix: NTLDR is missing, press any key to restart by Miles Comer. You can download boot discs from this site now that have the needed Windows files that would have been deleted with your primary partition, those should help you.
Vista users, go here: 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).  
After Windows boots up copy the three vital Windows XP boot loader files from the floppy disk or the CD to the root of the Windows partition. I have tested this several times myself and I know that it does work in a test computer. After that, you should be able to boot Windows with GRUB without any problems.
What I am not so sure about is if it's okay to copy and paste a Windows partition without activating any anti-piracy software booby-traps that could include a count-down timer. Windows might stop working some day when you least expect it. I have read that these things exist in proprietary software but I'm not sure as I haven't kept a test install for that long.

A second way to make Windows bootable in a logical partition is to use GParted -- LiveCD or Gnome Partition Editor in a Ubuntu Live CD to set the boot flag in the logical (Windows) partition. GRUB can't do that, but a partition editor can.
Then you need to either delete or at least 'comment out' the 'makeactive' command from your /boot/grub/menu.lst file so GRUB will skip trying to move the boot flag and won't be stopped with the 'Error 12' message.
You will need to download a boot discs from this site, How to fix: NTLDR is missing, press any key to restart by Miles Comer. Boot discs from that site have the needed Windows files that you would have been deleted with your Windows primary partition, that boot CD should boot Windows for you.
Copy the three vital Windows XP boot loader files from the floppy disk or the CD to the root of the Windows partition and Windows should now be bootable from GRUB.
Vista users, go here: Windows Vista Recovery Disc Download - Neosmart.net, thanks lswest for the link. Thanks for the download to ComputerGuru, of NeoSmart Technologies (the developer of EasyBCD).  


Quoted from the GNU/GRUB manual
13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD). 
 When trying to boot Linux
Are you trying to chainload a Linux partition by the boot sector?
The first sector of a partition is often called the 'boot sector', as it can have boot loader code installed there. With Linux it is optional to have any boot code in the first sector of the partition and it isn't installed there by default in most distros. You have to install your bootloader to the partition yourself.
After you do that, then you can use the chainloader command and it should boot.

If you were using the kernel command to boot Linux directly, and you got the GRUB error 13 message,  it might be that you have just received a kernel update and your new kernel update didn't go as planned. Something could be corrupted or incomplete there somewhere.
There is normally a list of kernels in your GRUB menu that you can boot, entries for the newest kernels are added to the top of the list.  
You can try booting an older kernel by scrolling down your list in your GRUB menu and boot up with a known good kernel. Then use Synaptic Package manager or apt-get if you know how, to uninstall the corruped kernel. Try updating it again and hope for better luck this time.

When trying to boot Windows
The chainloader command is the only way to boot Windows from GRUB.
GRUB's chainloader command finds Windows boot sector and hands over control of the booting of Windows to Windows' boot loader there. GRUB does not actually boot Windows at all.
For this to work, the Windows boot sector must be okay, if it is corrupted, Windows can't boot.

One user reported receiving this error when trying to boot Windows and found the Windows bootsector had been corrupted somehow.
The FIXBOOT command from a Windows recovery console would normally be the recommended way to repair a Windows bootsector and other files, but not all Windows users are able to access a recovery console easily.

In an NTFS partition, the backup of boot sector is stored in the last sector of the partition.
I don't know the ntfsprogs command for restoring that yet.
TestDisk is a program you can install in Ubuntu, and TestDisk can easily restore the boot sector in an NTFS partition from the backup, or even rebuild an NTFS boot sector, TestDisk has their own page with illustrations, here is a link, TestDisk Step by Step.

If you want to install TestDisk in Ubuntu, use a command like this,
herman@bookpc:~$ sudo apt-get install testdisk

To run TestDisk, you start it with the testdisk command,
herman@bookpc:~$ sudo testdisk

If it's a FAT32 file system in Windows you should be able to fix it from Linux. Run dosfsck -ar on it, refer to this link: When the bootsector is not the same as its backup


Quoted from the GNU/GRUB manual
14 : Filesystem compatibility error, cannot read whole file
Some of the filesystem reading code in GRUB has limits on the length of the files it can read. This error is returned when the user runs into such a limit.



Quoted from the GNU/GRUB manual
15 : File not found
This error is returned if the specified file name cannot be found, but everything else (like the disk/partition info) is OK.


First for example, if you get this error during booting, maybe GRUB is telling you it can't find the specified kernel or initrd.img file. Usually this is because of a mistake in editing your menu.lst file, for example, the exact path or name of your kernel or initrd.img contains an error or a typo.
title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,2)
kernel        /boot/vmlinux-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
'vmlinuz' is spelled wrong here, it is 'vmlinuz', not 'vmlinux'.

title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,2)
kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash
initrd        /boot/intr
id.img-2.6.20-15-generic
quiet
savedefault
'initrd.img' is spelled wrong here, it is 'initrd.img', not 'intrid.img'.

Super GRUB can boot your operating system by symlinks to the kernel if you use, from the Main Menu,--> Boot Gnu/Linux and  Other OSes --> Boot Gnu/Linux -->...
Boot with Super GRUB Disk or some other GRUB's Command Line Interface instead, and then with your operating system running you can check your file and correct your menu entry for Linux.
Open your menu.lst file with 'sudo gedit /boot/grub/menu.lst', if you are using Ubuntu Linux.
Use the command 'ls /boot' to check for the correct name for your Linux kernel and initrd.img.
Copy the correct name from the terminal output to the text file and paste it to avoid typos.
Don't forget to save the changes in your menu.lst file before your close it.

A Second, reason GRUB Error 15 can occur is when using the 'configfile' command from some other (older) GRUB to boot Intrepid Ibex's (or later) via the new menu.lst file which now features the uuid instead of root (hdx,y) line.
title        Ubuntu 8.10, kernel 2.6.27-7-generic
uuid        4d4939f2-de30-438a-896f-af6a77406eea
kernel        /boot/vmlinuz-2.6.27-7-generic root=UUID=4d4939f2-de30-438a-896f-af6a77406eea ro quiet splash
initrd        /boot/initrd.img-2.6.27-7-generic
quiet
A booting stanza from Ubuntu Intrepid Ibex's and later's /boot/grub/menu.lst file, (above).

Intrepid's GRUB has a special patch (additional code) for enabling the use of the uuid number instead of the traditional 'root  (hdx,y) notation for telling GRUB which partition to boot.
Older or standard versions of GRUB don't have the patch, therefore, they can't understand the uuid command, and so they error out.

To fix that, one obvious workaround would be to replace the uuid line in Intrepid's (or later) menu.lst with a conventional 'root  (hdx,y)' line instead.
Or, even better, you could install that operating system's GRUB stage1 to the boot sector of it's partition and use the chainloader command to boot it instead, and leave the menu.lst as it is, keeping the uuid line.
The uuid line is an improvement to GRUB, it means that we can plug in USB drives or more hard disks without upsetting GRUBs drive numbering system and thus throwing GRUB out of whack.
Re: [SOLVED] duel booting multible versions of linux - (see post #36 and later), Ubuntu Web Forums.


Third, this error can also occur if the files needed to boot with are missing or corrupt in the /boot/grub directory. Refer to Grub loading stage1.5 for how to completely delete possibly corrupted GRUB files and restore them again from /sbin/grub.


Quoted from the GNU/GRUB manual
16 : Inconsistent filesystem structure
This error is returned by the filesystem code to denote an internal error caused by the sanity checks of the filesystem structure on disk not matching what it expects. This is usually caused by a corrupt filesystem or bugs in the code handling it in GRUB.
Try a file system check.

If you have a GParted -- LiveCD you can boot that and right-click on the filesystem you need to check and select 'check' from the right-click menu. That will fix a lot of filesystem problems. A GParted LiveCD is free and only a small download (45 MB or so), and it is almost indispensable.

If that doesn't work or you would rather use your own commands for filesystem checking, see this website's File Systems and Mounting Page. Type 'man fsck', 'man e2fsck', or 'man reiserfsck' into an terminal and make up a command with the right options to fix your specific filesystem problems.

Check your SATA drive cables, especially if you have recently been reaching inside your computer case. Are they plugged in nice and snug?
Ubuntu user halw in the following post had GRUB error 16 intermittently and loose SATA cables are suspected, Grub Error 16 (halw).



Quoted from the GNU/GRUB manual
17 : Cannot mount selected partition
This error is returned if the partition requested exists, but the filesystem type cannot be recognized by GRUB.

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

Ubuntu Intrepid Ibex and Ubuntu Jaunty Jackalope are pretty near immune from most of the old causes of GRUB Error 17, because GRUB can find the operating system's specified boot and root partitions by the file system UUIDs now instead of using hard disk and partition numbers for booting with.
With the use file system UUID numbers, GRUB can find the correct partitions and boot even if the operating system is in a USB flash memory stick at the end of a whole daisy chain of other flash memory sticks and USB devices. I have tested it myself and it works every time. You can mix IDE and SATA drives, and add or remove hard disk drives and it won't affect your booting, (except if you remove the first hard disk). 

GRUB Error 17 in Ubuntu versions later than Hardy Heron is almost always caused by a file system problem in your Ubuntu partition. A file system check should fix it in almost all cases. This is a good thing to try first because a file system check is always helpful even if the file system is okay and it may solve the GRUB Error 17 problem right away if the file system did need repairing. A lot of people have solved their GRUB Error 17 problems simply by running a file system check.
See this website's Running a filesystem check with GParted  for a user friendly GUI method of running a file system check in your Ubuntu partition from a Ubuntu Live CD.
Even better, if you prefer the command line, see Run a filesystem check on an ext3  filesystem for how to run a manual file system check and fix your Ubuntu partition's file system.



INFORMATION BELOW HERE IS OUT OF DATE BUT STILL INCLUDED FOR USERS OF OLDER OPERATING SYSTEMS
Other Linux distros such as Linux Mint, which are slow to convert to the use of uuid numbers for booting with, are still prone to GRUB Error 17.
There were three different situations when we used to get GRUB error 17 in older versions of Ubuntu,

When trying to boot Linux (even if you only have one hard disk)
Check your /boot/grub/menu.lst file and make sure to check your operating system entry's 'root (hdx,y)' details are correct.
For example,
title        Linux Mint 6, kernel 2.6.27-7-generic
root        (hd0,1)
kernel        /boot/vmlinuz-
2.6.27-7-generic root=/dev/sda2 ro quiet splash
initrd        /boot/initrd.img-
2.6.27-7-generic
quiet
savedefault

If you have used hard disk partitioning software recently and you have copied and pasted your partition that contains GRUB, it probably has a different partition number now than it had before.
Some partition editors (especially proprietary ones), think that partitions should be numbered in disc order so they renumber you partitions on you without telling you. That's one cause of GRUB Error 17.

If that's the case, you probably need to
(a) Consider upgrading to a more recent version of Ubuntu.
(b) edit your /boot/grub/menu.lst file to make it point to the correct hard disk and partition number
(c) re-install GRUB's IPL to MBR in your first hard disk


(a) Upgrade to a more recent version of Ubuntu or install a more recent version


(b) edit your /boot/grub/menu.lst file
One way to fix your Ubuntu operating system is by using a Ubuntu Live CD to gain access to your /boot/grub/menu.lst and other vital files, as explained with the following link: Mount a Ubuntu ext3 or reiserfs filesystem rescue your Linux system with a Live CD.
Another way is to boot with Super Grub Disk and then access your files the normal way.
You will have to find the 'Boot Gnu/Linux Directly' option in Super Grub Disk, the other booting methods use the configfile command or the chainloader command won't work in this situation.


Whichever way you do it the idea is to check and repair your operating system's entry in menu.lst.
You'll need to check the current partition number with fdisk or Gnome Partition Editor.

(c) re-install GRUB's IPL to MBR in your first hard disk
You may need to Re-install GRUB using your Linux Live CD, or if you prefer, you can use Super Grub Disk to re-install GRUB.

If you tried the solutions above and it does nothing helped, try this solution posted in to Ubuntu Web Forums by AmericanYellow, here is the link, Grub error 17
(Make sure your hard disks are properly detected in your BIOS and set to AUTO, (not LBA, large or normal). Thanks AmericanYellow for that information.

redenex, also in the same thread, solved his GRUB error 17 problem with a file system check. That has worked for quite a few other people as well.



In a computer with more than one hard disk
GRUB error 17 could be caused by any of the above mentioned problems for single hard disk machines or else some confusion or disagreement between your computer's BIOS, the Linux kernel, and GRUB over which hard disk is the first hard disk and which is the second hard disk and so on.  
This only applies to older versions of Ubuntu, Hardy Heron and earlier, and Linux Mint and other distros.
Consider using the uuid command in your menu.lst file or consider upgrading to a more recent version of Ubuntu.

Symptoms include GRUB being installed to MBR on the wrong (non-first) hard disk, and the /boot/grub/menu.lst file having the hard drive numbering wrong in each operating system entry.

Mixed IDE and SATA hard disks
Error 17 also commonly occurs when we have a mixture of IDE and SCSI or SATA hard drives plugged into the same motherboard.
If this is your situation, just try switching the 'Hard Disk Boot  Priority' around in your BIOS.
Here's a series of illustrations showing how I do mine, Changing the hard Disk Boot Priority.
I realize of course that most computers will have a different BIOS from mine, it would be impossible to give exact information that will suit everyone, but you should be able to see what I mean.
This method is proving to be the fastest, easiest and best solution for GRUB Error 17.
No time consuming editing of files or re-installing GRUB is necessary when the problem can be solved this way.
This method worked for NavyRST in the following thread: HOW-TO install boot loader from Ubuntu.
This solution should be fine for most computers, and it's well worth a try before resorting to editing configuration files and re-installing GRUB.

Another thing that can definitely cause this kind mix up  is when someone changes their hard disk Boot Priority in their BIOS in a computer that was working okay.  Therefore, it is not too surprising that one of the best solutions to this problem is to try switching the order of your hard drives back again.

PATA Settings and Connections
GRUB Error 17 is also likely to occur if you have PATA hard drives (IDE) and you or your computer technician made a mistake with the way they are plugged in and jumpered, (master, slave or cable select).
Shine a light around inside your PC case and check your the way your PATA disks (including your CD/DVD drive), is plugged in and jumpered.

A PATA ribbon cable with black plugs is a standard PATA cable, and a cable with color coded plugs is a 'Cable Select' type of PATA ribbon cable.

The use of a standard PATA cable requires the hard drives to be jumpered as 'Master' and 'Slave', (even CD/DVD drives as well).

If your PATA ribbon cable is the 'Cable Select' type, the blue end should be plugged into your motherboard socket, the grey plug is for the 'Slave' hard drive, and the black plug is for the 'Master' hard drive.
You should set the jumpers to 'Cable Select' on all drives connected with this kind of ribbon cable.

Make sure your hard disks are properly detected in your BIOS too, and set to AUTO, (not LBA, large or normal). Refer to this thread,  Grub error 17, thanks AmericanYellow for that information.

GRUB Command Line Interface method
A great way of solving GRUB Error 17 is to boot to  GRUB's Command Line Interface, by pressing your 'C' key when you are at your GRUB menu during boot-up.
If you don't get GRUB menu during boot-up, you can still get a GRUB Command Line from Super Grub Disk, or any CD, floppy disk or USB device with GRUB installed in it.
Read what I have in that link and try to boot your computer from the command line.
Write down the commands you use that work, because they are the same commands you need to use for editing your /boot/grub/menu.lst file so you will be able to boot with GRUB automatically from now on.
You may also need to re-install GRUB, if it has installed to the wrong hard disk's MBR.

This problem only happens when GRUB is installed automatically by a new operating system being installed in a computer.
This never happens, (or people don't complain of it very often), when GRUB is installed manually from the command line or by Super Grub Disk, because in those circumstances it is the user who directs GRUB to install somewhere. 
It doesn't seem to me to be really GRUB itself that makes the mistake, it seems more likely to be whatever the operating system's grub-install script queries to determine the order of the devices, (probably the BIOS I would guess).
I have read that this problem is difficult to solve for all computers, since the programs are already set up to suit the majority of BIOSes, and any changes made to make the situation better for some will also make things worse for others.
GRUB is already the best boot loader I know of for configuring itself automatically most of the time, so it's probably not fair to blame it for not being perfect, especially when it could be that hardware and BIOS peculiarities are also to blame.

Device.map method
Some people claim editing the /boot/grub/device.map file and re-installing GRUB does it for them.
Boot with another GRUB, such as Super Grub Disk, and edit the /boot/grub/device.map and re-install GRUB (to the correct device this time). Here is a link with more details about that, Editing GRUB's device.map

Probably you would also need to edit your /boot/grub/menu.lst as well.
Don't forget to edit your Debian automagic kernels list too, (in the lower-middle of your menu.lst file), to make the changes permantent over a kernel update. groot=
Then run update-grub, just to make sure.
Code:
herman@amdxz:~$ sudo update-grub

Or, leave the /boot/grub/device.map as it is and just edit /boot/grub/menu.lst wrongly to suit, because two wrongs actually do make a right, at least in this instance.

One way to fix your Ubuntu operating system is by using a Ubuntu Live CD to gain access to your /boot/grub/menu.lst and other vital files, as explained with the following link: Mount a Ubuntu ext3 or reiserfs filesystem rescue your Linux system with a Live CD. Or boot with Super Grub Disk and then access your files the normal way. 

Consider upgrading to a more recent version of Ubuntu.
 


When trying to boot Windows
having the NTFS file system (even if you only have one hard disk)
GRUB error 17 can be caused by using the 'root' command instead of 'rootnoverify'
It is a little better to use 'root' if you have the FAT32 filesystem, but use 'rootnoverify' for NTFS.
Edit your commands in your menu.lst or grub.conf file with 'rootnoverify' to get rid of this error message.
For example,
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Microsoft Windows XP Home Edition
rootnoverify        (hd0,0)
savedefault
makeactive
chainloader    +1


Quoted from the GNU/GRUB manual
18 : Selected cylinder exceeds maximum supported by BIOS
This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB in general).
The error message (above)  from the GNU/GRUB manual dates back to the old days when new computers were just beginning to use hard disks that exceeded the 8.45 GB limit.  If you have an old computer that was made back in the late 1990's or earlier, this error message could be absolutely correct. Some computers made as late as 2001 report this error. There are even a few  newer computers that this applies to as well.
The 8.45 GB BIOS hard drive limit was reached when the CHS, (Cylinders, Sectors and Heads) system for plotting the co-ordinates of sectors in the hard disk reached the maximum number of sectors it could address.

Windows users were limited to 8.45 GB by its CHS addressing scheme, but that didn't stop larger hard disks from being invented and used.
A famous Linux method for utilizing larger hard disks than 8.45 GB was to create a separate /boot partition containing GRUB and the Linux kernel entirely within the 8.45 GB limit in the first hard disk.
Linux users could leave room for Windows to be installed within the 8.45 GB limit if they wanted to also have Windows.
As long as the Linux kernel was placed somewhere inside the limit, so the BIOS could 'see' it and boot it, the Linux kernel could manage a file system which was located outside the limit. This was possible because Linux was the first to use LBA addressing. Using LBA addressing means that to the Linux kernel, all the sectors in the hard disk are numbered from 0 to whatever number was necessary. Therefore the hard drive was seen more like a roll of film that could be any number of sectors long.   Linux wasn't restricted to only the first 1024 cylinders that the BIOS could 'see' with the old CHS addressing scheme.
Clever Linux users installed the Linux /root partition outside the limit and in that way they could then make use of much larger hard disks.

Historic Link:
http://www.win.tue.nl/~aeb/linux/Large-Disk-5.html

Now, technology has also passed the 33.8 and 137 GB hard drive limits too, so bear these two in mind as well, when diagnosing error 18 faults. The GRUB error 18 message could nowadays be referring to the 137 GB BIOS hard disk size limit. This occurs when a machine was made for an 80 or 120 GB hard disk, and someone fits a 137 GB+ hard disk in thier machine without checking if the BIOS supports it.
Windows XP will work okay because it is usually installed in the first part of the hard disk, so the average user is blissfully unaware of the situation until they maybe install Linux on the second half of their hard disk, past the BIOS limit and get GRUB error 18.

Reduce the size of the Linux partition
One way of coping this problem which is reported to have worked for some people is to just try reducing the size of the Linux partition. (thus forcing the Linux kernel to be located be inside the limit). I have participated in one or two Ubuntu Web Forum threads where that seemed to solve the problem. A data partition can be used to fill the rest of the hard drive so it won't be wasted.
I have also read of three separate instances where users claimed that installing Linux '/' (root) on a logical partition instead of a primary partition cleared this problem up for them. (..."Go figure?"..!)


Making a separate /boot partition would probably still be the best answer even with a relatively modern computer if you think you might have the 137 GB hard drive limit.
In the following thread, Ioza had a system that wouldn't boot after and upgrade from Feisty to Gutsy. Here is the link, http://ubuntuforums.org/showthread.php?t=582855
Apparently, an operating system that is partly inside the hard drive limit may boot for some time as long as the kernel happens to be located within the part of the disk that the BIOS can 'see'.
After an update, if a newer kernel  happens to be placed somewhere outside the limit, the operating system might suddenly become unable to boot (at least by the new kernel), and most users would find it difficult to understand the reason why not.
Here is a great explanation of how that might happen, also already linked to in the above link, http://www.nabble.com/Grub-tf4291271.html#a12218543
That might also explain the real reason why resizing the Linux partition to a smaller size has helped some people cure GRUB error 18.  A separate /boot partition could have fixed that and allowed them to make better use of their hard disk.
Here's how to make a separate /boot partition: How to make a separate /boot partition.
Actually, if it's a brand new installation and still empty, re-installing would probably be a lot easier, and you can create the new boot partition at the same time as you re-install.

TIP: I helped a fellow who had an Asus EeePC 701 and the SSD drive wouldn't work so he installed Ubuntu in a 1 TB external HDD, but it threw GRUB Error 18 at us and it wouldn't boot. We fixed it by copying his /boot files into a directory in a USB flash memory stick and making that into a separate /boot partition according to the link just given above.

BEFORE YOU DO ANYTHING, check your computer's BIOS date and settings in case your BIOS can be updated instead.

You can check the date of your computer's BIOS by going into 'setup' by pressing the appropriate key during the early stages of booting, something like this: Getting Product Information.

Here is a list of BIOS hard disk limits and some approximate dates when these ways to overcome these limits were invented.
2.11 GB or 4095 cylinder limit
3.26 GB or 6322 cylinder limit
4.22 GB or 8192 cylinder limit _______________________________(around 1997 or earlier)
8.45 GB Standard INIT13 limitation (CHS[1024x256x512)____(around late 1990s)
33.8 GB or 66,060,287 LBAs limitation _______________________(August 1999)
137 GB or 268,435,455 LBAs limitation (28-bit limit) _________(September 2001)

You could check at your motherboard manufacturer's website, (find it with google), to see if there is a newer update for your machine's BIOS available. If so, you can download it and try 'flashing the BIOS'.  That has been reported to have solved this problem many times.

BIOS settings
If you don't think the BIOS date could be your problem, or there is no more modern BIOS flash available for your BIOS, then at least check and make sure your hard disk is being correctly detected and set up in the BIOS.
Quote:
" I had the same problem. Error 18 and After GRUB. The solution is in the bios.
Put the hard disk detection on auto and not on user. It did the trick for me."
 * Make sure LBA is enabled in your BIOS. If LBA is already enabled, try switching to 'normal' mode and see if that helps.
Remember, the old 8.0 GB limit was overcome when the old CHS (Cylinder, Heads, Sectors) method for dealing with hard disk addressing (disk geometry) was replaced by LBA (Logical Block Addressing). (Numbering each sector of the hard disk starting with the MBR and counting upwards).  

* Check your hard Disk Boot Priority in CMOS.
I am able to produce this error if I have operating systems installed in more than one hard disc in my computer and I either remove my first hard disk or switch the hard disk order around in my BIOS.  Therefore maybe it should be possible to cure this grub error for in some instances by reversing with the hard disc order in the BIOS. You can try, it might help or maybe not, but it's worth a try. I know you can certianly scramble things up that way, so it seems logical, (notwithstanding Murphy's Laws), we should be possible to unscramble things this way too.
 (I actually work with an Ashley Murphy, he's a good friend of mine).

 * Check your IDE hard drive cabling and jumper settings 
If your hard drives are connected to your motherboard by IDE cables that have black plugs, or all plugs of the same color then probably you have a non cable select IDE cable.
If you have non cable select IDE cables then you should make sure your first hard disk is jumpered as Master and your second hard disk is jumpered as Slave on your first cable, and the same thing on your second IDE cable, even if one or two of your drives are CD-ROM drives.

If your IDE cable has a blue plug connected to your motherboard and a black plug for the Master of first hard disk and a grey plug for the slave or second hard disk then you should make sure you have your jumpers all set to 'cable select' position.

There are stickers on all hard drives to tell you how to position these jumpers.

Make sure you have the blue plug plugged into the motherboard and the black plug plugged into the master and the grey plug if used, plugged into the slave drive. Please refrain from using the blue plug for a hard drive and a different plug for the motherboard even if cable length or spacial restrictions make this idea seem attractive. It isn't ! A longer IDE cable is very cheap, like about a dollar or so, and sometimes you can even get one thrown in for free with a reasonable purchase from a freindly computer store.

Ways that older Windows computers used to overcome BIOS/Hard drive limits
If you have an older Windows machine, the use of 'Disk Manager' (break the 528 mb IDE barrier!) software is a way for Windows users to utilize a hard disk larger than the machine's BIOS would normally support.

For a slightly more modern example, there is 'OnTrack Disk Manager' (for the 37 GB barrier).

Since those install in the first track of the hard disk, GRUB users should be aware of them in case GRUB's (optional) stage1_5, which installs in the first track of the hard disk, overwrites the disk managment software.  People who know they have software in the first track of their hard disk should consider using LiLo instead.

'On Track Disk Manager' (for the 137 GB limit).
I'm not sure because I can't see it mentioned anywhere in the documentation, but I believe these are still installed somewhere in first track of the hard disk, so if your old computer does have a disk manager, (not needed for Linux), you should be careful when installing GRUB because GRUB will want to install its optional stage1_5 to the first track as well.  I cannot see anywhere where they say it is compatable with Linux either.

As far as I know, the use of disk management software is quite rare these days. Anyway, you would not be likely to need one if you install Linux in the second half of your hard disk.

The use of disk manager software might be another reason why a computer user might install Linux and then find that Linux doesn't boot in their computer. It's not GRUB or Linux's fault at all, it's because the user is unaware of the fact that their hard disk is larger than their BIOS can support.



Quoted from the GNU/GRUB manual
19 : Linux kernel must be loaded before initrd
This error is returned if the initrd command is used before loading a Linux kernel. 
For example, it is normal to issue the series of GRUB commands for booting a Linux kernel in the following sequence,
  1. root
  2. kernel
  3. initrd
  4. boot
Code:
grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub>  kernel /vmlinuz root=/dev/hda2
           [Linux-bzImage, setup=0x1c00, size=0x157812]
grub> initrd /boot/initrd.img-2.6.15-25-386
         
[Linux-initrd @ 0x1f96a000, 0x675773e bytes]
grub> boot_
          uncompressing linux... OK, booting the kernel

You would get GRUB error 19 if you tried to place the initrd command before the kernel command. For example,
Code:

grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub> initrd /boot/initrd.img-2.6.15-25-386

Error 19: Linux kernel must be loaded before initrd          




Quoted from the GNU/GRUB manual
20 : Multiboot kernel must be loaded before modules
This error is returned if the module load command is used before loading a Multiboot kernel. It only makes sense in this case anyway, as GRUB has no idea how to communicate the presence of such modules to a non-Multiboot-aware kernel.



Quoted from the GNU/GRUB manual
21 : Selected disk does not exist
This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system. 
For example if there are two hard disks in the computer and the boot entry in menu.lst has a mistake in it making it point to (hd2,y) which would be a third hard disk, you would get this error message. The third hard disk that doesn't exist. This could be a human error from someone manually editing the command and getting mixed up about GRUB's numbering system, maybe they forget to start counting from zero.

title        Ubuntu, kernel 2.6.20-15-generic
root        (hd2,0)
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

I have read of this error being described after the number 2 hard disk with the Linux installation on it has been removed from the machine. GRUB had been installed in the MBR in the number 1 hard disk, and when the number 2 hard disk was removed, the machine could not boot anymore, and showed 'grub error 21'.

This is because bootloaders have two or three parts. The first part, called 'stage1', normally is very small, and lives in a special part of the MBR. The second part, called 'stage2', is much larger and lives in the operating system itself. Other bootloaders work the same way too.

Basically the only work the small part (stage1) has to do is to find the other, larger part, 'Stage2'.
It is 'stage2' that does all the hard work, it can because it is bigger.
In the case of GRUB, there is also another part called 'stage1_5' which helps 'stage1' to find the other part.

When the hard disk that contained the operating system has been removed, GRUB cannot work because the larger part of it is gone.
The first part of GRUB, which is very small and whose only job is to find the larger part, gets help from stage1_5, but if the hard disk with stage2 on it is gone, they cannot find stage2 of course, so they complain by printing out this error massage.

Please put the hard disk with stage2 in it back into the machine, and/or make sure it is properly plugged in and detected and set up in the BIOS.
If you happen to be using a hard disk larger than 137 GB, see also error 18.


Other ways to solve this problem might be, (depending on your circumstances and the situation),
  • re-install GRUB from an operating system that is in another hard disk that is to remain in the machine.
  • install a different boot loader or boot manager to MBR that belongs to an OS that is to remain in the machine. (re-install GRUB).
  • go into bios and check if the hard drive controller is "off", if so change to "auto".
Super Grub Disk can easily and quickly install a different bootloader's stage1 to MBR of your first hard disk for you.
If it is another Linux system with GRUB or LiLo, look in Super Grub Disk's Gnu/Linux for options.
If you want a Windows bootloader's stage1 written back to MBR again, look in SGD's Windows.
If your computer still has more than one hard disk, look in Advanced for menus that are designed to offer you the most options.




Quoted from the GNU/GRUB manual
22 : No such partition
This error is returned if a partition is requested in the device part of a device- or full file name which isn't on the selected disk. 
For example there might be a mistake in the menu.lst file in the partition number, if there is no such partition as specified in the 'root (hdx,y)' line.
example,
title        Ubuntu, kernel 2.6.20-15-generic
root        (hd0,4)
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

Look at your partitions with your partitioning software or run 'sudo fdisk -lu' in a terminal and make sure you have the partition number correct here in your menu.lst boot entry.

This is also the error that people often see after they delete their Linux partition but they still have that partition's GRUB's stage1 written in the MBR.

They can easily cure that by overwritting the existing GRUB IPL code with code for another bootloader in another operating system.
In other words either re-install GRUB or re-install Windows bootloader or some other bootloader or boot manager. In Super Grub Disk, go 'English Super Grub Disk'-->'Windows'-->'Fix Boot of Windows', or see my 'Un-install Page'.
Don't bother doing anything if a new (Linux) operating system will soon be installed, the new operating system will install a new bootloader and cure this error automatically.

If there is another operating installed in the computer, re-writing the bootloader'e MBR code for that operating system's bootloader and overwriting the now useless GRUB code will cure the problem. This can be easily done with Super Grub Disk.
1) Re-install a GRUB to MBR from another Linux
2) Re-install a Windows Bootloader to MBR.
     (These two above items are both options in Super Grub Disk that can be selected and SGD will do it for you).

I got GRUB error 22 myself one time after doing quite a lot of work to the partitions in my wife's computer. I tried to fix the boot of grub with an older version of Super Grub Disk, not realizing her partition numbers had been unexpectedly changed somehow by disk partitioning software.
I installed grub from the wrong partition by accident.
Later I found out the real cause of all the trouble was a dirty DVD/CD-ROM drive that caused read problems from my partitioning CD.

 Anyway I got  Grub Loading Stage1.5
       Grub Loading Stage1.5
       Grub Loading Stage1.5
       Grub Loading Stage1.5...and so on, scrolling endlessly down the monitor.

I couldn't even boot with Super Grub Disk's 'English Menu'-->'Gnu-Linux'-->Boot Gnu/Linux Directly'.
After much mumbling and head scratching and trying various ideas I decided to run a file system check with my GParted -- LiveCD. When that was done I clicked on the triangular buttons for a report and found that GParted LiveCD had repaired quite a few problems in that filesystem.

So tried again, this time from the Super Grub Disk menu I pressed 'c' for a Super Grub Command Line Interface, and booted manually using a direct kernel style boot
The operating system booted and I was able to re-install Grub to MBR, and configure menu.lst with new partition numbers.

GParted LiveCD saved the day for me. I didn't have to sleep in the doghouse after all! :)
The lessons here are,
1. keep my CD-ROM drives clean, and
2. to try a filesystem check if I am having unusual troubles booting.

It's easy to run a file system check on any file system with a GParted -- LiveCD, just boot with the CD and click on the filesystem (partition) to be checked and click 'check'.
Click 'Apply' (on the toolbar), and then 'Apply' again (in the confirmation box).
Then wait a few minutes.
When it's finished it's a good idea to click on the arrow shaped 'Details' button in GParted to expand the output box. Make sure you click on all the subsequent arrow buttons too, so you will expand it all fully so you can read the report and see what was done to fix your file system.
See my File Systems and Mounting Page for more about file system checking in Ubuntu.


Quoted from the GNU/GRUB manual
23 : Error while parsing number
This error is returned if GRUB was expecting to read a number and encountered bad data. 
For example, this error can be reproduced in CLI mode GRUB by typing 'root (hdO)' insetad of  'root (hd0)'.

The '0' in  '(hd0)' is a number zero, not a capital letter 'O'. If you type a capital letter 'O' in pace of a number '0' in this context, you will receive this error message.

I try to make sure there is no confusion between the number 0 and letter O in my web pages by using bitstream vera sans mono font wherever I think of it, that way the number 0 has a dot in the middle of it like terminal font.
For example, you can see that 0 is different from O.



Quoted from the GNU/GRUB manual
24 : Attempt to access block outside partition
This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk or a bug in the code handling it in GRUB (it's a great debugging tool). 
If you get this error message when trying to boot Linux, try running a file system check.
Type 'man fsck', 'man e2fsck', or 'man reiserfsck' into the terminal and make up a command with the right options to fix your specific filesystem problems. It is easiest to run a file system check from a live cd. See this website's Running a filesystem check on an ext3  filesystem or Running a filesystem check on a reiserfs filesystem for more info.

If you get this error message when trying to boot Windows,
Ubuntu user jogui reported that editing the boot stanza for Windows from 'root' to 'rootnoverify' solved the problem when this error message was received when trying to boot Windows XP.
Here is a link to jogui's thread, Dual Boot.
Thanks to meierfra for bringing that to my attention.

A file system check never hurts a Windows file system either, and will normally do some good. It would be best to use CHKDSK from a Windows XP Recovery Console. For more details, see this website's NTFS and FAT32 file system repair and maintenance.



Quoted from the GNU/GRUB manual
25 : Disk read error
This error is returned if there is a disk read error when trying to probe or read data from a particular disk.
GRUB Error 25 is most likely to happen right after someone has added a new drive of some kind to their computer.  This error message usually indicates some kind of BIOS or hardware problem.
Normally this error has something to do with the way the hard drives and CD/DVD drives are plugged in.
Most often the IDE jumper settings will be found to be incorrect.

It might be necessary to open your computer case and maybe shine a light in there to take a look around.

There are two kinds of hard disk drives,
  • IDE hard drives, (also called 'PATA')
  • SATA hard drives, (classed as SCSI drives)
IDE drives have very wide ribbon cable, usually about 50mm wide.
An IDE ribbon cable normally has three plugs on it, one plug for plugging into the motherboard port and two other plugs. The other two plugs are for hard disc drives, or a hard drive and a CD/DVD drive.
Most motherboards have two IDE ports, one called 'primary', and another called 'secondary'.
Two IDE ports, each with a cable for two drives means you can normally have up to four IDE drives.

There are two kinds of IDE ribbon cable, the older, 40 conductor cable, and the newer, finer 80 conductor ribbon cable.
  • Normally, the older kind of ribbon cable is grey, with a red stripe in one edge, and had three black plugs. With the older type of ribbon cable, the way to tell the computer which should be the first and which should be the second hard drive was to use jumper settings to set one hard drive as 'master', and the other as 'slave' on the primary ribbon cable, and one hard drive as 'master', and the other as 'slave' on the secondary ribbon cable.
  • With the newer, finer 80 conductor ribbon cable, normally there's a blue plug for the motherboard socket, and a grey plug halfway for the slave drive, and a black plug at the end for the master hard drive. This type of IDE ribbon cable is the 'cable select' type of IDE ribbon cable. The jumper settings for this type of cable should be set on 'cable select'. Look for a sticker on top of the hard drive, (if you can see it), which will tell you how to set the hard dirve jumpers. Most of the time you need to physically remove one or more hard drives to see the stickers.
Sata hard drives are the newer kind and those are connected to the motherboard by a narrow ribbon cable which is about 8mm wide and 2mm thick, normally red in color. There is one port on the motherboard for each SATA cable, so SATA drives don't need jumper settings. Normally, the SATA drive that's plugged into the number 1 port will be number 1, and number 2 SATA drive is plugged into the number 2 SATA port on the motherboard, and so on. 

Check to make sure your hard drive cables are plugged into the right ports
If you have IDE drives, make sure the jumper settings are correct, even for the optical drive (CD/DVD drive).
Also, don't forget to check that the power cable from the power supply is connected. (It seems obvious).

Also, check your BIOS settings and make sure all your hard drives are set to 'auto', and to 'LBA' mode, and are detected and set up correctly by the BIOS.
Guide to Installing IDE/ATA devices - Free PC Tech
Hard Drive Installation Guide -PC Stats

Pin Assignments for the 40-pin IDE standard - www.ele.uri.edu



Quoted from the GNU/GRUB manual
26 : Too many symbolic links
This error is returned if the link count is beyond the maximum (currently 5), possibly the symbolic links are looped. 
It is possible to boot most Linux operating systems via 'symlinks' (shortcuts) to the kernel and initrd.img files.
Symlinks to the Linux kernel and initrd.img can be seen in a screen cap of the root of a Ubuntu filesystem here in this link,  ...GO
You will see the symlinks at the bottom of figure 4 grub there.
The actual kernel and initrd.img are pictured in figure 5 GRUB, the next illustration down.

This trick comes in handy when you may want to boot a system and it is impossible to know or find out what the exact name and path for the kernel and initrd.img files will be.
For example, you are making your own Grub CD, and you don't want to have to make a new CD every time your system has a kernel update. You can edit your menu.lst for the CD-RW with a series of commands to boot the symlinks rather than directly booting the kernel and initrd.img files.
Another reason you might want to use this trick is when multi booting other Linux OSes from one GRUB menu, so you don't need to worry about updating the menu manually with each kernel update.
You might also prefer to boot via symlinks when booting up from GRUB's Command Line Interface, refer to: Direct (kernel) Boot.

The only time I have ever received this error message was when experimenting with WinGrub (GRUB for Windows), see my WinGRUB Page.
The reason is that the version of GRUB that WinGrub uses doesn't recognize the Ubuntu GRUB's 'savedefault' commands.
One solution is to 'comment out' the savedefault commands in Ubuntu's /boot/grub/menu.lst, it boots okay with the savedefault commands removed. They aren't vital and only a few people use them. The savedefault command allows us to type 'saved' instead of a number after the 'default' command in /boot/grub/menu.lst to have GRUB remember which operating system we booted last time and preselect that one again to boot by default when the computer is rebooted. Refer to:  default. - set which O.S. will be booted automatically by the timer if no-one presses a key.
Another solution would be to use the chainloader command rather than the configfile command to boot from one version of GRUB to another. When we use the configfile command, the GRUB we're using finds the other operating system's /boot/grub/menu.lst and tries to use it's configuration file to boot with.
When we use the chainloader command, the GRUB we're using hands over control to the other operating system's GRUB at the boot sector. That means we can boot a system with a different version of GRUB or even one that has LiLo, NTLDR, or just about any other boot loader. Refer to Configfile Boot. Boot Ubuntu and most Linux systems by their configuration file, and Chainloader Boot. Boot Ubuntu and most Linux systems by their partition (boot sector).

Grub Error 26 seems to be quite a rare and unusual error, I haven't noticed this one being reported in Ubuntu Web Forums.


Quoted from the GNU/GRUB manual
27 : Unrecognized command
This error is returned if an unrecognized command is entered on the command-line or in a boot sequence section of a configuration file and that entry is selected.
For example, it is normal to issue the series of GRUB commands for booting a Linux kernel in the following sequence,
  1. root
  2. kernel
  3. initrd
  4. boot
Other recognized GRUB commands are also possible and can be found by typing 'help' after a GRUB prompt and grub will print you out a nice list of them.

Also, don't forget if you are working in CLI mode GRUB or a GRUB shell, you can use 'tab completion' by typing the first few letters of a command and then pressing your 'tab' key.
That is a great trick as it not only saves a lot of typing, if you are a poor speller or typist, it saves a lot of mistakes and having repeat things until you get it right.  
( Just ask me, I know all about what that's like! )

Otherwise, you can look up GRUB commands in the GNU GRUB Manual

Here's an example of a series of commands entered correctly,
Code:
grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub>  kernel /vmlinuz root=/dev/hda2
           [Linux-bzImage, setup=0x1c00, size=0x157812]

grub> initrd /boot/initrd.img-2.6.15-25-386
         
[Linux-initrd @ 0x1f96a000, 0x675773e bytes]

grub> boot_
          uncompressing linux... OK, booting the kernel

Here's an example of what can go wrong.
You would get GRUB error 27 if you made a spelling mistake in the command 'kernel', for example, a lot of people spell the command wrongly as 'kernal', this will result in an error message.
(Even if everything else is correct).
Code:
grub>  root (hd0,1)
           Filesystem type is ext2fs, partition type 0x83

grub>  kernal /vmlinuz root=/dev/hda2
Error 27: Unrecognized command

Edit your menu.lst or try again and this time be more careful with your spelling.

... or use 'tab completion' ! :) 



Quoted from the GNU/GRUB manual
28 : Selected item cannot fit into memory
This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won't fit into memory or it is simply too big. 



Quoted from the GNU/GRUB manual
29 : Disk write error
This error is returned if there is a disk write error when trying to write to a particular disk. This would generally only occur during an install of set active partition command. 
This error can also occur when the 'savedefault' command is used to try to write to the file called /boot/grub/default so GRUB will remember the last operating system you had booted.  If the file called 'default' does not exist, or you are using GRUB from a CD-ROM (CDs can't be written to), or WINGRUB (GRUB for WIndows, it may be in an NTFS partition, so can't be written to) then you may see this error.
To continue booting anyway, you can press 'e' for edit, select the line of the 'savedefault' command, press 'd' for delete, and 'b' for boot.
If this problenm will re-occur, it would be best to either hash out, or delete the 'savedefault' commands from the menu.lst file involved. They aren't often important anyway. You may be better off without them.


Quoted from the GNU/GRUB manual
30 : Invalid argument
This error is returned if an argument specified to a command is invalid. 


Quoted from the GNU/GRUB manual
31 : File is not sector aligned
This error may occur only when you access a ReiserFS partition by block-lists (e.g. the command install). In this case, you should mount the partition with the `-o notail' option. 


Quoted from the GNU/GRUB manual
32 : Must be authenticated
This error is returned if you try to run a locked entry. You should enter a correct password before running such an entry. 
This error message is the one you get when you or someone has set up a GRUB password, refer to the following links:
 GNU-GRUB Manual: 9 Protecting your computer from cracking


Quoted from the GNU/GRUB manual
33 : Serial device not configured
This error is returned if you try to change your terminal to a serial one before initializing any serial device. 



Quoted from the GNU/GRUB manual
34 : No spare sectors on the disk
This error is returned if a disk doesn't have enough spare space. This happens when you try to embed Stage 1.5 into the unused sectors after the MBR, but the first partition starts right after the MBR or they are used by EZ-BIOS.
Normally GRUB's optional stage1_5 is installed in the 21 sectors immediately following the MBR in the first track of the hard disk. Normally the first track of the hard disk is empty and used only by programs such as bootloaders. However there are some other types of software like disk managers that like to use the same sectors. Those are rare these days.





Windows Booting errors

Generally, these are already pretty well covered. Windows Knowledge Base and many computer forums discuss Windows errors already, but I'll start a new collection here too.

Windows Booting errors:
boot sector problems (all Windows Systems)

disk I/O error

Returns to GRUB when trying to boot Windows

=================================

Windows 95

=================================

Windows 98

=================================

WINDOWS XP SECTION

Invalid Partition Table - from the MBR

Error Loading Operating System - from the MBR

Missing Operating System - from the MBR

A Disk Read Error Occured - from the boot sector

NTLDR is Missing - from the boot sector

NTLDR is Compressed - from the boot sector

autocheck program not found - skipping autocheck.

hal.dll is missing or corrupt -

NTLDR is missing, press any key to restart.

Windows in a logical partition

Error Loading Operating System  (External link)

Type the name of the Command Interpreter

===================================================
VISTA and WINDOWS 7 SECTION

BOOTMGR is missing -

winload.exe..... is missing or corrupt -

Windows Failed to start. A recent hardware or software change might be the cause -

Starting up . . .


disk I/O error - you may see the following print in your monitor,

Booting 'Microsoft Windows XP Home Editition

root         (hd0,0)
Filesystem type is fat, partition type 0xb
savedefault
makeactive
chainloader +1

Disk I/O error
Replace the disk, and then press any key
_

GRUB has tried to chainload Windows, but the Windows boot sector is corrupted somehow.

The usual way to fix this problem is to use a Windows XP recovery console, and run the Fixboot command.
For Vista users, I imagine the procedure is similar, but you use the bootrec /fixboot command.

One alternative is to use ms-sys, the Linux tool for re-installing the Windows boot sector.

Here is a link to a cool thread by lswest and bodhi.zazen about how to fix boot sectors and MBRs, http://ubuntuforums.org/showthread.php?t=740221

If you already have Super Grub Disk, a quicker and easier way to do it is to go 'English Super Grub Disk'-->'Advanced'-->'Windows (Advanced)'-->'Fix Boot of Windows (Partition).

You can also restore the Windows boot sector from it's backup with Linux in a FAT32 file system or an NTFS file system.

FAT32 boot sector restoring:
If you have the FAT32 filesystem in Windows, you can replace the corrupted or non-existing Windows bootsector with its backup by running a filesystem check from a GParted -- LiveCD, Any Linux live cd will work, including Ubuntu and  Knoppix, provided the filesystem (partition), is not mounted when you do the filesystem check.
Code:
root@gparted:~#dosfsck -ar /dev/hdx,y
Where: your hard disk is an IDE hard disk, if SCSI or sata, replace 'hda' with 'sda' instead.
Where: 'x' is the letter representing the hard disk of your Windows install, 'a' is most common, but if your Windows is on hard disk number2, replace this with 'b'. Use 'c' for a third hard disk, and so on.
Where: 'x' is your partition number, most commonly '1' will be right. If you are not sure, you can check with partition editing software such as GParted, or type 'sudo parted', and then 'p' for 'print'.

When the above command has been run, it will show you the differences between your boot sector and it's backup.  It will offer you the following choices:
1) Copy the original to backup
2) Copy backup to original             (this is probably what you want to do)
3) No action
?

The ? is the prompt, I would type '2' after the prompt, and then type 'Y' for yes when asked to confirm this. That's it, your bootsectorwill be instantly restored!

Example thread: http://www.ubuntuforums.org/showthread.php?t=296619&highlight=grub

NTFS boot sector restoring:
The backup copy of the boot sector in an NTFS formatted partition is in the last sector of the partition.
You can use TestDisk to restore it. Restore an NTFS boot sector with it's backup .



Returns to GRUB when trying to boot Windows


It could be that you or somebody has install GRUB to your Windows boot sector instead of to your hard disk's MBR.

Just put in your Windows XP install CD, and boot into the Windows XP Recovery Console and use the so-called 'FIXMBR' command.

If you don't have a Windows 'Installation Disk', the backup copy of the boot sector in an NTFS formatted partition is in the last sector of the partition.
You can use TestDisk to restore it. Restore an NTFS boot sector with it's backup .



Windows 95

If you are having problems booting Windows 95, go to Bootdisk.com and download a floppy disk for your version of Windows 95.
There are two different versions of Windows 95, the original version had the FAT16 file system and was later upgraded to the FAT32 file system. You need to make sure you download the correct boot floppy for your version of Windows 95.

A:\ fdisk /mbr_
Re-installs the Windows 95 boot loader in the IPL area of the MBR.
Only run this command if needed, if you're booting with GRUB you won't need it.
If you are only booting Windows 95 then you need Windows 95 IPL in the MBR.

A:\ scandisk C:
Runs a file system check in your C: drive.

In Windows 95, 98 and ME, the boot sector must points to the boot loader file called IO.SYS
A:\ SYS C:
The command 'sys C:' runs SYS.COM which will write a new boot sector and also refresh the important files in the root of drive C: that are needed for booting, which are: IO.SYS, MSDOS.SYS and COMMAND.COM

When you are finished, press 'Ctrl'+'Alt'+'Del' to reboot, and remember to eject and remove the floppy disk so your computer will boot from the hard drive.




Windows 98

You can download a self extracting file to make your own Windows 98 boot floppy disk from Bootdisk.com.  The one I use is called 98SE OEM.
To make the boot disk, download the boot98se WinImage Self Extractor file when running a Windows operating system.
Place a formatted floppy in the floppy drive and then just double-click on the file. I it will make a boot floppy automatically.

You must first of course have your computer's BIOS set to boot from the floppy disk drive before the hard disk in the BIOS boot sequence. See this website's BIOS Page.
 Just pop the floppy in the drive and boot your computer. You will soon see a black background in your monitor and will be given three choices.
These are,

                     1. Start computer with CD-ROM support
                     2. Start computer without CD-ROM support  
                     3. View the Help file.
Choose number 2, 'Start computer without CD-ROM support'.

After a few minutes, you will see a prompt that looks like this,
A:\_
After the     A:\_   prompt and type the command and wait for the command to work.

fdisk /mbr
will replace the IPL in the MBR to make the MBR point to Windows 98, (overwrite GRUB),
A:\ fdisk /mbr_
A Windows 98 boot floppy will work just as well as a Windows XP Installation CD to restore your MBR.
The Windows 98 boot floppy's fdisk/mbr is not recommended for Vista or later, because it alters the 'disk signature', which Vista's and 7's BCD boot loader depend on.

A:\ scandisk C:
Runs a file system check in your C: drive.

In Windows 95, 98 and ME, the boot sector must points to the boot loader file called IO.SYS
A:\ SYS C:
The command 'sys C:' runs SYS.COM which will write a new boot sector and also refresh the important files in the root of drive C: that are needed for booting, which are: IO.SYS, MSDOS.SYS and COMMAND.COM

When you are finished, press 'Ctrl'+'Alt'+'Del' to reboot, and remember to eject and remove the floppy disk so your computer will boot from the hard drive.



WINDOWS XP SECTION



A Disk Read Error Occured

Starting up...

A disk read error occured.
Press Ctrl+Alt+Del to restart.

This is an error message from the boot sector, so the MBR is okay, but the boot sector doesn't seem to be able to pass on the boot to the next stage of the boot loader.
Generally this seems to be a sign of a possibly weak or failing hard disk, according to reports turned up with google.
In one instance I was able to solve this for a friend by juggling the partitions with GParted so that the Windows XP partition was at the end of the hard drive and Ubuntu was at the start of the hard drive. That cured the problem, but I can't explain why. Running CHKDSK /R numerous times didn't seem to do any good, but logically, that's what should probably be the thing to do. "Go figure", as they say.



'autocheck program not found - skipping autocheck', and then the computer reboots

autocheck program not found - skipping autocheck
This is usually just an error in editing boot.ini, check boot.ini and make sure you have the correct partition numbers entered.

If you have a Windows XP Installation CD, you can boot it into a Windows Recovery Console, and  issue the command 'bootcfg /rebuild ' command. That command is for automatically fixing a corrupted boot.ini file or making a brand new one if one doesn't already exist. See: How to Use and Edit Boot.ini in Windows XP - Computer Education.

I have also produced this error when I used GRUB's 'hide' command to hide the partition and later tried to boot it without remembering to unhiding it with the 'unhide' command. GRUB's 'hide' and 'unhide' commands are useful for booting Windows when you have more than one Windows operating system on the same hard disk.  If you have been using GRUB's 'hide' and 'unhide' commands, check that your partition is unhidden.
If you have used another bootloader's 'hide' command, please use the same bootloader you used to 'hide' it to 'unhide' it again (just in case there are different way of 'hiding' and 'unhiding' the partition).

Here's a link to another website, How to fix: NTLDR is missing, press any key to restart
The author of that website explains how to get your Windows to boot up with NTLDR and the other vital Windows booting files on a floppy disk or CD or USB disk. Then when you have Windows booted, you can edit your boot.ini file for next time.

There's also a more basic but similar how-to from Microsoft, How to make your own Windows Xp boot floppy. 
If anyone finds out how to format one of these floppy disks from Ubuntu please let me know, you can copy the files to the floppy disk from Ubuntu okay, but I don't know how to do the formatting part with Ubuntu.
Maybe try syslinux?
The best thing about using a floppy disk is the fact that we can edit the floppy disk's boot.ini file on the fly from Ubuntu and try to boot again as the floppy disk will have no security attributes set on the file.

NOTE: The text editor in Ubuntu makes line breaks differently to the way they are expected in Windows, so you can edit boot.ini carefully from Linux, just to alter the hard disk or partition numbers, but don't start any new lines!!!
As soon as we touch our 'Enter' ('Return') key, we will corrupt the boot.ini file as far as Windows is concerned. Viewed from Ubuntu it will look fine, and we won't be able to figure out what on earth could be wrong with it. Viewed from Windows though, (if you could view it from Windows), it will have all the text in one long line with funny little rectangles where a new line should begin. They're not so funny to a Windows user who is locked out of his or her system.

If your Windows partition number is a number greater then 4, refer to Windows in a logical partition    




hal.dll is missing or corrupt

Symptoms:
The following message is seen when attempting to boot Windows,
Windows could not start because the following file is missing
or corrupt:
<Windows root>\system32\hal.dll.
Please re-install a copy of the above file.

Usual cause:
There could be lots of possible reasons for Windows to display this message and fail to boot, but  it is probably not true that hal.dll is really missing or corrupt.
Most often it is just because your Windows partition number has been changed somehow, either on purpose or by accident, by you or by a partition editing program you used. You only need to edit your boot.ini file in Windows with the new partition number to fix this problem.

diagnosis:
 You should be able to see all your Windows booting files if you mount your Windows filesystem in Linux (LiveCD or installed OS), and take a look for yourself. File Systems and Mounting Page 
It will look like the illustration on this link, A Birds's eye view of Windows XP (showing the bootloaderfiles)
Open the file called: boot.ini and see if it has the correct partition number for your current Windows installation. 

To cure this problem: (if this is the likely cause), all you need to do is either edit boot.ini with the new partition number, or copy and paste the partition again with the partitioning software in such a way that it gets its original partition back number again. Normally, editing boot.ini would be the easiest.
For example, say Windows was in partition number 1, but you made it partition number 4 now, by mistake, that's okay, here's your old boot.ini file,
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)WINDOWS="Microsoft Windows Xp Home Edition" /fastdetect

Here's what you should edit it to look like now (if Windows has been changed from number 1 to number 4 partition),
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(4)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(4)WINDOWS="Microsoft Windows Xp Home Edition" /fastdetect

Normally, you can't write directly to boot.ini from Linux, because you won't have the right permissions. It's a locked, hidden, read-only file.
Windows doesn't count extended partitions and it only counts partitions which really exist.

See: How to Use and Edit Boot.ini in Windows XP - Computer Education.

You may be able to access boot.ini from Windows recovery console.  This link, A Birds's eye view of Windows XP (showing the bootloaderfiles) shows you how to relax the security attributes for boot.ini in Window XP and gain read and write access to the file.

Or another way that should work in Windows recovery console is to just use these two commands :

 bootcfg /rebuild,
bootcfg /rebuild

fixboot,
fixboot

Thanks to saurabh kakkar   for letting me know. http://ubuntuforums.org/showthread.php?t=485723

If you still have trouble, here's a link to a great website, How to fix: NTLDR is missing, press any key to restart.
The author of that website has anticipated almost every problem you might have and suggested lots of possible solutions to them. You can get your Windows to boot up with NTLDR and the other vital Windows booting files on a CD or USB disk if you have no floppy disk drive.
Then when you have Windows booted, you can edit your boot.ini file for next time.

Another way you can do it is to make yourself a special Windows XP boot floppy disk with the most important Windows XP booting files on the floppy disk instead. Here is the how-to for that from Microsoft,  How to make your own Windows Xp boot floppy
It is important to follow their instructions to the letter about how to format the floppy disk or it probably won't work.
Once the floppy disk is formatted, we can use Ubuntu to copy the files to the floppy disk if we want. It is easy to mount the floppy disk in Ubuntu and edit the boot.ini file in the floppy disk with any partition numbers you like too. The floppy disk has the FAT32 filesystem and Linux has no problems writing to that. Here's how to Mount a floppy disk in Ubuntu.

These special Windows XP boot floppies are great! They have their own copy of NTLDR, NTDetect.com and boot.ini files right on the floppy disk. These bypass almost any problem you could have with booting Windows, they bypass the MBR, the bootsector, and problems with the main Windows booting files.

Edit you boot.ini file and reboot.





NTLDR is missing, press any key to restart
If you get this error message it usually means GRUB has already done its job properly and Windows is trying to boot but has a problem with its own bootloader or in the boot.ini file.

To check and see for yourself if NTLDR is really missing, you should be able to see all your Windows booting files if you mount your Windows filesystem in Linux (LiveCD or installed OS), and take a look for yourself. It will look like the illustration on this link, A Birds's eye view of Windows XP (showing the bootloaderfiles)

In most cases you will see that the three vital Windows bootloader files, NTLDR, NTDetect and boot.ini, are all there safe and sound.

Possible causes:
 1) Somehow Windows's partition number may have been changed by a buggy partition editing program. You should have used your Ubuntu installer's hard disk partitioner or Gnome Partition Editor in the Ubuntu Live CD or any good 'Parted based partition editor to avoid this happening.
Use a partition editing program to check, normally Windows is in partition number 1 of the first hard disk.
(It doesn't matter which end of the disc partition number one happens to be physically located).
If the partition number has changed, Windows will need it's boot.ini edited before it will boot.
The problem is, you can't boot Windows normally right now to edit boot.ini, so you are stuck...
Well not completely. Here's a link to another website, How to fix: NTLDR is missing, press any key to restart
There's also a more basic but similar how-to from the makers of the other software too, How to make your own Windows Xp boot floppy
Either of those two links contains instructions that should help you boot your Windows Operating system so you can fix it. See: How to Use and Edit Boot.ini in Windows XP - Computer Education.

 2) When Windows is in a non-first hard disk, a pair of map commands in GRUB's menu.lst file are normally used. The map commands avoid the need to edit boot.ini to tell Windows it's on a different hard disk. If the map commands are applied when they're not needed (for example if Windows actually is in the first hard disk), or if there's something wrong with the map commands, you could get 'NTLDR is missing. (When really it isn't). See 'Chainloading Windows on a non-first hard disk'.

 3) If you have only ever had just one single installation of Windows in your computer there could be lots of possible reasons for Windows to display this message and fail to boot, but  it is probably not true that NTLDR is really missing. It might be that the file is there but Windows can't find it because it's file system is all mixed up. A file system check such as CHKDSK /R from the Windows XP Recovery Console might fix it, and maybe a good defrag after you get it booted will improve things even more.

4) If you have had more than one Windows in your computer it could be true that NTLDR really is missing!
If you installed your second Windows operating system without using GRUB's 'hide' command to hide the older Windows install, Windows probably set up a Windows default multi boot without warning you.  
This means all your bootloader files from your new Windows system were quietly moved to your older Windows install without your knowledge.  Now you can only boot your new installation through your older Windows. If your old Windows system ever gets a virus or you delete it for any reason, you will lose all your bootloader files for your new Windows operating system too.
You should use GRUB as your boot manager when you multi boot Windows.
You can use GRUB's 'hide' command to hide your first Windows so your second Windows will install normally. Super GRUB disk can help you if you don't know how to use GRUB from the command line. Super GRUB Disk includes the 'hide' command in one of its menus. Next time you set up a Windows dual or multi boot, use GRUB as your boot manager and Super GRUB Disk to help you set it up.
Read this link, Understanding MultiBooting and Booting Windows from an Extended Partition. That is an excellent website and well worth the time spent to read and understand it.
Read this link too, http://www.goodells.net/multiboot/principles.htm
If your Windows partition number is a number greater then 4, refer to Windows in a logical partition

Even if it's really true that NTDLR is actually missing, you can still easily recover your Windows boot.
You can go to the following website and download the .iso file to make yourself a special and very powerful  boot CD with it's own generic copy of boot.ini in it, plus NTLDR and NTdetect.com, How to fix: NTLDR is missing, press any key to restart
There's also a more basic but similar how-to from the makers of the other software too, How to make your own Windows Xp boot floppy
Either of those two links contains instructions that should help you boot your Windows Operating system and you can copy the files from the CD into your Windows so you can fix it.

If Windows is in a logical partition, you amy need to delete the 'makeactive' command from GRUB, since GRUB can't put the boot loader flag in a logical partition. Use a partition editor to place the boot flag instead.





Windows in a logical partition 
Here is a link you should read, http://www.goodells.net/multiboot/principles.htm.
- Did you allow your Windows/Windows dual boot to "Multi Boot the Microsoft way"?
Please re-read the above link again. Here is that website's home page, Understanding MultiBooting and Booting Windows from an Extended Partition. That is an excellent website and well worth the time spent to read and understand it.

As far as I have read from other websites, in this problem is even worse with Vista. See ' BOOTMGR is missing', just above here. It's not good enough to just 'hide' your other Windows anymore, Vista will still find it and write it's boot loader to it, even if it's on a different hard disk. If you want to install Vista independantly, you have to physically unplug the other hard disks if they have Windows systems in them.

To make Windows XP bootable in a logical partition,
1) Use GParted -- LiveCD or Gnome Partition Editor in a Ubuntu Live CD to set the boot flag in the logical (Windows) partition.
GRUB can't set a boot flag in a logical partition, but most partition editors can.

2) Then you need to either delete or at least 'comment out' the 'makeactive' command from your /boot/grub/menu.lst file so GRUB will skip trying to move the boot flag and won't be stopped with the 'Error 12' message.

3) You will need to download a boot discs from this site, How to fix: NTLDR is missing, press any key to restart by Miles Comer. Boot discs from that site have the needed Windows files that you would have been deleted with your Windows primary partition, that boot CD should boot Windows for you.
Copy the three vital Windows XP boot loader files (ntldr, ntdetect.com and boot.ini), from the floppy disk or the CD to the root of the Windows partition and Windows should now be bootable from GRUB.

Here's a link to a thread: [other] How to fix XP when the boot files are missing - meierfra

Here's the original post, Re: Grub error 17.




\WINDOWS\SYSTEM32\CONFIG\SYSTEM missing or corrupt

Windows could not start because the following file is missing
or corrupt:
 \WINDOWS\SYSTEM32\CONFIG\SYSTEM
You can attempt to repair this file by starting Windows Setup
using the original Setup CD-ROM.
Select 'r' at the first screen to start repair.
This happened after trying to resize Windows partition smaller with a disk partitioning software. An error occurred and Windows would not boot, this error message (above) was displayed. The text is self - explanatary.




Error Loading Operating System  (External link)

Here is the link, Error Loading Operating System WhoCares?





Type the name of the Command Interpreter
When I saw this error message it was caused by me setting my Windows 98SE partition as 'hidden' with a partition editing program and forgetting to 'unhide' it again.
You can check to see if your Windows partition is 'hidden' or not with a partition editor such as GParted LiveCD, and unhide it with a partition editor.
You can also 'hide' and 'unhide' partitions with GRUB's 'hide' and 'unhide' commands.

If that's not the problem, here is a link to great web page that should help most people with this error:  Type the name of the Command Interpreter - (External link)



vista



WINDOWS VISTA and WINDOWS 7
Index
BOOTMGR is missing -

winload.exe..... is missing or corrupt -

Windows Failed to start. A recent hardware or software change might be the cause -

Starting up . . .

In have run tests in my own computer with fresh, clean Windows Vista and Windows 7 installations.
I found that Windows Vista and Windows 7 become temporarily unbootable every time the start point of the Windows partition is 'moved' with any partition editor.
I found that either of those two operating systems were pretty good at repairing themselves, but if users could avoid accidentally moving the Windows 'boot sector' with their partition editor then they would not notice any booting delays at all. The boot sector is at the left-hand side of 'start' of the partition. Resizing (meaning resizing from the right-hand or 'end'), doesn't affect booting.

When the systems couldn't repair themselves easily, running 'Startup Repair' from the Windows Vista or Windows 7 Installation DVD always fixed the boot loader automatically.
If you don't have your own Windows Vista or Windows 7 Installation DVD, you may go and download Windows Vista Recovery Disc from NeoSmart Technologies for free. It's only a small download and it's almost the same as a Windows Vista Installation DVD but you can't use it to install Vista. You can however, use the repair tools it contains to repair your Windows Vista or Windows 7 installation.

I have read that if 'Startup Repair' doesn't fix it the first time, it's a good idea to run 'Startup Repair' again and again a few times. 'Startup Repair will fix one problem at a time and needs a reboot to fix the net problem is there's more than one problem, (or so I have read).
If 'Startup Repair' couldn't fix it, the most I had to do was switch to a command prompt and run BOOTREC /FIXBOOT to repair the boot sector.
Maybe I'm just lucky, but after many of my own tests that was the most I have had to do so far.

Windows 7 installs itself with a separated 'boot' partition which is a big improvement over Vista, (great idea, Microsoft! :) ), so it's less vulnerable to accidental damage. Windows 7 seems to have 'Startup Repair' in it's 'boot' partition too, so there's a good chance it can repair itself, which is excellent.

There were a few GParted Live CDs that had a bug in them which caused them to be unable to update the Vista boot sector if it was moved. That resulted in a different error see 'Starting up . . .'

Partitioning your hard disk from within Windows 7 or Windows Vista is possible, and it is quite quick and easy. If you would prefer to use Windows own disk manager to resize your Vista or Windows 7 partition smaller to make room for Ubuntu before going any further with your installation you can. The How-To Geek has the how-to for that, 'Resize a Partition for Free in Windows Vista'.
Some people prefer to do it that way, I'm not sure which way is better, the rest of this site is about how to use GParted to do the partitioning.  It's your choice.

I highly recommend reading the pages in the following linked excellent site if you want to learn about multibooting with Vista, Multibooters - Dual/Multi Booting With Vista - McTavish.






BOOTMGR is missing
(Vista/XP dual boot when adding Ubuntu)

From Ubuntu Web Forums Thread: http://www.ubuntuforums.org/showthread.php?t=319814

Quote from davidgarcin,
When I installed Vista, I already had XP and Ubuntu set up on the same hard drive. For some stupid reason, the Vista installer put bootmgr and c:\Boot on my XP partition (I guess maybe because it was (at the time) the first NTFS partition on the hard drive).

Of course, when I tried to boot the Vista partition from GRUB, it couldn't find bootmgr. Once I discovered the problem, all I had to do was copy/paste the bootmgr and the Boot folder from the root of my XP partition to the root of my Vista partition, and everything worked fine.

Moral of the story - look on other NTFS partitions for the missing bootmgr and Boot directory. Hope that helps.

    -Dave 

The above quoted problem comes about because during installation, Microsoft Windows operating systems are programmed to search for an existing Windows operating system in any computer they are being installed in.
If they find a pre-existing Windows installation in a primary partition, they are programmed to set up a 'Microsoft Default Dual Boot', and install the new operating system in a logical partition and install their boot loader files in the older operating system.
Read Understanding MultiBooting and Booting Windows from an Extended Partition.

With Vista, even hiding the partition doesn't work, Vista will find it anyway, and even if you install Vista on a different hard disk, it will still set up a 'Microsoft Default Dual Boot'.
Unless you unplug the other hard disk before installing Windows Vista.



Windows Error Recovery
                          Windows Error Recovery                       
Windows failed to start. A recent hardware  or software change might be the cause.

If Windows files have been damaged of configured incorrectly, Startup Repair can help diagnose and fix the problem. If power was interrupted during startup, choose Start Windoww Normally.
(Use the arrow keys to highlight your choice.)

Launch Startup Repair (recommended)
Start Windows Normally


Description: Fix problems that are preventing Windows from starting



 ENTER=Choose                                                          

I saw this black screen advising me to run startup repair after moving the Windows partition with a partition editing program.

I decided let it do the repair, but all that happened was, I was shown this blue screen, below,
A problem has been detected and Windows has been shut down to prevent damage to your computer.

If this is the first time you have seen this Stop error screen,
restart your computer. If this screen appears again, follow these steps:

Disable or uninstall any anti-virus, disk defragmentation or backup utilities. Check your hard drive configuration, and check for any updated drivers. Run CHKDSK /F to check for hard drive corruption, and then restart your computer.

Technical information:

*** STOP: 0x00000024  (0x00000000000c22d2,0x0000000000000010,0x000000000000
0000,0c0000000000000000)
I pressed 'Ctrl+Alt+Del' to restart my computer. - didn't work
I used the reset switch to restart my computer.

I inserted my Windows Vista Installation CD, and all I got was the same blue screen.

So I grabbed my Windows Vista Recovery Disc - (you can download yours from that link) from Neosmart.net, thanks lswest for the link. Thanks for the download to Computer Guru, of NeoSmart Technologies (the developer of EasyBCD). 

I booted my Windows Vista Recovery Disc Download and it ran 'Startup Repair' automatically.
It scanned for problems and said 'Startup Repair cannot repair this computer automatically
-> Send information about this problem (recommended)
-> Don't send'
I closed out of that and hit 'Finish' and went to the command prompt instead.
 
At the command prompt I ran,
C:

C:\> bootrec /fixboot

When I rebooted, Windows ran CHKDSK and rebooted again and was all fixed.




winload.exe is missing or corrupt
                                               Windows  Boot  Manager                                                   

 
 Windows  failed  to  start.  A  recent  hardware  change  may  be  the
 cause.  To  fix  the  problem:


 1. Insert your Windows installation disk and restart your computer.

 2. Choose your language settings and click "Next."

 3. Click "Repair your Computer."

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.

    File: \Windows\system32\winload.exe

   Status: 0xc000000f

   Info: The selected entry could not be loaded because the application is missing or corrupt.
 


  ENTER=Continue                                                ESC=Exit


winload.exe..... is missing or corrupt  
An error message from Windows Vista. Here is a link to a web really good web page that explains the problem in detail much better than I can, Refer to: Vista's MBR Disk Signature - Multibooters.co.UK.

To solve the problem, look in this page of the same web site, bootmgr and BCD. Scroll to about half way down the page and find the paragraph headed 'Moving Vista', and follow the links provided.

If you have time, start from from that web page to that website's home page,  Multibooters - Dual/Multi Booting With Vista, and read the other pages that site links you to you will find all the information you need about Windows Vista's boot loader.

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). 




Windows Failed to start. A recent hardware or software change might be the cause
.
                                               Windows  Boot  Manager                                                   

 
 Windows  failed  to  start.  A  recent  hardware  change  may  be  the
 cause.  To  fix  the  problem:


 1. Insert your Windows installation disk and restart your computer.

 2. Choose your language settings and click "Next."

 3. Click "Repair your Computer."

If you do not have this disc, contact your system administrator or computer
manufacturer for assistance.

    File: \Windows\system32\winload.exe

   Status: 0xc000000f

   Info: The selected entry could not be loaded because the application is
         missing or corrupt.
 


  ENTER=Continue                                                ESC=Exit


This appears to be the same error message as shown above, but for quite a different problem.
Apparently, Windows Vista has been designed to be so fragile and unstable, that even a simple resize operation with GParted will cause it to refuse to boot, here's a link to an outside source about that, Using GParted to Resize Your Windows Vista Partition - the How-To Geek.

Thanks to meierfra for letting me know about this one, thread: [SOLVED] Grub Doesn't Detect Vista.



Starting up . . .
Starting up ...
_

Looks like the illustration above, with a blinking underscore.

There was a version of GParted Live CD that had a program called 'xxd' missing, which meant that if a NTFS partition was 'moved', GParted LiveCD wasn't able to update the NTFS boot sector.
Refer to Ubuntu Web Forums thread: Is Partition Magic Reliable?

There are two ways of fixing this minor problem.

One way to fix it yourself is to use a program called TestDisk to restore the Windows boot sector.
You can install TestDisk in Ubuntu,
sudo apt-get install testdisk

Once TestDisk has been installed, you can start it with,
sudo testdisk
  1. In the first screen, choose "proceed"
  2. In the second screen, select "intel"
  3. In the third screen, choose "advanced",
  4. Select the Windows partition (it should be selected already) and choose "boot"
  5. Select "RebuildBS"
  6. Select "Write"
  7. press "q" a few times to quit testdisk
  8. reboot and see whether you can boot into Vista.
Even if you can't boot into Vista right away, at least it's fixed enough to run Windows Vista Recovery Disc - 'Startup Repair', and that should be able to do the rest of the work to repair your Vista boot loader.
Thanks to meierfra for letting me know about this problem and it's solution.



A second method for fixing this is to use the following series of commands.

First, run 'sudo fdisk -lu', to find out what sector number your Vista boot sector is in,
herman@amd64hh:~$ sudo fdisk -lu
[sudo] password for herman:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000ba675

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *   102526830   312576704   105024937+   7  HPFS/NTFS

Then run, (copy and paste this code, and copy and paste the sector number from fdisk at the end of it),
python -c "import sys;h=hex(int(sys.argv[1]))[2:].rjust(8,'0');print(''.join([c+d for c,d in zip(h[-2::-2],h[-1::-2])]))" 102526830

That will return an answer, which will be our input for the next command.
Thanks to unutbu for making up this command.
python -c "import sys;h=hex(int(sys.argv[1]))[2:].rjust(8,'0');print(''.join([c+d for c,d in zip(h[-2::-2],h[-1::-2])]))" 102526830
6e6f1c06

sudo su

echo 6e6f1c06 | /usr/bin/xxd -r -p | /bin/dd conv=notrunc of=/dev/sda1 bs=1 seek=28

Where: You pasted the answer from your earlier command after the word 'echo'.
Where: '/dev/sda1' is the partition number of your Vista partition.
Thanks to GParted Live CD for this command.

Exit the terminal and you should now be able to boot into Vista.
If you still can't boot Vista right away, at least it's fixed enough to run Windows Vista Recovery Disc - 'Startup Repair', and that should be able to do the rest of the work to repair your Vista boot loader.


Ubuntu Booting problems
(Ubuntu begins to boot, but can't because...)
Target filesystem doesn't have /sbin/init    /bin/sh: can't access tty; job control turned off

busybox or tty error        /bin/sh: can't access tty; job control turned off

failed to start xserver.

fsck died with exit status 8.

the bootsector is not the same as its backup.

Bad Magic Number in Superblock.

Linux Frequently Asked Questions With Answers, Page 6 of 6  (link to another website)




Target filesystem doesn't have /sbin/init
mount: mounting /dev/hda3 on /root failed: no such device
mount: mounting /root/dev on /dev/ .static/dev failed: no such file or directory
mount: mounting /sys on /root/sys failed: no such file or directory
mount: mounting /proc on /root/proc failed: no such file or directory
target filesystem doesn't have /sbin/init

BusyBox v1.01 (debian 1:1.01-4ubuntu3) build-in shell (ash)

/bin/sh: can't access tty; job control turned off
(initrams)_
There is another GRUB error message similar to this one in the GRUB error messages section. It looks similar but has a completely different cause and solution, so please also check the following link and make sure you can spot the difference between these two error messages,  busybox or tty error

In this case the error I'm talking about here can't be solved by editing the menu.lst file and it is caused by some problem inside the Ubuntu operating system itself.

This error was apparently solved by Senesence it this thread, /bin/sh: can't access tty; job control turned off, try deleting the UUID number in your menu.lst boot entry and reverting to the old /dev/hda2 style for designating the /root partition, (the partition containing /sbin/init).

Here's another variation on the same error, SOLUTION: missing /sbin/init causes boot to exit to busybox/initramfs prompt

And here's yet another different explanation /bin/sh: can't access tty



busybox, tty

Looks like this,
BusyBox v1.1.3 (Debian 1:1.1.3-3ubuntu3) Built-in shell (ash)
Enter 'help' for a list of built-in commands

/bin/sh: can't access tty: job control turned off
(initrams)_

Check your file system UUID number is correct in the second line of your operating system entry commands, for example,
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
Click the following link to learn more about filesystem UUID numbers, About /etc/fstab files with UUID filesystem ID added

That should solve the problem in the vast majority of cases.

There is another booting error that looks something similar to this. The last two lines are the same, but it is a completely different error and doesn't seem as if it can be solved by editing the menu.lst file. It seems to be a Ubuntu error message, take a look at, Target filesystem doesn't have /sbin/init 



fsck died with exit status 8
* Activating swap...                                                                        [0k]
*Checking file systems...
fsck 1.39 (29-May-2006)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dev/hdb1: 4430 files, 66282 clusters
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dev/hda1: 28304 files, 187699/460749 clusters
/dev/hda2 clean, 115351/4071648 files, 4174763/8146955 blocks
/dev/hdb2 clean, 93833/2129920 files, 1656887/4239151 blocks
/dev/hda7 clean, 11723/127744 files, 39798/255024 blocks
fsck.ext3: Unable to resolve 'UUID=6f244293-85d6-4fbd-af86-e9b3aab79b07'
fsck died with exit status 8
                                                                                             [fail]
* File system check failed.
A log is being saved in /var/log/fsck/checkfs if that location is writable.
Please repair the filesystem manually.
* A maintenance shell will now be started.
CONTROL-D will terminate this shell and resume system boot.
bash: no job control in this shell
bash: groups: command not found
bash: lesspipe: command not found
bash: dircolors: command not found
root@testededgyeftbeta:~#_
The example above will be roughly what this looks like, but will vary a great deal between one computer and another.

Usually, pressing your 'Ctrl'+'d' keys will get the computer over this hang-up and resume booting. If that doesn't work, press 'Enter', and then your 'Ctrl'+'d' keys.
Your computer should boot up as normal, but possibly not all your filesystems will be mounted.
Sometimes it will also have the wrong resolution as well (everything appears very large in your monitor, and you can't fit everything on your screen). 

A prime cause of a stalled boot up and this message appearing is when we do some work with partitioning software and forget to update /etc/fstab with the changes.
For example, we re-install an operating system or remove a filesystem or exhange one filesystem for another.
Each time Ubuntu is booted, it does a quick filesystem check automatically to make sure everything is still okay for Ubuntu to start.
This is controlled by entries in our our /etc/fstab files.
For example, the entry for the root filesystem in /etc/fstab has a number 1 in the '<pass>' column, that means it will be checked
Entries for other filesystems usually have the number 2 in the '<pass>' column, that means they are to be checked.
Entries for filesystems not to be checked can be edited with a 0 in the <pass> column in /etc/fstab, that means they will be ignored, and this is a cheat's way top aviod this error message.
However, it is best to have the filesystem check done, as it can prevent small filesystem errors from developing to the stage where they may become serious.
The best thing to do is edit /etc/fstb with the up to date information for your current partitions, along with their 'UUID' numbers.

Here is an example of an /etc/fstab file,
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options>     <dump>  <pass>
proc           /proc          proc   defaults        0       0
# /dev/hda6
UUID=291545da-fce7-4d0b-a783-e127a4653513 / ext3 defaults,errors=remount-ro 0 1
# /dev/hda2
UUID=948b4626-2f62-40c0-bc92-6ee8b69af42e /media/hda2 reiserfs defaults 0     2
# /dev/hda3
UUID=e0430d86-1ae0-4563-9b12-f8b6988e9df2 /media/hda3 reiserfs defaults 0     2
# /dev/hda5
UUID=f89aaf21-2ff5-4a46-b901-8d2653e2f00b none    swap    sw         0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
For more information about how to edit your /etc/fstab file, go to this website's Filesystems and Mounting Page.



the bootsector is not the same as its backup

This error message occurs when dos.fsck checks a Windows FAT32 filesystem and finds something wrong with the bootsector.
Press your 'Ctrl'+'d' keys to get the computer over this hang-up and resume booting. If that doesn't work, press 'Enter', and then your 'Ctrl'+'d' keys.

This can  be repaired later either with a Windows 'FIXBOOT' command, from a Windows recovery console, or with Linux's dosfsck from a LiveCD.

Run 'sudo dosfsck -ar /dev/hda1' or 'sudo fsck -v -r /dev/hda1' from a Live CD.
I favour GParted -- LiveCD, if you use that, you will have a root shell already, so you won't need to type 'sudo' in front of commands. GParted LiveCD works very well for filesystem repair jobs.
Once you apply one of the the commands mentioned, after a breif pause, it will give you a report showing you the exact difference between the bootsector and its backup.
It will offer you three choices,
1) Copy original to backup
2) Copy backup to original
3) No action
?

You type the answer after the '?' prompt. I suggest typing a '2' so the bootsector will be restored from the backup copy. Be careful here because you probably have no way of knowing whether it's your current boot sector  (original) or your backup of your boot sector that has been changed somehow.
Normally, it would be the boot sector that has been changed, (possibly corrupted?).

Then, it will ask you to confirm,

Perform changes? (y/n)

I suggest typing 'Y' here. That's it, it should be fixed!

If that doesn't work, then try running FIXBOOT from a Windows recovery console.



Bad Magic Number in Superblock
* Checking root file system...
/dev/hda7: clean, 86708/1158720 files, 514281/2317386 blocks
                                                                    [ ok ]
* Starting RAID devices...                                          [ ok ]
* Setting up LVM Volume groups...                                   [ ok ]
* Starting Enterprise Volume Management System...                   [ ok ]
* Checking all filesystems...                                                        
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dev/hda1: 67606 files, 367651/439419 clusters
/dev/hda2: clean, 107803/1177344 files, 1449210/2329417 blocks (check in 4 mounts)
fsck.ext3: Bad magic number in super-block while trying to open /dev/hda4
/dev/hda4:
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contians an ext2
filesystem (and not swp or ufs or something else), then the superblock
root@yellow:~# ll exit from this shell and continue system startup.
rblock                                                              [ ok ]



Usually, you can just press 'Ctrl+d' keys to resume booting, and your system will boot up quite alright.
This is most often just another example of what happens when you forget to edit /etc/fstab with the changes after you do some work with disk partitioning sofware. In this example, the hda4 partition is listed as an ext3 partition in /etc/fstab, so  the operating system is trying to apply fsck.ext3 to it. That won't work too well if hda4 has been deleted and replaced with a FAT32 or NTFS partition.
When the system is running, just do 'sudo parted /dev/hda p', to see what  partitions and filesystems you have.
Open etc/fstab, (sudo gedit /etc/fstab), and update fstab with the currently correct details.

For more information about how to edit your /etc/fstab file, go to this website's Filesystems and Mounting Page.

If the partition you recieve this error message for really is an ext3 partition, then you will probably need to fix it by running some filesytem repair commands. Also see this website's Filesystems and Mounting Page for those.








'Stuck in the middle' Errors and Symptoms

Occurs when: Windows fails to chainload from GRUB

Looks like,
  Booting 'Microsoft Windows XP Home Edition'

root             (hd0,0)
 Filesystem type is fat, partition type 0xc makeactive chainloader +1 _
Symptoms:
Black background, white print on monitor
Shows list of GRUB commands
Ends with a blinking cursor _

Test: Open a GRUB shell and get grub to 'find' boot.ini, and /or ntldr.
If GRUB can't 'find' them, but you can see them when you mount the Windows partition with a LiveCD Linux, then maybe the partition is 'hidden'. A Birds's eye view of Windows XP.
Check the partition's status with a partitioning program like fdisk or parted.
If that's the problem, then use Super GRUB Disk to 'unhide' the partition.
You can also 'unhide' a partition with a partition editor like GParted -- LiveCD

If that's not the problem then another possibility is you might be trying to boot Windows in a logical partition without any boot loader files. Windows XP needs boot.ini, ntdetect.com and ntldr in the root of it's partition or it won't boot.
Try mounting the partition in a Linux Live CD and take a look at the files to see if everything is there.
Windows has a habit of deleting its own boot loader files if we install it after another Windows, (dual boot two Windows systems).
The intelligent way to install more than one Windows in a computer is to use GRUB from a live CD or a dedicated GRUB partition to 'hide' the old existing Windows system from the new one you are planning on installing. That way the new system will retain it's vital boot loader files.
After the installation, you use GRUB's 'hide' and 'unhide' commands to unhide the system you want to boot up, and hide the one you don't want to boot.
GAG Boot Manager can do that for you too, GAG Page.

To learn how to cope with this problem and fix your Windows installation, look further down this page to my Windows errors section, Error messages from Windows.