如何在 Linux Mint 20 cinamon 上刪除啟動終端“GNU GRUB 2.02 版”?
我在一個乾淨的驅動器上安裝了 Linux Mint 20,但我一直在啟動這個終端。
GNU GRUB version 2.02 Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions. grub> _
我是 Linux 新手,不知道它的用途,但我之前從未在 Mint 19 上見過它。我可以用“exit”命令跳過它,但我想完全避免它。我發現很多關於這個主題的討論,但他們都在談論雙啟動問題,這不適用於我的情況。
我嘗試通過以下方式編輯此 grub 配置文件:
xed admin:///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.0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=0.0 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_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1"
一條評論提到了“/boot/grub/grub.cfg”,所以這裡是:
# # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then set have_grubenv=true load_env fi if [ "${initrdfail}" = 2 ]; then set initrdfail= elif [ "${initrdfail}" = 1 ]; then set next_entry="${prev_entry}" set prev_entry= save_env prev_entry if [ "${next_entry}" ]; then set initrdfail=2 fi fi if [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=true else set default="0" fi if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi export menuentry_id_option if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function initrdfail { if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then if [ -z "${initrdfail}" ]; then set initrdfail=1 if [ -n "${boot_once}" ]; then set prev_entry="${default}" save_env prev_entry fi fi save_env initrdfail fi; fi } function recordfail { set recordfail=1 if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi } function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then font=unicode else insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi font="/usr/share/grub/unicode.pf2" fi if loadfont $font ; then set gfxmode=auto load_video insmod gfxterm set locale_dir=$prefix/locale set lang=en_US insmod gettext fi terminal_output gfxterm if [ "${recordfail}" = 1 ] ; then set timeout=30 else if [ x$feature_timeout_style = xy ] ; then set timeout_style=hidden set timeout=0 # Fallback hidden-timeout code in case the timeout_style feature is # unavailable. elif sleep --interruptible 0 ; then set timeout=0 fi 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/light-gray ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ### function gfxmode { set gfxpayload="${1}" if [ "${1}" = "keep" ]; then set vt_handoff=vt.handoff=7 else set vt_handoff= fi } if [ "${recordfail}" != 1 ]; then if [ -e ${prefix}/gfxblacklist.txt ]; then if hwmatch ${prefix}/gfxblacklist.txt 3; then if [ ${match} = 0 ]; then set linux_gfx_mode=keep else set linux_gfx_mode=text fi else set linux_gfx_mode=text fi else set linux_gfx_mode=keep fi else set linux_gfx_mode=text fi export linux_gfx_mode menuentry 'Linux Mint 20 Cinnamon' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9352d93a-2417-49fe-8ed3-02e348bc18ec' { recordfail load_video gfxmode $linux_gfx_mode insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi linux /boot/vmlinuz-5.4.0-42-generic root=UUID=9352d93a-2417-49fe-8ed3-02e348bc18ec ro quiet splash initrd /boot/initrd.img-5.4.0-42-generic } submenu 'Advanced options for Linux Mint 20 Cinnamon' $menuentry_id_option 'gnulinux-advanced-9352d93a-2417-49fe-8ed3-02e348bc18ec' { menuentry 'Linux Mint 20 Cinnamon, with Linux 5.4.0-42-generic' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-42-generic-advanced-9352d93a-2417-49fe-8ed3-02e348bc18ec' { recordfail load_video gfxmode $linux_gfx_mode insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi echo 'Loading Linux 5.4.0-42-generic ...' linux /boot/vmlinuz-5.4.0-42-generic root=UUID=9352d93a-2417-49fe-8ed3-02e348bc18ec ro quiet splash echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-5.4.0-42-generic } menuentry 'Linux Mint 20 Cinnamon, with Linux 5.4.0-42-generic (recovery mode)' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-42-generic-recovery-9352d93a-2417-49fe-8ed3-02e348bc18ec' { recordfail load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi echo 'Loading Linux 5.4.0-42-generic ...' linux /boot/vmlinuz-5.4.0-42-generic root=UUID=9352d93a-2417-49fe-8ed3-02e348bc18ec ro recovery nomodeset echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-5.4.0-42-generic } menuentry 'Linux Mint 20 Cinnamon, with Linux 5.4.0-26-generic' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-26-generic-advanced-9352d93a-2417-49fe-8ed3-02e348bc18ec' { recordfail load_video gfxmode $linux_gfx_mode insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi echo 'Loading Linux 5.4.0-26-generic ...' linux /boot/vmlinuz-5.4.0-26-generic root=UUID=9352d93a-2417-49fe-8ed3-02e348bc18ec ro quiet splash echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-5.4.0-26-generic } menuentry 'Linux Mint 20 Cinnamon, with Linux 5.4.0-26-generic (recovery mode)' --class linuxmint --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-26-generic-recovery-9352d93a-2417-49fe-8ed3-02e348bc18ec' { recordfail load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos5' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 9352d93a-2417-49fe-8ed3-02e348bc18ec else search --no-floppy --fs-uuid --set=root 9352d93a-2417-49fe-8ed3-02e348bc18ec fi echo 'Loading Linux 5.4.0-26-generic ...' linux /boot/vmlinuz-5.4.0-26-generic root=UUID=9352d93a-2417-49fe-8ed3-02e348bc18ec ro recovery nomodeset echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-5.4.0-26-generic } } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/10_linux_zfs ### ### END /etc/grub.d/10_linux_zfs ### ### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/30_uefi-firmware ### ### END /etc/grub.d/30_uefi-firmware ### ### 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 ### ### BEGIN /etc/grub.d/41_custom ### if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
“lsblk”命令:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 232,9G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 232,4G 0 part /
======================================
UEFI 菜單有 4 個選項:Ubuntu、Ubuntu、SSD 和某種設置。第一個 Ubuntu 選項以正常方式啟動我的作業系統,首先顯示這個 GRUB 菜單,然後我輸入“退出”,然後載入 Mint。第二個 Ubuntu,給我 2 個 GRUB 菜單,一個接一個,然後載入 Mint。選擇 SSD 將繞過這些 GRUB 菜單(根本不會顯示它們),這是我想要的結果。
解決方案:在 BIOS 中,我只是將 SSD 作為第一個啟動選項,而 GRUB 控制台不再存在!
由於您最近安裝了新版本的作業系統,因此您看到的“控制台”可能是過時的 GRUB 安裝,目前引導的系統不維護它。您需要調整系統的引導順序設置以避免過時的 GRUB 實例,然後可能將其從系統中刪除。
嘗試執行
sudo efibootmgr -v
並將輸出複制並編輯到您的原始問題中。如果您的系統以 UEFI 樣式啟動,您可能會遇到與安全啟動相關的小問題:安裝腳本可能最初為 GRUB 創建了一個“普通”啟動條目,而沒有 Secure Boot shim 引導載入程序,以及另一個帶有 Secure Boot 的啟動選項
shimx64.efi
引導載入程序。如果安全啟動生效,“普通”GRUB 將無法載入任何可執行程式碼,因為 GRUB 模組不會使用安全啟動辨識的 Windows PE 可執行格式。結果,它會進入 GRUB shell 提示符。退出“普通”GRUB 後,另一個引導條目會通過
shimx64.efi
引導載入程序啟動 GRUB,這允許 GRUB 在存在安全引導的情況下工作。如果這是您遇到的問題,您只需要辨識使用 的引導條目並將其設為
shimx64.efi
韌體引導順序中的第一個。該efibootmgr
命令可以做到這一點。甚至可能是以前安裝的 Mint 19 中的舊引導條目仍然存在並導致混亂。
在
sudo efibootmgr -v
輸出中,第一行應該是BootCurrent: XXXX
一個XXXX
四位十六進制數。它標識引導目前執行的作業系統的引導條目。如果它的編號目前不是BootOrder:
輸出行的第一個,則需要修復它。所以,如果
sudo efibootmgr -v
輸出看起來像這樣:BootCurrent: XXXX Timeout: 1 seconds BootOrder: YYYY, XXXX, ZZZZ, <...possibly other numbers...> BootXXXX* Mint 20 <....> File(\EFI\Mint\SHIMX64.EFI) <other boot entries...>
這裡
BootXXXX
目前不是 中的第一個BootOrder
,因此您需要將其設為第一個,如下所示:sudo efibootmgr -o XXXX,YYYY,ZZZZ,<any other Boot numbers listed in the original BootOrder line...>
請注意,雖然原始
BootOrder:
行在逗號後有空格,但在指定命令的引導編號時不應使用空格sudo efibootmgr -o ...
。