Monday, August 17, 2009

Changing boot parameters

Open a terminal and do the following:
Type sudo
Type vim /boot/grub/menu.1st
Press Insert key
Make necessary changes
Press Esc key
Type :wq! and press Enter key

You can change the timeout value to your preference. During bootup after that number of seconds without any key press, the default OS will be automatically booted unless the user manually chooses one at boot time.

To cange the default boot OS simply change the value in default=X. The numbers are counted from 0. For eg if the OS you want to boot by default is the third title in your menu.1st file then make the following change:

To change the names displayed for the operating systems at the boot menu simply change the title in the menu.1st file.

To comment a line in the menu.1st file, simply add a # symbol at the start of the line.

To remove an entry from boot menu, either comment or remove the lines for that particular entry from the menu.1st file. The lines to remove will include a title line and two or three option lines below it in the menu.1st file.

To add Windows entry into GRUB menu, add the following lines at the end of menu.1st file:
title Microsoft Windows
root (hd0,X) - where X is windows partition no
chainloader +1

P.S. Before making changes to menu.1st file it is good to backup your existing file by typing the following in a terminal:
cp /boot/grub/menu.1st /boot/grub/menu.1st_backup
In case you corrupt the boot file you can restore it by reversing the above command:
cp /boot/grub/menu.1st_backup /boot/grub/menu.1st

Recover boot loader

If any os like Win XP is installed on a sytem running linux, the linux boot loader GRUB gets overwritten. This creates problems as the windows boot loader NTLDR is unable to boot linux. To solve this issue simply restore GRUB as the boot loader and you can dual boot both linux and XP. To restore GRUB try any one of the following methods:
  • Insert a linux installation CD and enter the Rescue mode. If such a boot option is not visible, type "linux rescue" at the boot : prompt. At the terminal which opens, type the following one after the other, where X is the partition containing linux. To find this simply type "root (hdO," and hit the tab key, which will display the partitions on your disk. Choose X as the one with type Ox83 :
root (hdO,X)

  • Boot into a live CD environment. Open a terminal and type the following commands sequentially :
sudo grub
find /boot/grub/stage1 - output will be like (hdO,X)
root (hdO,X)
  • The third method is using the graphical Recover options that come with certain distros of linux. Simply enter the recovery mode with the installation CD in the drive during boot. There will be automated recovery options for restoring GRUB. However this is not available with all distros of linux.

Few Amazing Videos!!!