windows as first boot option

Asked by FredLC

Hello there, Ubuntu crew.

Here's the thing: while ubuntu is quite a nice product and I'm enjoying it very much, it will be for me, at least for a while, my second system option, primarily for running safer bank transactions, and a few fooling around with the great software library and free options. Maybe i'll turn it in my default when I'm familiar enough.

(besides, to be perfectly honest, i'm a gamer, and the games are primarily designed for windows, so...)

Anyway; as that is my preferred choice, i'd like to know if there is any way which I can set the startup so that windows is run as primary option, and that it will take my interference in order to run ubuntu. as i know nothing of linux Command lines yet, i don't even know if this feature is avaiable, let alone where to look for it.

Are there any guidance you people can give me on this matter?

Best Regards,

FredLC.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Michael Bienia
Solved:
Last query:
Last reply:
Revision history for this message
Jim Hutchinson (jphutch) said :
#1

Yes, you can do this. You will need to edit the /boot/grub/menu.lst file. Open a terminal and type

sudo gedit /boot/grub/menu.lst

Scroll down a bit and you will see a section that starts like this or similar...

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

You can change that number to coincide with the line for windows. I think you count each boot option so a normal install has 3 options for ubuntu (regular, recovery and the memtest) so I think if you set that to 4 it will boot windows. I'm not positive so you might need to do a little trial and error. If a new kernel update is released it will add a new line to your grub menu so this number would need to be changed. It doesn't happen a lot but it does happen so just be aware of that.

A second possibility would be to move the menu entry for windows to the top. However, I've never tried that and I think you would still have to re-edit if a new kernel was added. If you wan to try that, look for the section that start like this...

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-16-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=c57c46cc-e83c-4c52-bb67-1708fe6ee838 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault

The first menu entry after the "end default options" section is the one that will boot first. Find the menu entry for windows (all of it) and cut and past it in front of the ubuntu one. Again, I've never actually tried that but it should work.

Revision history for this message
FredLC (fred-lc) said :
#2

maybe I'm dense, but I didn't really identify the number of the windows section; and my boot options are more than that since I updated ubuntu.

look, I'll post the entire section. Can you please shows me what changes need I make?

-------------------------------------

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=589e7cd6-dbf8-4b17-92e7-75a0aea90a83 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,3)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash locale=pt_BR

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-16-generic
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=589e7cd6-dbf8-4b17-92e7-75a0aea90a83 ro quiet splash locale=pt_BR
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=589e7cd6-dbf8-4b17-92e7-75a0aea90a83 ro single
initrd /boot/initrd.img-2.6.20-16-generic

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=589e7cd6-dbf8-4b17-92e7-75a0aea90a83 ro quiet splash locale=pt_BR
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=589e7cd6-dbf8-4b17-92e7-75a0aea90a83 ro single
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+
root (hd0,3)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

-------------------------------------

Best Regards,

FredLC

Revision history for this message
FredLC (fred-lc) said :
#3

Hmmm....

could it be that in the part...

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

... I need only to change "default 0" to "default 5"?

Revision history for this message
Cesare Tirabassi (norsetto) said :
#4

I think 6 would do.

Revision history for this message
Thomas Beckett (thomas-beckett) said :
#5

Changing the default 0 to default 5 will work but if there is an update that adds a new version of the kernel then it will need to be changed again to 6.

Alternatively:

In your menu.lst remove the "savedefault" lines from the ubuntu entries and keep it on the windows entry. Then at line 14 it says:
"default 0"

change this to

"default saved"

once you reboot grub should then select the windows entry as default.

Apologies if this does not work, I haven't dual booted for years.

Revision history for this message
FredLC (fred-lc) said :
#6

Ok, Thomas, an option that do not need constant updating will evidently be better.

As so, a few questions:

- can you confirme that procedure you gave?
- if it does not work, will the boot be halted, or will simply a wrong boot run?
- if I eventually update Ubuntu to new versions (and I know linux updates are much faster than windows) will these options remain?

I think I'll wait an answer on these before I make the changes...

Regards,

FredLC

Revision history for this message
Best Michael Bienia (geser) said :
#7

The automatic generation of menu.lst on kernel updates alters only the part between
### BEGIN AUTOMAGIC KERNELS LIST
and
### END DEBIAN AUTOMAGIC KERNELS LIST

You can move the Windows option
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1

*before* ### BEGIN AUTOMAGIC KERNELS LIST
The best place would be between the examples and that line.
And keep "default 0" as your Windows will be the first entry then.

I don't know what happens if you break the menu.lst but I assume either grub will show no select options or broken select options (depends on how you break that file). grub will still load but you will end in the grub shell where you can specify where grub will find its files, where the kernel is, etc. (that's what the menu.lst file contains). grub will wait on your input for how to proceed.
Please read some documentation how you still can boot your system just for the case such a mistake happens.

Revision history for this message
FredLC (fred-lc) said :
#8

Thanks Michael Bienia, that solved my question.