除非我在開機後立即按下 F12,否則 Grub2 EFI 會落入 Grub Shell

除非我在開機後立即按下 F12,否則 Grub2 EFI 會落入 Grub Shell

我在我的華碩 ROG 筆記型電腦上安裝了 Opensuse Tumbleweed 和 Windows 10。
這個問題很奇怪 - 每次我開機或重新啟動時,Grub2 EFI 都會落入 grub2 shell,並且隨機地看不到第二個硬碟。
但是,如果我在開機後或重新啟動期間立即按 F12,則會出現正常的 Grub2 選單,並且我可以毫無問題地啟動到 Opensuse 或 Windows。這很煩人。誰能幫我解決這個問題嗎?
除了新增條目以掛載 Windows 分割區之外,我沒有對設定檔進行任何修改,/etc/fstab但我不認為這是相關的。

/boot/efi/EFI/opensuse/grub.cfg:

search --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
set prefix=(${root})/grub2
configfile $prefix/grub.cfg

/boot/grub2/grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -f ${config_directory}/grubenv ]; then
  load_env -f ${config_directory}/grubenv
elif [ -s $prefix/grubenv ]; then
  load_env
fi

if [ "${env_block}" ] ; then
  load_env -f "${env_block}"
fi

if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   if [ "${env_block}" ] ; then
     save_env -f "${env_block}" next_entry
   fi
   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 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_gpt 
insmod btrfs
set root='hd1,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt3 --hint-efi=hd1,gpt3 --hint-baremetal=ahci1,gpt3  6159e15d-f224-499d-88e0-437b5538f0f1
else
  search --no-floppy --fs-uuid --set=root 6159e15d-f224-499d-88e0-437b5538f0f1
fi
    font="/.snapshots/1/snapshot/usr/share/grub2/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=POSIX
  insmod gettext
fi
terminal_output gfxterm
insmod part_gpt 
insmod ext2
set root='hd1,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
else
  search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
fi
insmod gfxmenu
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans-Bold14.pf2
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans10.pf2
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans12.pf2
loadfont ($root)/grub2/themes/openSUSE/ascii.pf2
insmod png
set theme=($root)/grub2/themes/openSUSE/theme.txt
export theme
if [ x${boot_once} = xtrue ]; then
  set timeout=0
elif [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=10
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/00_tuned ###
set tuned_params=""
### END /etc/grub.d/00_tuned ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'openSUSE Tumbleweed'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-6159e15d-f224-499d-88e0-437b5538f0f1' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt 
    insmod ext2
    set root='hd1,gpt4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
    else
      search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
    fi
    echo    'Loading Linux 4.4.0-1-default ...'
    linux   /vmlinuz-4.4.0-1-default root=UUID=6159e15d-f224-499d-88e0-437b5538f0f1 rootflags=subvol=.snapshots/1/snapshot  quiet splash=silent
    echo    'Loading initial ramdisk ...'
    initrd  /initrd-4.4.0-1-default
}
submenu 'Advanced options for openSUSE Tumbleweed' --hotkey=1 $menuentry_id_option 'gnulinux-advanced-6159e15d-f224-499d-88e0-437b5538f0f1' {
    menuentry 'openSUSE Tumbleweed, with Linux 4.4.0-1-default' --hotkey=2 --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-1-default-advanced-6159e15d-f224-499d-88e0-437b5538f0f1' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt 
        insmod ext2
        set root='hd1,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
        else
          search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
        fi
        echo    'Loading Linux 4.4.0-1-default ...'
        linux   /vmlinuz-4.4.0-1-default root=UUID=6159e15d-f224-499d-88e0-437b5538f0f1 rootflags=subvol=.snapshots/1/snapshot  quiet splash=silent
        echo    'Loading initial ramdisk ...'
        initrd  /initrd-4.4.0-1-default
    }
    menuentry 'openSUSE Tumbleweed, with Linux 4.4.0-1-default (recovery mode)' --hotkey=3 --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-1-default-recovery-6159e15d-f224-499d-88e0-437b5538f0f1' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt 
        insmod ext2
        set root='hd1,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
        else
          search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
        fi
        echo    'Loading Linux 4.4.0-1-default ...'
        linux   /vmlinuz-4.4.0-1-default root=UUID=6159e15d-f224-499d-88e0-437b5538f0f1 rootflags=subvol=.snapshots/1/snapshot  
        echo    'Loading initial ramdisk ...'
        initrd  /initrd-4.4.0-1-default
    }
    menuentry 'openSUSE Tumbleweed, with Linux 4.3.3-5-default'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.3-5-default-advanced-6159e15d-f224-499d-88e0-437b5538f0f1' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt 
        insmod ext2
        set root='hd1,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
        else
          search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
        fi
        echo    'Loading Linux 4.3.3-5-default ...'
        linux   /vmlinuz-4.3.3-5-default root=UUID=6159e15d-f224-499d-88e0-437b5538f0f1 rootflags=subvol=.snapshots/1/snapshot  quiet splash=silent
        echo    'Loading initial ramdisk ...'
        initrd  /initrd-4.3.3-5-default
    }
    menuentry 'openSUSE Tumbleweed, with Linux 4.3.3-5-default (recovery mode)' --hotkey=1 --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.3-5-default-recovery-6159e15d-f224-499d-88e0-437b5538f0f1' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt 
        insmod ext2
        set root='hd1,gpt4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt4 --hint-efi=hd1,gpt4 --hint-baremetal=ahci1,gpt4  884f4184-2900-4123-a4be-60df5a0f0ad0
        else
          search --no-floppy --fs-uuid --set=root 884f4184-2900-4123-a4be-60df5a0f0ad0
        fi
        echo    'Loading Linux 4.3.3-5-default ...'
        linux   /vmlinuz-4.3.3-5-default root=UUID=6159e15d-f224-499d-88e0-437b5538f0f1 rootflags=subvol=.snapshots/1/snapshot  
        echo    'Loading initial ramdisk ...'
        initrd  /initrd-4.3.3-5-default
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-AE4A-03B2' {
    insmod part_gpt 
    insmod fat
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  AE4A-03B2
    else
      search --no-floppy --fs-uuid --set=root AE4A-03B2
    fi
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###

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

### BEGIN /etc/grub.d/80_suse_btrfs_snapshot ###
### END /etc/grub.d/80_suse_btrfs_snapshot ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###

/etc/fstab:

UUID=2743aca8-ab1f-44d8-813d-bbb615ba4188 swap swap defaults 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 / btrfs defaults 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /home btrfs subvol=home 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /opt btrfs subvol=opt 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /srv btrfs subvol=srv 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /tmp btrfs subvol=tmp 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /usr/local btrfs subvol=usr/local 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/crash btrfs subvol=var/crash 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/libvirt/images btrfs subvol=var/lib/libvirt/images 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/mailman btrfs subvol=var/lib/mailman 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/mariadb btrfs subvol=var/lib/mariadb 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/mysql btrfs subvol=var/lib/mysql 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/named btrfs subvol=var/lib/named 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/lib/pgsql btrfs subvol=var/lib/pgsql 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/log btrfs subvol=var/log 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/opt btrfs subvol=var/opt 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/spool btrfs subvol=var/spool 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /var/tmp btrfs subvol=var/tmp 0 0
UUID=6159e15d-f224-499d-88e0-437b5538f0f1 /.snapshots btrfs subvol=.snapshots 0 0
UUID=AE4A-03B2       /boot/efi            vfat       umask=0002,utf8=true  0 0
UUID=884f4184-2900-4123-a4be-60df5a0f0ad0    /boot/    ext2    rw,relatime,stripe=4    0 0
UUID=5644A7CA44A7AAE7 /windows             ntfs-3g    ro,users,gid=users,fmask=133,dmask=022,locale=pl_PL.UTF-8 0 0
UUID=EAAE2A7FAE2A4503 /windows/data-and-programs ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=pl_PL.UTF-8 0 0

編輯:
輸出efibootmgr -v

BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,0001,0002,0004
Boot0000* opensuse-secureboot   HD(1,GPT,5a12695d-97ad-485a-b393-c00a89d1b0d8,0x800,0x32000)/File(\EFI\opensuse\shim.efi)
Boot0001* opensuse  HD(1,GPT,5a12695d-97ad-485a-b393-c00a89d1b0d8,0x800,0x32000)/File(\EFI\opensuse\grubx64.efi)
Boot0002* Windows Boot Manager  HD(1,GPT,5a12695d-97ad-485a-b393-c00a89d1b0d8,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...d................
Boot0004* UEFI OS   HD(1,GPT,5a12695d-97ad-485a-b393-c00a89d1b0d8,0x800,0x32000)/File(\EFI\BOOT\BOOTX64.EFI)

答案1

我認為 grub shell 指的是 grub rescue shell 而不是普通 shell。

原因可能是由於 UEFI 執行 ESP 上(位於「第一個磁碟機」上)上的 grub EFI 二進位檔案時,「第二個磁碟機」尚未準備好,因此二進位檔案無法找到 grub 模組和grub.cfg(如果您沒有/boot 分割區,則位於sdb3 的/boot 目錄中)。

要解決此問題,您可以嘗試停用 UEFI 設定(不是 Windows)中的任何「快速啟動」選項。如果仍然不起作用,您可能需要重新安裝 grub,將模組和 grub.cfg 也放在 ESP 上(--boot-directory /boot/efi,假設 --efi-directory 是 /啟動/efi 也是如此)。或者實際上,您可能想嘗試將 ESP 用於 /boot,並希望當核心嘗試掛載根檔案系統 (sdb3) 時,UEFI 準備好第二個磁碟機。

相關內容