Advertisements

Recovering Ubuntu After Installing Windows

Recovery of grub boot-loader.

This page documents how to restore or recover the boot-loader after installing Windows. Ubuntu uses the Grub boot-loader; refer to the GrubHowto or Grub2 for more information on Grub. Some reasons to repair boot-loader might include installing Microsoft Windows after installing Ubuntu, or sume other Linux Distro or adding or removing a hard drive, or changing hard drive settings.

Note: These instructions provide multiple options. Pick the option which suits best. otherwise, choose recommended option. (recommended reading: Community Ubuntu Documentation.)

The graphical way

  • Insert Ubuntu CD, reboot computer and set it to boot from CD in the BIOS and boot into a live session. We can also use a LiveUSB if we have created one in the past.
  • Install and run Boot-Repair
  • After this, click “Recommended repair” and apply. If we are willing to use the advanced options, make sure we leave the “Reinstall GRUB” checkbox ticked.
  • Now reboot the system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. We will be able to choose between Ubuntu and Windows.

The terminal way

* Open a terminal. As of Ubuntu 11.10 and 11.04, this can be done by opening the Unity Dash ( click the Ubuntu logo in the top panel or use the Windows key on the keyboard) and typing in “Terminal”, and clicking what comes up. On earlier versions, we could also do this by going to Applications -> Accessories -> Terminal. In many versions [ctrl+alt+T] would open the Terminal.

  • On standard bash prompt, type:
sudo grub-install /dev/XXX

where XXX is the device of  Ubuntu install. (eg: grub-install /dev/sdb). Hint: We can also use /dev/disk/by-label/ if the partition installed on has a label. We can determine the /dev node for such a device by running:

ls -l /dev/disk/by-label/

This will give the output of something like:

lrwxrwxrwx 1 root root 10 Oct 16 10:27 data -> ../../sdb2
lrwxrwxrwx 1 root root 10 Oct 16 10:27 data2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 16 10:27 fat -> ../../sda6
lrwxrwxrwx 1 root root 10 Oct 16 10:27 home -> ../../sda7
lrwxrwxrwx 1 root root 10 Oct 16 10:27 root -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 16 10:27 swap -> ../../sda5
lrwxrwxrwx 1 root root 10 Oct 16 10:27 windows -> ../../sdb1

From here, find only the drive name, ignore the partition number, that is, for partitions labeled “root”, “data2”, “fat”, “home” and “swap” it’s all still just sda. This is due to the fact that GRUB is installed in the MBR of the drive, and not on a partition.

Now reboot the system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. We will be able to choose between Ubuntu and Windows.

New Option  is ‘grub-cutomizer

This is the latest tool from Daniel Richter who defines it as ‘Grub Customizer is a graphical interface to configure the grub2/burg settings with focus on the individual list order – without losing the dynamical behavior of grub.’

To install Grub Customizer:

sudo apt get-install ‘grub-customizer’

Now run the command ‘grub-customizer. It looks like this:

Grub-Customizer Main Window © Sandeep Bhalla 2012

Choose the options we want to see on the grub splash menu (i.e. untick other options) and choose save. If we want to change other preferances for booting, click preferences from above and tick appropriately. It is done. Just re-boot and test.

Advertisements

About Sandeep Bhalla

A lawyer, thinker, author, Linux/Ubuntu power user but often an economist or gardener or philosopher or cook or photographer depending upon the current thought and environment. View all posts by Sandeep Bhalla

Please share your views.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s