grub

Changing Default OS after Ubuntu Installed

I am pretty much new to using Linux, and I’ve recently took the decision to use it more and familiarise myself with it. After installing Ubuntu 14.04 Tahr alongside with Microsoft Windows, I’ve found that Ubuntu has took over my PC, meaning whenever I start the PC it starts in Ubuntu without asking me if I want to start in Windows or Ubuntu.

Here is a simple solution for that…

Rather than just listing the commands to do it, I will take the opportunity and discuss all trivial details that would benefit a Linux newbie.

Open Terminal Window

Log in into Ubuntu, and open a terminal window. You can do this by pressing Ctrl + Alt + T.

Open Bootloader File for Edit

Write the following command to edit the boot configuration file:

For folks not familiar with Linux command (like myself), sudo is written before any command to allow root user privileges to the command being executed. Root user is the super admin user in Linux.

The first time you use sudo in a terminal window, you are asked to enter your password to confirm identity.

gedit is a command that opens gedit text editor, one of the famous text editors that comes with most Linux installations.

‘grub’ is the name of the boot configuration file, and it stands for “GNU GRand Unified Bootloader” [ref]. It is located at the path /etc/default. Historically, etc directory (which stands for etcetera, nothing complicated) is used to hold configuration files for various system areas. As opposed to bin folder holding binaries and so important stuff, etc folder holds only configuration files hence the name, as it is holding less important files [ref].

Make Changes to Bootloader File

There are two lines in the GRUB file to change:

GRUB_DEFAULT

This line is responsible for setting the default OS to start the system in. By default its value is ‘0’ which means start in Ubuntu by default. Count how many choices are there in the boot menu starting at zero to find out what is the number for Windows operating system. Choices are typically as following:

Ubuntu, advanced, memory test, memory test, and Windows. So probably Windows will be number 4. If that is the case, change the line to be “GRUB_DEFAULT=4”.

GRUB_TIMEOUT

This defines the timeout the boot menu waits for a keyboard press, before it decides for you and choose the default operating system to boot in.

GRUB_HIDDEN_TIMEOUT and GRUB_HIDDEN_TIMEOUT_QUIET

Use these settings to control if the boot menu will remain hidden for a while waiting for a key to be displayed or otherwise the menu will be displayed every time the system is restarted.

At the end of editing the file, save the file and close gedit.

Apply Changes to GRUB Configuration

Unlike Windows XP boot.ini, the changes doesn’t apply simply by modifying the file. You have to run the following command in order for the changes to be applied and current.

Now restart your computer, don’t touch the keyboard, you will be logged in Windows. Now the rest of the family can use the couter without blaming you for ruining their life.

When you want to get back to Linux and have a play around, reboot the PC and press any keyboard key as soon as the BIOS splash screen goes away.

Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *