Friday, October 29, 2010

How to change the default OS in the boot menu,Ubuntu 10.04

I am planning to put short tutorials on how to do simple stuff.I personally hate going through the threads and some cryptic talk not related to the query at all.

AIM :
Change the default OS to boot in the grub(ver.2) menu.

ASSUMPTIONS:
Simple vi editing.
If u don't know vi editing u can use $gedit to edit files.


HOW TO:1.Become the root user by
$sudo su
Then go to the /etc/default/ directory.
$cd /etc/default/
2.Make backup of the grub file.
$cp grub grub.bak

3.Edit grub.
$vi grub
4.You should be able to see the entry
GRUB_DEFAULT=X
in this file, where X is the Serial number of the OS listed in the menu.This starts from 0.If the desired OS is at the position 5 when you count from top to bottom then you need to change this entry to
GRUB_DEFAULT=4

5.Save the file by Esc->:wq6.Now we need to run update-grub to build the dependent files.
$update-grub7.Thats it.Reboot and see the changes.
As a final note, instead of giving the index number for GRUB-DEFAULT it is better to give the kernel version.This helps, as whenever you update to a newer kernel the number of entries in the menu change and so does the index.I will find it out and post it as soon as I try it out myself and I am not too lazy.

No comments:

Post a Comment