分页: 1 / 6

[整理]有關設置grub默認進入的操作系統的問題

发表于 : 2005-08-29 16:39
millenniumdark
[整理]有關設置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是不算的。

发表于 : 2005-11-18 0:32
rainy

代码: 全选

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

发表于 : 2005-11-19 12:40
millenniumdark
rainy 写了:

代码: 全选

title      Other operating systems: 
记得刚开始用Linux的时候,这一行害我不浅啊。记得当时看的是Grub的官方文档,结果我把这一行没有计算在内。
是啊。那時我直接看menu.lst裏的註釋,不知道title Other operating systems:算不算,以爲不算,試了一下,還是算的。

发表于 : 2005-11-26 11:44
xyan
menu.lst修改不了,怎么办?好像是说权限不够,我刚开始安装好后改过,后来升级内核,又多了两条启动项,我再想修改,就修改不了了,无法更改保存,后来我查看文件属性,是root权限的,怎么才能修改呢?

我搞不懂,第一次按照上述方法可以修改,第二次修改内核后,怎么就改不了了。

发表于 : 2005-11-26 12:04
millenniumdark
忘了加sudo?
如果不是,將屏幕提示貼出。

发表于 : 2005-11-26 18:23
xyan
不好意思,初学者,忘了sodu

发表于 : 2006-01-07 14:24
LinWHT
xyan 写了:不好意思,初学者,忘了sodu
哈哈,是 sudo 不是 sodu

发表于 : 2006-01-09 23:39
yuanzheng2526
呵呵,幸好不是sohu

发表于 : 2006-01-13 15:45
leecher
谢谢了哈 ~
学习了 ~

发表于 : 2006-01-14 11:18
xinye0123
title Microsoft Windows XP Professional
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

请问这么写是什么意思? 特别是map (hd0)(hd1) map(hd1)(hd0),最好解释下每句的意思,谢谢

发表于 : 2006-02-16 13:53
aprilangela
sudo: gedit: command not found


what's that??

I KNOW

发表于 : 2006-02-16 19:10
millenniumdark
aprilangela 写了:sudo: gedit: command not found


what's that??

I KNOW
Maybe you didn't install gedit, use the below instead:

代码: 全选

sudo nano /boot/grub/menu.lst

发表于 : 2006-03-15 14:13
qsgh
什么意思啊?我怎么看不懂 ?
那里有default啊 !

回复

发表于 : 2006-04-02 19:00
tianyi210
楼主介绍的很好,谢了.
我按照你的讲述修改了默认操作系统即设为windows,我的windows按照你的说法应该把default改为5,因它在第五行吗.可是重起之后没有修改成功.后来我改成了4就万事大吉了.所以我觉得应该是你想把那个系统修改为默认的,就用它所在行减1作为default的值啊.

发表于 : 2006-04-10 9:10
szlychee
记得有一个字符界面分辨率的选项,好像是vga=???什么的。请问1280×1024如何设置?