新的GRUB配置文件已经不是原来的/boot/grub/menu.lst,而是改为/boot/grub/grub.cfg ,并且是自动生成的,想要更改这个配置文件,方法就是根据需要编辑/etc/default/grub文件。
举例:
我打算将windows更改为默认启动系统,并且将等待时间从默认的10秒更改为5秒
打开你的/etc/default/grub文件,如下
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=4 #在此处更改默认启动项,编号规则和原来一样,从0开始编号。
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5 #在此处更改等待时间
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"
大家注意看这个配置文件的说明
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
就是说配置好后运行update-grub命令,就会自动重新生成/boot/grub/grub.cfg文件。
just easy!!
GRUB 2 配置更改浅析
-
- 帖子: 74
- 注册时间: 2009-04-23 9:50
- 系统: ubuntu
- 来自: CN
- 联系:
-
- 帖子: 6
- 注册时间: 2009-10-30 22:45
Re: GRUB 2 配置更改浅析
安装完Ubuntu 后启动时可是看到六个选项 头四个都是Ubuntu 的(可以正常启动),后两个是Vista 的(其中第一个是进入系统,第二个是笔记本自带的还原系统)
现在问题是这样的, 可以进还原系统,可是不能进入Vista ,选了之后又回到 原地了!
细节:我在即将完成Ubuntu的安装是 ,有个选项是让选什么启动器的,我选了 VISTA 什么的
我是新手望各位帮忙亚
感激不尽
现在问题是这样的, 可以进还原系统,可是不能进入Vista ,选了之后又回到 原地了!
细节:我在即将完成Ubuntu的安装是 ,有个选项是让选什么启动器的,我选了 VISTA 什么的
我是新手望各位帮忙亚
感激不尽
- leeaman
- 帖子: 30702
- 注册时间: 2007-02-02 18:14
- 系统: debian sid
Re: GRUB 2 配置更改浅析
我一直想找的东西,谢谢,/boot/grub/grub.cfg,不但是只读 每次自己更新有要重新改过,麻烦,顶lz
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
- netstat
- 帖子: 104
- 注册时间: 2009-09-11 13:10
- 联系:
Re: GRUB 2 配置更改浅析
最直接的办法是先备份,sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.backup
再就是sudo chmod +w /boot/grub/grub.cfg
最后就是sudo gedit /boot/grub/grub.cfg
参考一下我的吧
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Windows Vista (loader) (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 40be882dbe881e12
chainloader +1
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=c6d19f67-817c-4101-beed-7fa11daa770e ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=c6d19f67-817c-4101-beed-7fa11daa770e ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sda3)" {
insmod ntfs
set root=(hd0,3)
search --no-floppy --fs-uuid --set 7e209a212099e087
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
再就是sudo chmod +w /boot/grub/grub.cfg
最后就是sudo gedit /boot/grub/grub.cfg
参考一下我的吧
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry "Windows Vista (loader) (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 40be882dbe881e12
chainloader +1
}
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=c6d19f67-817c-4101-beed-7fa11daa770e ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set c6d19f67-817c-4101-beed-7fa11daa770e
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=c6d19f67-817c-4101-beed-7fa11daa770e ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sda3)" {
insmod ntfs
set root=(hd0,3)
search --no-floppy --fs-uuid --set 7e209a212099e087
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
华科一小生
- myewmyew
- 帖子: 590
- 注册时间: 2008-09-06 23:40
- 来自: 天朝
- 联系:
- ubuntu1023
- 帖子: 1791
- 注册时间: 2010-06-04 1:06