Possible Duplicate:
How do I set Windows to boot as the default in the boot loader?

I want to know how to make Windows the default boot OS in Ubuntu 11.10, how to make Windows boot first on GRUB2, specifically for Windows 7, which is my current version.

I know that are some tutorials about this, but it seems that I made a mistake, so I'm asking. Luckily nothing serious happened. I didn't lose my data.

The difference between my question and the tutorials is that the tutorials are from older version.

Sorry for any disturbs and redundancy of the question.

I'll love it better for a GUI app that making easy the boot.

P.S: I forgot to say the version of my OS's

I am running

  1. Windows 7 Home Premium X64 bit
  2. Ubuntu 11.10 X64 bit

I hope this will make understand better because I now saw it a tutorial that for 64 bit versions Startup-Manager doesn't work.

link|improve this question
FYI ⋯ The two questions are not exactly the same. This one is about making Windows the default boot, and the other one is how to make the Windows boot loader the default. – keepitsimpleengineer Dec 1 '11 at 20:14
feedback

closed as exact duplicate by fossfreedom, Jorge Castro, Javier Rivera, Marco Ceppi Nov 29 '11 at 3:12

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

3 Answers

up vote 17 down vote accepted

There are two ways of doing this using editing a grub file.

These are described in the Ubuntu Communuity Documentation Grub2 page

The two ways are

  • Boot which ever operating system you booted last time, the "saved method"

    This is the on I use. It lets me decide which one I going to use and will allow me to reboot into that system, handy when I'm updating.

  • Boot a specific operating system by default, your exact question

To start we need to find out what we are booting, open a terminal (dash, type terminal, … ) and type in grep menuentry /boot/grub/grub.cfg

user@YourComputer:~$ grep menuentry /boot/grub/grub.cfg
menuentry 'Ubuntu, with Linux 2.6.35-31-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-30-generic' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry 'Ubuntu, with Linux 2.6.35-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Windows NT/2000/XP (loader) (on /dev/sda1)" {
menuentry "Ubuntu, with Linux 2.6.32-34-generic (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-34-generic (recovery mode) (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-33-generic (on /dev/sdb1)" {
menuentry "Ubuntu, with Linux 2.6.32-33-generic (recovery mode) (on /dev/sdb1)" {
menuentry "Windows Vista (loader) (on /dev/sdc1)" {

From mine you can see why I prefer the "saved" method.

Now you are ready to edit the grub file…

Type in the terminal sudo nano -B /etc/default/grub and your password if asked

user@YourComputer:~$ sudo nano -B /etc/default/grub

and the nano editor will open, thus (for mine)...

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=saved
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="delayacct"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# 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'
#GRUB_GFXMODE=640x480
GRUB_GFXMODE=1280x800
GRUB_GFXPAYLOAD_LINUX=1280x800x8

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
GRUB_INIT_TUNE="480 440 1"

GRUB_SAVEDEFAULT=true
GRUB_BACKGROUND=/usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga

In my preferred way, I made these changes from the standard grub file:

  • I changed the value of GRUB_DEFAULT to "saved"

GRUB_DEFAULT=saved

  • and I added this line…

GRUB_SAVEDEFAULT=true

In the way you are asking far to this

  • Change the value of GRUB_DEFAULT to the name of the Windows system you want to always boot. This will be found in the previous grep … output prior. For my system if I wanted to only allways boot my Window XP, I set GRUB_DEFAULT to "Windows NT/2000/XP (loader) (on /dev/sda1)", everything between the "'s.

GRUB_DEFAULT="Windows NT/2000/XP (loader) (on /dev/sda1)"

You could set GRUB_DEFAULT to the line number in the menu entry list (with 0 being the first), but when the kernel in Ubuntu is updated grub adds the new kernel to the top of the list, you would have to change the number, since Windows is the last one in the menu entry list. You can see this in my menu entry list.

Important last step

Now you have to run update-grub to update the system generated grub.cfg file in the /boot/grub directory.

Type into your computer sudo update-grub and your password if asked…

user@YourComputer:~$ sudo update-grub
Generating grub.cfg ...
Found background: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga
Found linux image: /boot/vmlinuz-2.6.35-31-generic
Found initrd image: /boot/initrd.img-2.6.35-31-generic
Found linux image: /boot/vmlinuz-2.6.35-30-generic
Found initrd image: /boot/initrd.img-2.6.35-30-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows NT/2000/XP (loader) on /dev/sda1
Found Ubuntu 10.04.3 LTS (10.04) on /dev/sdb1
Found Windows Vista (loader) on /dev/sdc1
done

Notes on nano

nano is especally easy to use in the terminal. Move around with the arrow keys. Type in you addtions, delete the unwanted.

The " -B" (or " --backup") option backs up the previous version of it to the current filename suffixed with a ~. Very handy in case of the dreaded Fat pfinger effect.

When you are though, Crtl-O will allow you to save your edits by hitting Enter. Closing nano without saving, Ctrl-X These and other options are shown at the bottom of the terminal screen with the ^ indicating Ctrl

^G Get Help    ^O WriteOut    ^R Read File   ^Y Prev Page   ^K Cut Text    ^C Cur Pos
^X Exit        ^J Justify     ^W Where Is    ^V Next Page   ^U UnCut Text  ^T To Spell

Notes about nano, sudoeditor, and other editors.

Some in the Ubuntu community suggest sudoedit instead of nano. I recommend nano (which is the default sudoedit editor in later distributions of Ubuntu) instead of sudoedit because the default can be overridden in non-obvious ways (unless you are an administrator). sudoedit is safer in that it automatically saves a backup copy of the edited file, but the "-B" command line option in nano does the same thing. nano is safer than other editors like vi or emacs because it doesn't have scary shell escapes.

If you prefer not to use the nano editor and prefer the Gnome Text Editor, instead of sudo nano -B use gksu gedit. I generally do this for large files, and /etc/default/grub could easily be considered a large file. Thus type in gksu gedit /etc/default/grub instead of sudo nano -B /etc/default/grub. Note that the Gnome text editor does not automatically make a backup!

Notes on my grub file

I made some changes to grub for my personal needs. Such as the background picture of the moon launch. How to do these are discussed at the Ubuntu Community Documentation page on Grub2, recommended.

Good luck!

link|improve this answer
This incredibly complex, but excellently written answer makes a mockery of your username, sir. Well done! – Scaine Nov 27 '11 at 12:13
1  
Keep it simple is based on the Einstein quote: "Things should be as simple as possible, but not too simple." (The last three words are omitted when some quote this). Thanks for the kudo... – keepitsimpleengineer Nov 28 '11 at 20:24
love it help me a lot , but as i saw , GRUB customizer it much easy :P XD – Rani.Shemer Dec 2 '11 at 20:38
feedback

Use startup manager, which you can start from the dash. There you can use the OS to start with in the dropdown menu.

startup manager

link|improve this answer
1  
Sorry I just saw that you said that startup manager is not working in the 64bit version. you can try instead grub customizer Install Grub Customizer in ubuntu Open the terminal and run the following command sudo add-apt-repository ppa:danielrichter2007/grub-customizer sudo apt-get update sudo apt-get install grub-customizer Once you install you can open from Applications -> System Toiols -> Grub Customize – dago Nov 26 '11 at 17:50
feedback

Change the value of GRUB_DEFAULT in /etc/default/grub to whatever windows is on grubs list of available operating systems when you boot. For example in my case I would have to change that line from

GRUB_DEFAULT=0

to

GRUB_DEFAULT=5

After that, run sudo update-grub.

link|improve this answer
1  
This method needs to be modified to always correctly identify the correct menu entry (for windows). This method will only work in the simplest setup, and may NOT survive a kernel update or other changes. See: ubuntuforums.org/showthread.php?t=1195275 – david6 Nov 27 '11 at 5:52
Today only the newest kernel has 2 entries (recovery and normal boot), all other kernel's are grouped in "other kernels" (or something similar, I don't recall the name). So I have to disagree, it survives kernel updates. – s4ms3milia Nov 27 '11 at 10:40
I added the comment because your example used =6 – david6 Nov 27 '11 at 20:35
That's right, it should be =5. – s4ms3milia Nov 28 '11 at 8:40
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.