Sunday, May 24, 2009

What is Grub and how to configure it..??

HOME PAGE

GRUB

GRUB combines installations with one install command and allows for MD5 encryption of passwords. When a configuration file is configured incorrectly, the system reverts to the command-line prompts.

GRUB Configuration File

Given below is a sample /boot/grub/grub.conf file.

default=0
 
timeout=10
 
splashimage=(hd1,2)/grub/splash.xpm.gz
 
password --md5 [encrypted password]
 
title Linux
 
password --md5 [encrypted password]
 
root (hd1,2)
 
kernel /vmlinuz-2.6.23-13 ro root=LABEL=/
 
initrd /initrd-2.6.23-13.img
 
title Windows XP
 
password --md5 [encrypted password]
 
rootnoverify (hd0,0)
 
chainloader +1

The default = option tells GRUB which image to boot by default after the timeout period. The splashimage option specifies the location of the image for use as the background for the GRUB GUI. The password option specified the MD-5 password to gain access to GRUB's interactive boot options. To generate an md5 password, run the tool grub-md5-crypt as root. Copy this into your grub-conf password—md5. You can create separate passwords for each entry in the file. The initrd option specifies the file that will be loaded at boot time as the initial RAM disk.

The rootnoverify option tells GRUB to not try to vary the root of the OS. The chainloader+1 tells GRUB to use a chain loader to load Windows on the first partition of the first disk. It uses the blocklist notation to grab the first sector of the current partition with '+1'.

For other parameters refer to grub man pages.

Booting Fallback Systems

GRUB supports a fallback mechanism of booting one or more other entries if a default boot entry fails.

Suppose that you have three systems, "A," "B," and "C." "A" is a system that you want to boot by default. "B" is a backup system, which is supposed to boot safely. "C" is another backup system, which is used in cases where "B" is not working properly.

Let's suppose you want GRUB to boot the first system that is bootable among "A," "B," and "C." To do this, write configuration file like this:

default saved
 
timeout 10
 
fallback 1 2
 
title A
 
root (hd0,0)
 
kernel /kernel
 
savedefault fallback
 
title B
 
root (hd1,0)
 
kernel /kernel
 
savedefault fallback
 
title C
 
root (hd2,0)
 
kernel /kernel
 
savedefault

GRUB will boot a saved entry by default and save a fallback entry as next boot entry.

When GRUB tries to boot "A', GRUB saves "1' as next boot entry, because the fallback command

specifies that "1' is the first fallback entry. The entry "1' is "B', so GRUB will try to boot "B" at next boot time if "A" fails.

Likewise, when GRUB tries to boot "B," GRUB saves "2" as next boot entry, because fallback specifies "2" as next fallback entry. GRUB will boot "C" after booting "B."

You need to run grub-set-default when "A" starts correctly or you fix "A" after it crashes, since GRUB always sets next boot entry to a fallback entry. You should run this command in a startup script such as rc.local to boot "A" by default:

# grub-set-default 0

where "0" is the number of the boot entry for the system "A."

Troubleshooting

Let's suppose you installed GRUB, a third party boot manager program, on a Windows XP-based machine. When you try to start this computer after an unsuccessful upgrade to Windows Vista, the computer does not start. Instead, a black screen appears together with a blinking underscore. The Windows Vista Setup program does not restore GRUB.

To fix this problem, use the Windows XP Recovery Console to write a new boot sector to the system partition. To do this, follow these steps:

  1. Use the Windows XP CD to start the computer.
  2. At the Welcome to Setup screen, press R to repair Windows.
  3. Log on to the Windows XP installation that you want to repair.
  4. Type fixboot, and then press ENTER.
  5. Type y, and then press ENTER to confirm that you want to write a new boot sector to the system partition. When you do this, the following information appears:
    The new bootsector was successfully written.

HOME PAGE

No comments:

Post a Comment