Note: This article is based on Ubuntu 12.04 Precise Pangolin LTS version. However it should work fine in all versions using GRUB2.

Well a lot many of us have a dual booting system setup with one operating system as Ubuntu and the other being Windows 7 in most cases or any other. However the problem Ubuntu beginners face is – getting used to it. The geeky linux culture is a bit of a daunting task to get used to, but then again, once used to it, people never turn back on open source.

How many times have you wanted to boot into Windows but forgot to select Windows in the boot menu or may be (in rare cases) ran out of time before you did that. Believe me, i’m one of such dreamy busy guys. After repeatedly booting into Ubuntu and restarting my system again only to get back to Windows, I was done. I set my mind, opened up the legendary Google Search page and typed ‘how to change boot order in ubuntu’. That’s it..! It was a piece of cake. Read on to know how i did it.

To change the default boot operating system, we have to first know its position. To know this, on your boot screen start counting from 0. That is, the first entry is numbered 0 and the last entry, Windows 7 in my case, is numbered 4. We will call this the boot-number.

First things first. Let me make you people clear that there are many small programs that do this in a jiffy. But what’s the fun in running applications in linux systems..? So lets get a bit more geeky and open up your ubuntu terminal by pressing Ctrl+T on your keyboard.

The file that needs our attention now is the ‘grub’ (GRUB: Grand Unified Bootloader) located in ‘/etc/default’. Before we make any changes to this file, lets take a backup of it. To do this, in the terminal, type the following command and hit enter.

sudo cp /etc/default/grub /etc/default/grub.bak

 Note: There is a space between ‘cp’ & ‘etc/default/grub’ and ‘/etc/default/grub’ & /etc/default/grub.bak’

It may ask for the account password. And the password won’t be visible when typed (as you can see in the above image). Just type the password and hit enter. ‘cp’ is a command to copy files through terminal.

That ends the backup thing. Now lets complete our mission. In the terminal, type and execute

gksu gedit /etc/default/grub

This opens up the grub file in which the changes are to be made.

Now change boot-number in ‘GRUB_DEFAULT’ field (highlighted in the image below) from 0 to 4, so that Windows 7 becomes the default operating system to boot into.

In case, if the time to select your option isn’t sufficient for you in the boot screen, you can change it by changing the default 10 seconds in ‘GRUB_TIMEOUT’ field to any number of seconds you like.

Now save the file and come back to the terminal.

To update these new booting rules, type and execute

sudo update-grub

It executes as shown in the image below.

That’s it! Piece of cake isn’t it?

In case something goes wrong, replace the edited file with the backed up file by executing

sudo cp /etc/default/grub.bak /etc/default/grub

Nothing went wrong in my case though.

 

source: http://www.yourkarthik.com/2012/06/change-default-boot-order-in-ubuntu.html

Share →

12 Responses to How to Change Default Boot Order in Linux Based Ubuntu 12.04 LTS

  1. ER says:

    very nice…much thanks work perfectly on first try.

  2. Abu Shoeb says:

    Thanks a lot. This is a nice tutorial. But In my case I had to put 6 as the GRUB_DEFAULT value.

  3. syed says:

    Hi…there is a problem ..on startup my keyboard doesnt work at times…and i am stuck and it doesnt load further than that…i went to hardware store and that guy in few click made it boot from the ubuntu..skipped all the choosing stages…from the BIOS…please help me with that…i cant find it on my own..and most of the ubuntu stuffs are so hard..

  4. Mark A. says:

    Great Tutorial! I have used it several times when changing boot order. Thank you for sharing!

  5. Michel says:

    Great tutorial

    In my case I had to install gedit….but that was real easy. When you type gedit at the prompt/root the command is shown to install the gedit

    But thanks…it realy helped me out

  6. Florin says:

    Wery good tutorial ….

    For me it didn’t work….

    On my doughter’s desktop I have installed a Windows XP (an old installation), then I have installed XUBUNTU, and after that I have installed UBUNTU 12.04 … (kind of low resources desktop, I didn’t know if Ubuntu 12.04 will run on this desktop, but it does, and it does it with great stile!)…

    In this moment Grub starts with XUBUNTU on first choice.

    I need (my doughter wants) to change that UBUNTU 12.04 will be the first OS on startup…..

    I followed all the steps above in Ubuntu 12, but when starting again the computer …. Xubuntu is still the first OS that the computer starts with….

    ….

    • Ian Christie says:

      Did you notice that the first entry in the list is not entry 1 but entry 0? If you didn’t notice you may have put in the wrong number. I am not sure what happens if you use a number for an entry which doesn’t exist. This whole business of beginning indices at 0 has a long history. I know this reply is more than six months late but mybe it will help you or perhpas someone else.
      Cheers
      Ian

  7. besiix says:

    Thanks, really clear and well written tutorial. Really made this a fun easy task!

  8. mitch says:

    is there a way to set the default to a certain selection in a sub menu? for some reason unity is broken on my newest kernel, so i need to goto previous releases. and scroll to the third option to run my computer properly

  9. Narain says:

    Appreciate it..Nice tutorial!

  10. Ashrob says:

    Great tutorial. I suppose you can’t have it both ways but I would like to have seen the process you went through to learn these commands. That would have been as interesting to me… teach a woman to fish etc.

    Also, (it’s picky but as you seem to be interested in the details) where it says “Now save the file and come back to the terminal.” I would add “Now save the file, close it and come back to the terminal.” Otherwise you may find that you have people asking why the Terminal is stuck.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>