![除非我在开机后立即按下 F12,否则 Grub2 EFI 会变成 Grub Shell](https://linux22.com/image/1482080/%E9%99%A4%E9%9D%9E%E6%88%91%E5%9C%A8%E5%BC%80%E2%80%8B%E2%80%8B%E6%9C%BA%E5%90%8E%E7%AB%8B%E5%8D%B3%E6%8C%89%E4%B8%8B%20F12%EF%BC%8C%E5%90%A6%E5%88%99%20Grub2%20EFI%20%E4%BC%9A%E5%8F%98%E6%88%90%20Grub%20Shell.png)
我的华硕 ROG 笔记本电脑上同时安装了 Opensuse Tumbleweed 和 Windows 10。
问题很奇怪 - 每次开机或重启时,Grub2 EFI 都会进入 grub2 shell,并且随机看不到第二个硬盘。
但如果我在开机后或重启期间立即按 F12,则会出现正常的 Grub2 菜单,我可以毫无问题地启动 Opensuse 或 Windows。这很烦人。有人能帮我解决这个问题吗?
我没有对配置文件进行任何修改,除了添加条目/etc/fstab
以挂载 Windows 分区,但我认为这与此无关。
/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,而不是普通 shell。
原因可能是由于当 ESP(位于“第一个驱动器”上)上的 grub EFI 二进制文件由 UEFI 执行时“第二个驱动器”尚未准备好,因此二进制文件无法找到 grub 模块和 grub.cfg(如果您没有 /boot 的分区,则位于 sdb3 的 /boot 目录中)。
要解决此问题,您可以尝试在 UEFI 设置(不是 Windows)中禁用任何“快速启动”选项。如果仍然不起作用,您可能必须重新安装 grub,以便将模块和 grub.cfg 也放在 ESP 上(--boot-directory /boot/efi,假设 --efi-directory 也是 /boot/efi)。或者实际上,您可能想尝试将 ESP 用于 /boot,并希望当内核尝试挂载根文件系统 (sdb3) 时,UEFI 已准备好第二个驱动器。