
我使用 Gentoo Linux 作為我唯一的作業系統,所以我想顯示隱藏在我的頂層「Gentoo Linux 的高級選項」條目中的 Gentoo 引導選項(即,GRUB 啟動的位置,較低級別的菜單將是我在「Gentoo Linux 的進階選項」選項上選擇並按下Enter 鍵時顯示的選單)GRUB 選單,這可能嗎?我知道我可以手動編輯/boot/grub/grub.cfg
來完成此操作,但我想要一個更永久的解決方案,這樣我就不必在重新運行/boot/grub/grub.cfg
時繼續手動編輯我的文件。grub-mkconfig -o /boot/grub/grub.cfg
因為我希望能夠在 GRUB 啟動後立即選擇備用內核,而不必在「Gentoo Linux 的高級選項」選單中找到該選項。要先明確的是,我使用的是 GRUB2,而不是 GRUB Legacy。
答案1
我不習慣 Gentoo(只有 Ubuntu)。但是/etc/grub.d/10_linux
配置已經完成,使用定義的變數/etc/default/grub
(Gentoo 中的路徑可能不同)。請參閱man grub-mkconfig
或 info -f grub -n 'Simple configuration'
。後者說:
The file '/etc/default/grub' controls the operation of
'grub-mkconfig'. It is sourced by a shell script, and so must be valid
POSIX shell input; normally, it will just be a sequence of 'KEY=value'
lines...
'GRUB_DISABLE_SUBMENU'
Normally, 'grub-mkconfig' will generate top level menu entry for
the kernel with highest version number and put all other found
kernels or alternative menu entries for recovery mode in submenu.
For entries returned by 'os-prober' first entry will be put on top
level and all others in submenu. If this option is set to 'y',
flat menu with all entries on top level will be generated instead.
Changing this option will require changing existing values of
'GRUB_DEFAULT', 'fallback' (*note fallback::) and 'default' (*note
default::) environment variables as well as saved default entry
using 'grub-set-default' and value used with 'grub-reboot'.
因此,請尋找/etc/default/grub
(或無論它在哪裡)並設置GRUB_DISABLE_SUBMENU=y
。然後重新運行grub-mkconfig
。