Set Windows As Default In Grub


Recommended Posts

Well! I finally got Debian up and running. I've been roaming around a bit, checking things out. I'm not sure yet if I like this or Ubuntu better, but its most definately too early (especially for a beginner like myself) to make that decision...

Anyway... the first thing I'd like to do is edit grub so that Windows is the default OS and Windows would be the one loaded after 10 seconds if no choice is selected. The reason is this is a familty computer, and I will be the only one booting into linux. Wanna make it easier for everyone else. I've done this before, but I couldn't find a post about it. I remember editing some file, lol but have know idea where it is or how to do it.

Thanks all!

Matt

Link to post
Share on other sites

I think the file that you have to edit is the grub.lst file

Once you open it, you should be able to figure out where to

cut and paste so that Windows is the first loaded.

Link to post
Share on other sites

First off you may or may not have to mount your /boot partition. to see if it is mounted already type this command into your terminal

shane@mainbox ~ $ mount
/dev/hda1 on / type ext3 (rw,noatime)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
udev on /dev type tmpfs (rw,nosuid)
devpts on /dev/pts type devpts (rw)
/dev/hdb4 on /mnt/media type ext3 (rw,noatime)
shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)
usbfs on /proc/bus/usb type usbfs (rw)
nfsd on /proc/fs/nfs type nfsd (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hda2 on /boot type ext2 (rw,noatime)

see the very last line in the output, that shows that the /boot partition is mounted. If you do not have a line that contains "/boot" you will need to mount it. You can do that with the mount command

mount /boot

now you can use any text editer to edit the file. I like nano myself

nano -w /boot/grub/menu.lst

the above code will use the program nano(text editer like notepad) to open the file so you can edit it. You may not have nano installed. I am not sure what editers come witha defualt install of debian.

Edited by shanenin
Link to post
Share on other sites

I kind of gave you bad advice. I assumbed that you had /boot on a seperate partition(not all distros do that). The reason it told you /boot was not in /etc/fstab is because you do not have a seperate /boot partition. So you can ignore most of my advice and just edit the file

/boot/grub/menu.lst

Edited by shanenin
Link to post
Share on other sites

Will do. Would like some guidance though. I know I have to change the number next to defaul from 0, but what do I change it to? 4?

And since it opens in the terminal, will it save just by me exiting?

Thanks

Matt

Link to post
Share on other sites
I know I have to change the number next to defaul from 0, but what do I change it to? 4?

I guess it would kind of depend, I could tell you exactly if I could see your current configuration of your file. The cat command it good for this

cat /boot/grub/menu.lst

And since it opens in the terminal, will it save just by me exiting?

That depends on which editor you are using. if you are using nano, <ctrl>x will save your file

Link to post
Share on other sites

ok, here's the cat command output:

matt@cpe-24-210-251-48:~$ cat /boot/grub/menu.lst
# 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'.
default 0

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

# 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 specifiv 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=root=/dev/hdb2 ro

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

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

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery mode) 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

## ## End Default Options ##

title Debian GNU/Linux, kernel 2.4.27-2-386
root (hd1,1)
kernel /boot/vmlinuz-2.4.27-2-386 root=/dev/hdb2 ro
initrd /boot/initrd.img-2.4.27-2-386
savedefault
boot

title Debian GNU/Linux, kernel 2.4.27-2-386 (recovery mode)
root (hd1,1)
kernel /boot/vmlinuz-2.4.27-2-386 root=/dev/hdb2 ro single
initrd /boot/initrd.img-2.4.27-2-386
savedefault
boot

### 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/hda2
title Microsoft Windows XP Home Edition
root (hd0,1)
savedefault
makeactive
chainloader +1

BTW, when i just type

/boot/grub/menu.lst

It says permission denied (in root and non root)

Link to post
Share on other sites

Since windows is the forth one down in the list, you would change the default to 3 (start counting with zero 0,1,2,3)

if you just type

/boot/grub/menu.lst

the above command is trying to execute the file menu.lst. Since it is not an executable file it is telling you permission denied.

you will need to open the file with an editor like this

nano -w /boot/grub/menu.lst

Edited by shanenin
Link to post
Share on other sites

your welcome :-)

edit added later//

here is my menu.lst. If you removed most of your comments, yours would look neater. That is hardly nessesary

shane@mainbox ~ $ cat /boot/grub/menu.lst
default 0
timeout 5

title=gentoo
root (hd0,1)
kernel (hd0,1)/bzImage root=/dev/hda1

title=gentoo-old
root (hd0,1)
kernel (hd0,1)/bzImage.gentoo_old root=/dev/hda5

title=ubuntu
root (hd0,5)
kernel (hd0,5)/boot/vmlinuz-2.6.15-21-386 root=/dev/hda6
initrd (hd0,5)/boot/initrd.img-2.6.15-21-386

Edited by shanenin
Link to post
Share on other sites
Well! I finally got Debian up and running. I've been roaming around a bit, checking things out. I'm not sure yet if I like this or Ubuntu better, but its most definately too early (especially for a beginner like myself) to make that decision...

Very cool, congratulations, Matt! :thumbsup:

I ran Debian for a month or so and liked it a lot. I've gone back to running Ubuntu on one of my Linux boxes ( I'm running Slackware on my other boxes). I found that Debian lacked a bit in hardware support ( for me anyway). With Ubuntu I get great debian package management and excellent hardware support.

Debian is an exceptional distro! :D

The penguin rules!!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...