Thursday, June 7, 2012

HowTo Change Boot Priority from Linux to Windows in dual boot

I love Linux, but there are times when you just need to use Windows and want to boot your system with Windows (by default) instead of Linux. So in that we need to change Windows Bootloader as default bootloader. So here we discuss the simple Howto Change the Boot priority in dual boot system from Linux to Windows.

To start we need to find out what we are booting, open a terminal (dash, type terminal, … ) and type in terminal 

tanishka-Studio-1558 tanishka # grep menuentry /boot/grub/grub.cfg
menuentry 'Linux Mint 12 64-bit, 3.0.0-12-generic (/dev/sda5)' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry 'Linux Mint 12 64-bit, 3.0.0-12-generic (/dev/sda5) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {

Here you see that Windows 7 loader in is /dev/sda1

Now you are ready to edit the grub file…

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

tanishka-Studio-1558 tanishka :~$ sudo nano -B /etc/default/grub

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

     File: /etc/default/grub                            

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

# 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 ...)

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

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 always boot my Window 7, I set

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)" 

and I added this line…


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…
tanishka-Studio-1558 tanishka :~$ sudo update-grub
Generating grub.cfg ...

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 

DISCLAIMER: The information provided on this website comes without warranty of any kind and is distributed AS IS. Every effort has been made to provide the information as accurate as possible, but no warranty or fitness is implied. The information may be incomplete, may contain errors or may have become out of date. The use of this information described herein is your responsibility, and to use it in your own environments do so at your own risk.

Copyright © 2012 LINUXHOWTO.IN

No comments:

Post a Comment