伺服器 16.04 - 預設 Grub 引導選項失敗

伺服器 16.04 - 預設 Grub 引導選項失敗

我可以透過進入進階選項並選擇第一個選項來啟動伺服器。

我的問題是如何自動化此操作?從長遠來看,要求有人在啟動過程中在控制台旁選擇正確的選項是行不通的。

我嘗試閱讀 grub 手冊並查看啟動文件,但天哪,這真是一場噩夢!我只需要調整這個設定...舊的方法很簡單,只需選擇您想要的預設值並完成即可。

這是以下的副本/etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
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_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

答案1

對於不熟悉編輯的人來說最簡單的方法/etc/default/grub是使用名為Grub 定制器

在「常規設定」標籤下,您將看到預設條目。只需選擇您希望其預設的條目即可。您也可以將其設定為顯示/隱藏選單並更改延遲時間。我仍然喜歡保留菜單並有大約 3 秒鐘的短暫等待時間,以防萬一我需要在啟動過程中輕鬆訪問它。

如果您想手動設定並編輯文件,/etc/default/grub您需要更改GRUB_DEFAULT=0GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-21-generic"或任何您想要的內核的正確行..注意高級選項行..那是因為內核位於子選單中。

完成並儲存更改後,您需要sudo update-grub從終端運行以更新更改,否則下次啟動時它將被覆蓋

相關內容