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

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

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

#1

帖子 millenniumdark » 2005-08-29 16:39

[整理]有關設置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 次。
头像
rainy
帖子: 102
注册时间: 2005-11-15 20:14
来自: 湖北 武汉

#2

帖子 rainy » 2005-11-18 0:32

代码: 全选

title      Other operating systems: 
记得刚开始用Linux的时候,这一行害我不浅啊。记得当时看的是Grub的官方文档,结果我把这一行没有计算在内。
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

#3

帖子 millenniumdark » 2005-11-19 12:40

rainy 写了:

代码: 全选

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

#4

帖子 xyan » 2005-11-26 11:44

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

我搞不懂,第一次按照上述方法可以修改,第二次修改内核后,怎么就改不了了。
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

#5

帖子 millenniumdark » 2005-11-26 12:04

忘了加sudo?
如果不是,將屏幕提示貼出。
xyan
帖子: 34
注册时间: 2005-11-18 21:56

#6

帖子 xyan » 2005-11-26 18:23

不好意思,初学者,忘了sodu
LinWHT
帖子: 5
注册时间: 2006-01-06 9:41

#7

帖子 LinWHT » 2006-01-07 14:24

xyan 写了:不好意思,初学者,忘了sodu
哈哈,是 sudo 不是 sodu
头像
yuanzheng2526
帖子: 73
注册时间: 2005-10-11 23:14

#8

帖子 yuanzheng2526 » 2006-01-09 23:39

呵呵,幸好不是sohu
卖裤子支持开源,卖身支持linux
leecher
帖子: 14
注册时间: 2005-12-23 11:59

#9

帖子 leecher » 2006-01-13 15:45

谢谢了哈 ~
学习了 ~
xinye0123
帖子: 61
注册时间: 2006-01-10 13:36

#10

帖子 xinye0123 » 2006-01-14 11:18

title Microsoft Windows XP Professional
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

请问这么写是什么意思? 特别是map (hd0)(hd1) map(hd1)(hd0),最好解释下每句的意思,谢谢
头像
aprilangela
帖子: 59
注册时间: 2006-02-13 12:18

#11

帖子 aprilangela » 2006-02-16 13:53

sudo: gedit: command not found


what's that??

I KNOW
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

#12

帖子 millenniumdark » 2006-02-16 19:10

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
头像
qsgh
帖子: 18
注册时间: 2006-03-13 9:04

#13

帖子 qsgh » 2006-03-15 14:13

什么意思啊?我怎么看不懂 ?
那里有default啊 !
头像
tianyi210
帖子: 32
注册时间: 2006-03-30 7:30

回复

#14

帖子 tianyi210 » 2006-04-02 19:00

楼主介绍的很好,谢了.
我按照你的讲述修改了默认操作系统即设为windows,我的windows按照你的说法应该把default改为5,因它在第五行吗.可是重起之后没有修改成功.后来我改成了4就万事大吉了.所以我觉得应该是你想把那个系统修改为默认的,就用它所在行减1作为default的值啊.
头像
szlychee
帖子: 60
注册时间: 2006-03-15 22:34

#15

帖子 szlychee » 2006-04-10 9:10

记得有一个字符界面分辨率的选项,好像是vga=???什么的。请问1280×1024如何设置?
回复