红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Ubuntu

修改Ubuntu启动菜单使windows XP/Vista/win 7变为默认启动系统

发布时间:2010-01-07 13:13:41来源:红联作者:sclzwj
很多朋友在电脑上装了Windows和ubuntu双系统,电脑是一个人用的还好;假如是公用的,其他用户在启动时看到多系统启动界面会不知所措,对于自己而言,这样的启动也会给自己浪费很多时间。所以,将默认启动的系统改为Windows是很有必要的。

在ubuntu系统中打开终端,输入:sudo gedit/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'.
# 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=2d1136cb-416a-4329-8c6d-703537a2d578 ro

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

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

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

## 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,7)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=2d1136cb-416a-4329-8c6d-703537a2d578 ro quiet splash locale=zh_CN
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault 0

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,7)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=2d1136cb-416a-4329-8c6d-703537a2d578 ro single
initrd /boot/initrd.img-2.6.20-16-generic 1

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

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

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

在上面的内容中原本的default值为0,意即启动排行第一的操作系统,这里代表的就是title Ubuntu, kernel 2.6.20-16-generic。

现在对其进行修改,将其值改到与Windows 相对应,Windows 对应的索引号为4,那么就将default后的值改为4,以后启动的默认系统即为Windows了。

另外,启动界面的等待时间也可通过修改timeout后面的值进行修改。
文章评论

共有 7 条评论

  1. chiyb 于 2010-04-26 03:05:51发表:

    引用:

    对这是9.10以前的修改方式
    ubuntu 9.10,启动菜单配置文本 /boot/grub/menu.lst 不见了。取而代之的是/boot/grub/grub.cfg,grub2不再使用menu.lst。
    9.10的修改方法点击这里:http://www.linuxdiyf.com/bbs/thr ...
    sclzwj 发表于 2010-1-7 14:36

  2. langowong 于 2010-01-13 22:33:47发表:

    不把引导器安装在MBR就不用那么麻烦了

  3. scott9 于 2010-01-11 14:47:59发表:

    从来不这么干,我一直都是直接装一个linux,不混装。

  4. sclzwj 于 2010-01-07 14:36:06发表:

    引用:
    你不是告诉我说是修改sudo gedit/boot/grub/grub.cgf 吗?
    tfh120 发表于 2010-1-7 14:24

    对这是9.10以前的修改方式
    ubuntu 9.10,启动菜单配置文本 /boot/grub/menu.lst 不见了。取而代之的是/boot/grub/grub.cfg,grub2不再使用menu.lst。
    9.10的修改方法点击这里:http://www.linuxdiyf.com/bbs/thread-171693-1-1.html

  5. tfh120 于 2010-01-07 14:24:22发表:

    嘿嘿!顶啊!只是最后的文件不同,其他都相同哦!

  6. tfh120 于 2010-01-07 14:24:03发表:

    你不是告诉我说是修改sudo gedit/boot/grub/grub.cgf 吗?

  7. sclzwj 于 2010-01-07 13:20:18发表:

    自己坐沙发,哈哈。