Wednesday, 19 May 2010

Ubuntu - Grub - Restoring the grub config.

Trying to make Ubuntu 10.04 boot into command line instead of the display manager, the grub config got messed up. As a result ubuntu would boot but I could not see the display.

Followed the steps to make it work.

1. Boot from the Live CD. Click "Try Ubuntu". Dont "Install".
2. After Ubuntu boots up. Open the terminal.
3. Ubuntu Live CD has a OS of its own. So we see the usual directory list at / directory.
4. Mount the OS directory on the hard drive which is installed on the computer.
To get the list of the partitions.
$sudo fdisk -lu

5. Create the directory to mount.
$sudo mkdir /mnt/harddriveOS

6. Mount the OS. sda5 in the command below might be different according the no of OS'es and partitions on the computer.

$sudo mount /dev/sda5 /mnt/harddriveOS

7. Edit the grub config file.
$gksu gedit /mnt/harddriveOS/boot/grub/grub.cfg

8. Also backed up the working copy of grub.cfg for future reference and checkpoint so that experiments don't end up in a non-bootable,non-accessible junk on hard drive.

Friday, 14 May 2010

Ubuntu 10.04. GRUB - Change default OS to load

Installed Ubuntu 10.04 with Windows 7.
By default Linux boots. Followed the following to make Windows 7 as default.

1. Ubuntu 10.04 uses GRUB2. Most of the links from google will talk about "menu.lst" file which does not exist anymore.

2. The file to look for is /etc/default/grub

3. This had the GRUB_DEFAULT=0 as the first line.

4. Check the file /boot/grub/grub.cfg to find out the Sr no for Windows 7. The numbering starts from 0. So Windows 7 was 5th in the Sr. number.

5. Use GSKU GEDIT /etc/default/grub to edit the file. Change to GRUB_DEFAULT=4.

6. User UPDATE-GRUB command to install the updated GRUB.

Thats it. Now Windows 7 should loaded by default. Now my wife need not run and save the computer from booting into Ubuntu.