How to fix GRUB errors? - Part I

GRUB refers to GRand Unified Bootloader.Briefly, a boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software.Then the kernel initializes the rest of the operating system (e.g. a GNU system).GNU GRUB is a very powerful boot loader, which can load a wide variety of free operating systems, as
well as proprietary operating systems with chain-loading.

You may encounter different GRUB error while you have Dual-boot configuration of Windows and Linux on the same hardware.The different errors you might come across includes any of the following:

1. GRUB Error 15
2. GRUB Error 22
3. GRUB Error 18
4. GRUB Error 16
5. GRUB Error 2
6. GRUB Error 21 and so on.

In this article we will study each of the conditions with specific conditions.

Lets start with a general scenerio which you may face while the dual boot configuration.

Condition 1:

You have Win Xp and Red Hat Linux on the same hard disk.At boot time you see a menu to choose Windows or Linux.But one day you reinstall Windows Xp and it rewrites your MBR and the menu has gone, now you can only see and boot Windows.

How to fix it?


1. Insert the official Red Hat disc 1 in your CD-ROM and boot your computer.
2.Once inserted,it will start booting from the CD.You will see a screen that displays a boot prompt. Enter linux rescue at the boot prompt to boot the system in rescue mode.
3.Select the English as a default langauge as required.Press OK.
4.Select the keyboard type, which defaults to us (USA). Press OK.
5.Rescue mode will attempt to mount your existing partitions under /mnt/sysimage directory. You should select the Skip button because if you are trying to fix a file system problem.
6.Once you see shell prompt, type grub
7. You will now see grub> prompt which is awaiting for some input.

Now you need to be very careful with the steps ahead.Remember that for grub (hd0,1) means hda (primary controller master), second partition.Now we need to tell grub where are the grub files.If you know where they are, type something like:
root (hd0,1)

else if you have no idea, type:

find /boot/grub/stage1
and then the root command with the correct parameters:

setup (hd0)
to install it on hd0, that is MBR of the first HD.

type quit and reboot.
The menu will appear again.
If you want to make some changes to the boot menu, you must edit the file: /boot/grub/menu.lst

A sample menu.lst file is this:


title Red Hat Linux (2.6.32-14)
root (hd0,1)
kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
initrd /boot/initrd-2.4.18-14.img
title Red Hat Linux (2.6.32-openmosix2)
root (hd0,1)
kernel /boot/vmlinuz-2.4.18-openmosix2 ro root=/dev/hda2 hdc=ide-scsi
initrd /boot/initrd-2.4.18-openmosix2.img
title WindowsXp
rootnoverify (hd0,0)
chainloader +1

Now you can see both the Windows and Linux being displayed in GRUB menu.

Condition 2: GRUB Error 15

If you find such error messages as shown below:

Booting 'Fedora Linux'

root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
kernel (hd0,0)/boot/kernel-2.4.20 root=/dev/hda3 vga=792

Error 15: File not found
Press any key to continue...
info grub wrote:
15 : File not found

This refers to GRUB Error 15 which we are going to discuss now.

The GRUB Error 15 means that some specific files are gone missing and cannot be found. Fortunately, disk is OK.If it's the kernel that it's missing (bzImage, kernel...):make sure that the file it is referring to exists on your boot partition.

To find out what the exact name of your kernel is, first boot from the First CD.Mount /boot if you've got a seperate partition, or mount / if you don't.

Follow the following steps:

#cd /boot

This will list all the kernels that you've got on your boot partition.If your kernel is missing make sure that you compiled a kernel either with genkernel or make menuconfig.

#cd /usr/src/linux/
#make menuconfig

and you copied it to your boot partition.

#cp /usr/src/linux/arch/[your architecture, e.g. i386]/boot/bzImage /boot/

However if this error is caused while trying to install grub. And is similar to this one:

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

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

First of all make sure that you changed root(hd0,0) and setup (hd0) according to your systems specifications.

It may also be possible that grub uses other numbers for your drives than your kernel. So although it may be hda it could be that it is not hd0. However usually this is not the case.

Or else give this line a try:

grub-install /dev/bootdevice

If all else fails make sure that your partition is not somehow corrupt. Be sure that you are able to great symbolic links.

Hope the above trials works for you.

In the next tutorial we will discuss about the other GRUB error and troubleshoot tips.

No comments:

Post a Comment