GRUB2:在单个 EFI 系统上配置多个 Windows 和 Linux 操作系统

GRUB2:在单个 EFI 系统上配置多个 Windows 和 Linux 操作系统

我已经在带有单个 SSD 的笔记本电脑上安装了两个 Windows 11 实例和一个 Ubuntu 23.10 实例。

安装后我的文件系统如下所示

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

nvme0n1            953.9G                                    
├─nvme0n1p1 vfat     100M /boot/efi                          
├─nvme0n1p2           16M                                    
├─nvme0n1p3 ntfs   149.5G                                    
├─nvme0n1p4 ntfs     604M                                    
├─nvme0n1p5 ntfs     200G                                    
├─nvme0n1p6 ntfs   310.7G                                    Shared
└─nvme0n1p7 ext4     293G / 

sudo fdisk -l

Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: SAMSUNG MZVL21T0HCLR-00BL2              
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 245C7941-919B-4473-8B05-92AA2608EB88

Device              Start        End   Sectors   Size Type
/dev/nvme0n1p1       2048     206847    204800   100M EFI System
/dev/nvme0n1p2     206848     239615     32768    16M Microsoft reserved
/dev/nvme0n1p3     239616  313743359 313503744 149.5G Microsoft basic data
/dev/nvme0n1p4  313743360  314980351   1236992   604M Windows recovery environment
/dev/nvme0n1p5  314980352  734410751 419430400   200G Microsoft basic data
/dev/nvme0n1p6  734410752 1386008575 651597824 310.7G Microsoft basic data
/dev/nvme0n1p7 1386008576 2000406527 614397952   293G Linux filesystem

我最终得到了一个包含以下选项的 GRUB2 菜单:

 * Windows Boot Manager
 * Ubuntu 23.10
 * Additional Ubuntu Options
 * . . . . .

如果我想运行 Windows 11 的一个实例,我必须执行以下操作

  1. 首次启动时选择 Windows 启动管理器
  2. 然后选择所需的 Windows 11 实例
  3. 电脑重启
  4. 然后在第二次启动时再次选择 Windows 启动管理器
  5. 所需的 Windows 11 实例已加载

我觉得这很蹩脚,而且我进一步提出了以下问题

问题是否可以重新配置 GRUB,以便能够直接加载 Windows 实例,而无需Windows 启动管理器

附加信息:

bcd 编辑

C:\Windows\System32>bcdedit

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
default                 {default}
resumeobject            {2ac3aa28-69bf-11ee-b9c2-cbeab994cd57}
displayorder            {default}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
-------------------
identifier              {default}
device                  partition=D:
path                    \Windows\system32\winload.efi
description             WINDOWS 11 (1)
locale                  en-us
inherit                 {bootloadersettings}
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=D:
systemroot              \Windows
resumeobject            {2ac3aa28-69bf-11ee-b9c2-cbeab994cd57}
nx                      OptIn
bootmenupolicy          Standard
quietboot               No
usefirmwarepcisettings  No
sos                     No

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.efi
description             WINDOWS 11 (2)
locale                  en-GB
inherit                 {bootloadersettings}
recoverysequence        {2ac3aa26-69bf-11ee-b9c2-cbeab994cd57}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {2ac3aa24-69bf-11ee-b9c2-cbeab994cd57}
nx                      OptIn
bootmenupolicy          Standard

磁盘分区

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    System             100 MB  1024 KB
  Partition 2    Reserved            16 MB   101 MB
  Partition 3    Primary            149 GB   117 MB
  Partition 4    Recovery           604 MB   149 GB
  Partition 5    Primary            200 GB   150 GB
  Partition 6    Primary            310 GB   350 GB
  Partition 7    Unknown            292 GB   660 GB

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D                NTFS   Partition    149 GB  Healthy
  Volume 1     C                NTFS   Partition    200 GB  Healthy    Boot
  Volume 2     E   Shared       NTFS   Partition    310 GB  Healthy
  Volume 3                      FAT32  Partition    100 MB  Healthy    System
  Volume 4                      NTFS   Partition    604 MB  Healthy    Hidden

bcdedit /enum 固件

C:\Windows\System32>bcdedit /enum firmware

Firmware Boot Manager
---------------------
identifier              {fwbootmgr}
displayorder            {839d692b-6ccf-11ee-aba5-7404f1de8473}
                        {bootmgr}
                        {e8d05f83-69b3-11ee-a0d6-c8f52e4e3bd7}
                        {e8d05f84-69b3-11ee-a0d6-c8f52e4e3bd7}
                        {e8d05f85-69b3-11ee-a0d6-c8f52e4e3bd7}
timeout                 0

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
default                 {default}
resumeobject            {2ac3aa28-69bf-11ee-b9c2-cbeab994cd57}
displayorder            {default}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30

Firmware Application (101fffff)
-------------------------------
identifier              {839d692b-6ccf-11ee-aba5-7404f1de8473}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\ubuntu\shimx64.efi
description             ubuntu

Firmware Application (101fffff)
-------------------------------
identifier              {e8d05f83-69b3-11ee-a0d6-c8f52e4e3bd7}
description             EFI USB Device

Firmware Application (101fffff)
-------------------------------
identifier              {e8d05f84-69b3-11ee-a0d6-c8f52e4e3bd7}
description             EFI DVD/CDROM

Firmware Application (101fffff)
-------------------------------
identifier              {e8d05f85-69b3-11ee-a0d6-c8f52e4e3bd7}
description             EFI Network

相关内容