1 # If you change this file, run 'update-grub' afterwards to update 2 # /boot/grub/grub.cfg. 3 4 GRUB_DEFAULT=saved 5 GRUB_SAVEDEFAULT=true 6 #GRUB_HIDDEN_TIMEOUT=0 7 GRUB_HIDDEN_TIMEOUT_QUIET=true 8 GRUB_TIMEOUT=10 9 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 10 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 11 GRUB_CMDLINE_LINUX="" 12 13 # Uncomment to enable BadRAM filtering, modify to suit your needs 14 # This works with Linux (no patch required) and with any kernel that obtains 15 # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) 16 #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" 17 18 # Uncomment to disable graphical terminal (grub-pc only) 19 #GRUB_TERMINAL=console 20 21 # The resolution used on graphical terminal 22 # note that you can use only modes which your graphic card supports via VBE 23 # you can see them in real GRUB with the command `vbeinfo' 24 #GRUB_GFXMODE=640x480 25 26 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux 27 #GRUB_DISABLE_LINUX_UUID=true 28 29 # Uncomment to disable generation of recovery mode menu entries 30 #GRUB_DISABLE_LINUX_RECOVERY="true" 31 32 # Uncomment to get a beep at grub start 33 #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)
