您的位置:首页 > 其它

Ubuntu 开机引导文件 /etc/default/grub

2012-12-09 20:09 260 查看
# If you change this file, run 'update-grub' afterwards to update

# /boot/grub/grub.cfg.

GRUB_DEFAULT=saved

GRUB_SAVEDEFAULT=true

#GRUB_HIDDEN_TIMEOUT=0

GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_TIMEOUT=10

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs

# This works with Linux (no patch required) and with any kernel that obtains

# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

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

#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start

#GRUB_INIT_TUNE="480 440 1"

对于grub2,ubuntu给了一个官方的配置文件/etc/default/grub。大部分情况下grub2的设置都可以在这个文件中搞定,而且这个文件结构也比较简单,修改起来也容易。完全没有必要直接改/boot/grub/grub.cfg或者/etc/grub.d/下的文件。

修改/etc/default/grub只需简单一个命令:sudo
gedit /etc/default/grub

下面是系统默认的内容,以及最常用的修改菜单显示时间和默认操作系统的方法:

# If you change this file, run 'update-grub' afterwards to update

# /boot/grub/grub.cfg.

GRUB_DEFAULT=0 #将0改为saved,可让grub记住上次启动时选择的系统

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"

修改完成后使用命令:

代码:sudo update-grub

会自动更新/boot/grub/grub.cfg,这样做最大的好处是当系统更新内核时,你的设置不会被覆盖掉。

另外对于从9.10 beta及以前一路升级上来的朋友,如果确定想使用grub2,手动运行:

代码:sudo apt-get install grub2

升级并确保grub2正确配置。(我全新安装的9.10 beta,一路升级上来后,系统中的grub工具居然还是老版,运行这个命令后才正常)

其实Ubuntu官方wiki上对这些都有说明:

https://wiki.ubuntu.com/Grub2

PS: 官方文件只说/boot/grub/grub.cfg不要手工修改,这个文件是运行update-grub自动生成的,/etc/default/grub和/etc/grub.d/ (folder)都很重要。

要修改配置文件的只要打开/boot/grub/grub.cfg文件,找到想修改的地方,然后根据注释找到相应的/etc/default/grub或/etc/grub.d/ (folder)进行修改,很方便滴。

File Structure

/boot/grub/grub.cfg This is in keeping with the intent that the file should not be edited manually.

/etc/default/grub

/etc/grub.d/ (folder)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐