Ubuntu中文论坛 ? 查看主题 - [整理]有關設置grub默認進入的操作系統的問題

来源:百度文库 编辑:神马文学网 时间:2024/05/01 21:49:53
有關設置grub默認進入的操作系統的問題 发表于 : 2005-08-29 16:39 
注册: 2005-07-02 14:41
帖子: 3792 [整理]有關設置grub默認進入的操作系統的問題

[說明]本帖是根据論壇里相應的帖子整理的。

oneleaf 写道: sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup
sudo gedit /boot/grub/menu.lst
修改中间的 default 0


你想默認進入的操作系統位於第幾項(第n個title)(從0開始計算)。就把0改成n。


不明白的看下面的例子

假定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


## ## End Default Options ##


# 下面是第0项
title Ubuntu, kernel 2.6.15-23-386
root (hd0,2)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hda3 ro quiet splash
initrd /boot/initrd.img-2.6.15-23-386
savedefault
boot

# 下面是第1项
title Ubuntu, kernel 2.6.15-23-386 (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.15-23-386 root=/dev/hda3 ro single
initrd /boot/initrd.img-2.6.15-23-386
boot

# 下面是第2项
title Ubuntu, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
boot

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
# 下面是第3项
title Other operating systems:
root

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


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


title Microsoft Windows XP Professional是第4项(从0开始)

假如你想把win xp作為默認的操作系統,那就把default 0改為default 4

注意:

如果没有default 0 就在“## ## End Default Options ##”前自行添加。

以#开头的行是注释,被注释掉的行是给人看的,电脑不会去读的。所以注释掉的行里面的title是不算的。

最后由 millenniumdark 编辑于 2008-05-25 14:38,总共编辑了 6 次

页首       2 楼   文章标题 : 发表于 : 2005-11-18 0:32 
注册: 2005-11-15 20:14
帖子: 101
地址: 湖北 武汉 代码: title      Other operating systems:

记得刚开始用Linux的时候,这一行害我不浅啊。记得当时看的是Grub的官方文档,结果我把这一行没有计算在内。