Sunday, July 29, 2012

How to Change Default Boot Loader in Centos 6



Once the installation completes, the system will display the standard boot countdown screen. Pressing any key on the keyboard at this point will display the boot menu screen as illustrated in the following figure: 


 This menu provides the option of booting either "CentOS" or "Other". In this instance, selecting "Other" will boot your original Windows installation. 

Editing the CentOS 6 Boot Menu

The boot menu configuration settings are stored in the /boot/grub/menu.lst file. This file may be edited in a terminal window as follows: 
su -
gedit /boot/grub/menu.lst

When prompted by the su command to enter a password be sure to enter the root password created during the installation process, not the password you created for your user account during the setup agent configuration steps.

The contents of a typical menu.lst file is listed below:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_centos62-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-220.el6.i686)
        root (hd0,1)
        kernel /vmlinuz-2.6.32-220.el6.i686 ro root=/dev/mapper/vg_centos62-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos62/lv_swap rd_LVM_LV=vg_centos62/lv_root rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-220.el6.i686.img
title Other
        rootnoverify (hd0,0)
        chainloader +1

The above menu.lst file contains options to boot for two operating systems. The CentOS section of the configuration typically reads as follows:

title CentOS (2.6.32-220.el6.i686)
        root (hd0,1)
        kernel /vmlinuz-2.6.32-220.el6.i686 ro root=/dev/mapper/vg_centos62-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos62/
lv_swap rd_LVM_LV=vg_centos62/lv_root rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb
crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM
        initrd /initramfs-2.6.32-220.el6.i686.img

The Windows section of the configuration is likely to be similar to the following:

title Other
        rootnoverify (hd0,0)
        chainloader +1

The default=0 line indicates that the first entry in the file is to be the default operating system (in other words, the operating system that will boot by default if the user does not intervene during the boot phase). The timeout=5 directive specifies the number of seconds the boot screen is displayed before the default operating system is automatically booted.

To configure the system to boot Windows by default simply change this line so that it reads as follows:

default=1

To increase or decrease the timeout before the default operating system boots, change the timeout value (in this case to 20 seconds):

timeout=20

The final task in our dual boot configuration process is to rename the Windows boot option to something more descriptive than "Other". To achieve this, simply change the "Other" line as follows:

title Windows 7

Note that the title value can be anything you choose.

The next time the system is rebooted, the boot screen will wait 20 seconds before auto-booting. If no keys are pressed the system will now boot Windows by default, instead of CentOS 6. If the user does intervene and display the boot menu, the Windows option is now titled "Windows" and not "Other".

 

No comments:

Post a Comment