Changing the default Boot OS in GRUB on Ubuntu 9.10


Ubuntu 9.10 ships with the new GRUB (Grand Unified Boot Loader 1.97 beta) in plain words its the software that boots the operating system you choose when you boot the computer. In earlier versions of Ubuntu / Grub to change the menu on the grub screen, one had to edit the /boot/grub/menu.lst file. In the new system this a little different from just editing the one file.

The GRUB configuration now resides at /boot/grub/menu.cfg But do not edit this file as it is generated from files from /etc/grub.d/* and /etc/default/grub.

And here is how to change the default operating system.

  • First be root sudo su
  • Edit the file /etc/default/grub
    The contents of the file would be like as shown below :
    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    # Uncomment to disable graphical terminal (grub-pc only)
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    # Uncomment to disable generation of recovery mode menu entrys
  • Change the GRUB_DEFAULT value to number your default operating system
    0 - Linux,
    1 - Linux,
    2 and 3 - Memtest,
    4 - Custom OS (Windows?)

    Change GRUB_TIMEOUT to change the default timeout if you want to.

  • Run update-grub

root@digitalpbk# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Home Edition on /dev/sda1

Reboot the system to verify your changes.

Happy Booting Winking /p>


Although I found a built in command grub-set-default, It did not seem to do the job.

On /etc/grub.d Directory you can see many files named in the format XX_...where XX is a 2 digit number. The ones starting with 0 are not listed. Rest is starting from 1X, 2X, 3X etc.

  • 1X_ would be your linux operating system
  • 2X_ would be usually the memtest
  • 3X_ would usually be your other Operating System, (Microsoft Windows? )


Found an easier way ? Please Share Smiling /p>

Liked it? Let your friends know too ...
Saved your day? Thank me
Similar Posts
Related Searches


Thanks a lot !!

Thanks digitalpbk. I am coming from howtogeek webpage through the link you posted in the comments section. Now it's working :) and Thanks

Thanks a lot!

Thanks a lot!

what if Windows is not #4?

For me, Windows was #7 in the menu.
So I could have set GRUB_DEFAULT=7, I guess, but instead I took mscomms's advice and did
mv 30_os-prober 02_os-prober
so that *_os-prober would be before any other menu entries.

However, *_os-prober produced DELL Utility Partition before Windows XP boot partition.
So I ended up setting GRUB_DEFAULT=1 (instead of 0).
I think that will work.

I would also like to get rid of the old linux kernel in my boot menu... but I spose it doesn't really hurt anything.
It's just a cluttered list.

Remove old kernels


I've been searching all over for a simple way to change default OS in grub. This method worked great; thank you very much. I'm still puzzled though. If it ain't broke, why fix it? Menu.lst worked just fine.


This worked for me.
Thanks for putting this up.

Awesome - worked great.

Awesome - worked great. Thanks for your help.

Order change on grub menu

Go to /etc/grub.d
The scripts in this directory are run in the orer of the first 2 digits so mv 30_os-prober to 09_os-prober it will now run before the 10_linux script and your Windows install will appear first

I want my Windows XP to sit

I want my Windows XP to sit at the top of the Grub menu.
How do I do this?


Go to /etc/grub.d The scripts

Go to /etc/grub.d
The scripts in this directory are run in the orer of the first 2 digits so mv 30_os-prober to 09_os-prober it will now run before the 10_linux script and your Windows install will appear first

Can't see Grub file.

See i have upgraded the the Ubuntu 9.10 from 9.04. And wants to change boot image. But when i put the command # sudo gedit /etc/default/grub After being a Root. then opening a new file.. When i brows that folder then also i am not able to find out that grub file... So will you please suggest me what i need to do?

Has the GRUB been updated?

Just make sure your grub has been updated.
Try /boot/grub folder , ls it and paste the output ?


Edit the file /etc/default/grub

on typing this from terminal am getting the following error message, "/etc/default/grub is not a file or directory"

Try the command update-grub

Just run the update-grub command, and post the response ?

Re:Changing the default Boot OS in GRUB on Ubuntu 9.10

When I do that, I get the following reaction:
"bash: /etc/default/grub: Permission denied "
How to handle that. Any idea?


Are you root ?

Make sure you are the root user before editing the files.
If you are using gedit to edit the files, make sure you use the following command :

gksudo gedit file

I tried running sudo su and I

I tried running sudo su and I get

However when I input the command it also says permission denied.

Can you help me?

: /

The final!

Ok, done!

First, open the console and enter sudo su, then enter your password in order to get to root mode.

Type; sudo gedit /etc/default/grub this will open the file grub in the gedit text editor. You can make the changes easily. Remember, the number you need to enter is the number of the row that your windows is on. You must define 0 as the first row as you count. (For me, it was 10) After making the necessary changes save and exit gedit. Then write

update-grub to the console.

When its done, exit. This is it. Hope it works for you too.

ok i've found a solution

Just enter the command; sudo vi /etc/default/grub and you'll be able to enter the file.

The same thing

I'm having the same problem... permission denied... any suggestions?

Re-Read the article...... you

Re-Read the article...... you need elevated privilages...... 'sudo su'

Post new comment

The content of this field is kept private and will not be shown publicly.