无法与 Windows 11 双启动

无法与 Windows 11 双启动

昨天,我第一次在安装 Windows 的同一磁盘上创建分区,安装了 Linux。一切正常,但重启后 Windows 不在列表中,所以我做了一些我在 ask Ubuntu 上找到的操作。

  • 我安装了 OS-prober,并在 /etc/default/grub 中将 GRUB_DISABLE_OS_PROBER 设置为 false。然后运行 ​​update-grub,但没有成功。

  • 我接下来要做的事情是创建一个菜单项。Mi 40_custom 文件如下所示:

#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set 2AF7-AD85 (my /boot-efi uuid)
        chainloader /efi/Microsoft/Boot/bootmgfw.efi
}
  • 这在启动时添加了 Windows 10 条目,但遗憾的是,在选择它时我出现了错误无效签名。

我不知道该怎么办。我还尝试了 Boot-Repair 工具,其日志如下关联

============================== Boot Info Summary ===============================

 => Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 
    404376632 of the same hard drive for core.img. core.img is at this 
    location and looks for (,gpt6)/boot/grub. It also embeds following 
    components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_gpt biosdisk
    ---------------------------------------------------------------------------

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda2: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  Windows 8/10/11/2012: FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/Boot/bootx64.efi /efi/Boot/fbx64.efi 
                       /efi/Boot/mmx64.efi /efi/Microsoft/bootmgfw.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg 
                       /efi/Microsoft/Boot/bootmgfw.efi 
                       /efi/Microsoft/Boot/bootmgr.efi

sda3: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 

sda4: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda5: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda6: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 22.04 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img


================================ 2 OS detected =================================

OS#1:   El sistema operativo que se está usando - Ubuntu 22.04 LTS CurrentSession on sda6
OS#2:   Windows 7 on sda4

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video: CoffeeLake-S GT1 [UHD Graphics 610] from Intel Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.15.0-41-generic root=UUID=4abe2367-f313-4759-8ecb-1c9d2b1bf155 ro quiet splash vt.handoff=7
df -Th / : /dev/sda6      ext4    67G    15G   49G  24% /

===================================== UEFI =====================================

BIOS/UEFI firmware: 1.40(5.12) from American Megatrends Inc.
The firmware is EFI-compatible, but this installed-session is in Legacy/BIOS/CSM mode (not in EFI mode).



============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda : is-GPT,   no-BIOSboot,    has---ESP,  not-usb,    not-mmc, has-os,    has-win,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda6    : is-os,    64, apt-get,    signed grub-pc grub-efi ,   grub2,  grub-install,   grubenv-ok, update-grub,    farbios
sda4    : is-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda2    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far
sda5    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda1    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far

Partitions info (2/3): _________________________________________________________

sda6    : isnotESP, fstab-has-goodEFI,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda4    : isnotESP, part-has-no-fstab,  no-nt,  haswinload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda2    : is---ESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda5    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, recovery-or-hidden, no-bmgr,    notwinboot
sda1    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, recovery-or-hidden, no-bmgr,    notwinboot

Partitions info (3/3): _________________________________________________________

sda6    : not--sepboot, with-boot,  fstab-without-boot, not-sep-usr,    with--usr,  fstab-without-usr,  std-grub.d, sda
sda4    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda5    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda1    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda

fdisk -l (filtered): ___________________________________________________________

Disk sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk identifier: 273D7298-3818-4EA0-BDAF-3703DD323179
          Start       End   Sectors   Size Type
sda1       2048   1085439   1083392   529M Windows recovery environment
sda2    1085440   1288191    202752    99M EFI System
sda3    1288192   1320959     32768    16M Microsoft reserved
sda4    1320960 324161535 322840576 153.9G Microsoft basic data
sda5  467521536 468858879   1337344   653M Windows recovery environment
sda6  324161536 467521535 143360000  68.4G Linux filesystem
Partition table entries are not in disk order.

parted -lm (filtered): _________________________________________________________

sda:240GB:scsi:512:512:gpt:ATA KINGSTON SA400S3:pmbr_boot;
1:1049kB:556MB:555MB:ntfs:Basic data partition:hidden, diag;
2:556MB:660MB:104MB:fat32:EFI system partition:boot, esp;
3:660MB:676MB:16.8MB::Microsoft reserved partition:msftres;
4:676MB:166GB:165GB:ntfs:Basic data partition:msftdata;
6:166GB:239GB:73.4GB:ext4::;
5:239GB:240GB:685MB:ntfs::hidden, diag;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL        PARTLABEL
sda                                                                                                    
├─sda1 ntfs     36D4F797D4F75797                     7e1b17f4-b204-47ff-94c1-c1a16329f1c8 Recuperación Basic data partition
├─sda2 vfat     2AF7-AD85                            c3e30674-fd02-4775-bdf7-9b4673941b2a              EFI system partition
├─sda3                                               b515d3ba-6f9a-4a71-aade-c40e94e554e9              Microsoft reserved partition
├─sda4 ntfs     8A28FD7728FD631D                     4172e039-0871-43f8-88b5-1ce2eca637e5              Basic data partition
├─sda5 ntfs     C8BC825CBC824542                     27c163a4-a400-4dc7-a458-d774d32ba26e              
└─sda6 ext4     4abe2367-f313-4759-8ecb-1c9d2b1bf155 9e0d898d-b7ad-46c3-8cff-06ab04840013              

Mount points (filtered): _______________________________________________________

                        Avail Use% Mounted on
/dev/sda1                519M   2% /mnt/boot-sav/sda1
/dev/sda4               59.5G  61% /mnt/boot-sav/sda4
/dev/sda5                 89M  86% /mnt/boot-sav/sda5
/dev/sda6               48.7G  22% /

Mount options (filtered): ______________________________________________________

/dev/sda1              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda4              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda5              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda6              ext4            rw,relatime,errors=remount-ro

===================== sda2/efi/ubuntu/grub.cfg (filtered) ======================

search.fs_uuid 4abe2367-f313-4759-8ecb-1c9d2b1bf155 root hd0,gpt6 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

====================== sda6/boot/grub/grub.cfg (filtered) ======================

Ubuntu   4abe2367-f313-4759-8ecb-1c9d2b1bf155
Ubuntu, with Linux 5.15.0-41-generic   4abe2367-f313-4759-8ecb-1c9d2b1bf155
Ubuntu, with Linux 5.15.0-25-generic   4abe2367-f313-4759-8ecb-1c9d2b1bf155
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###
Windows 10

========================== sda6/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=4abe2367-f313-4759-8ecb-1c9d2b1bf155 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda2 during installation
UUID=2AF7-AD85  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

======================= sda6/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false

==================== sda6: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
 200,844955444 = 215,655628800  boot/grub/grub.cfg                             1
 192,821826935 = 207,040860160  boot/grub/i386-pc/core.img                     1
 193,543525696 = 207,815778304  boot/vmlinuz                                   2
 159,027889252 = 170,754895872  boot/vmlinuz-5.15.0-25-generic                 2
 193,543525696 = 207,815778304  boot/vmlinuz-5.15.0-41-generic                 2
 159,027889252 = 170,754895872  boot/vmlinuz.old                               2
 203,692836761 = 218,713518080  boot/initrd.img                                1
 194,098724365 = 208,411918336  boot/initrd.img-5.15.0-25-generic              1
 203,692836761 = 218,713518080  boot/initrd.img-5.15.0-41-generic              1
 194,098724365 = 208,411918336  boot/initrd.img.old                            1

===================== sda6: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 18683 Apr 15 23:50 10_linux
-rwxr-xr-x 1 root root 43031 Apr 15 23:50 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15 23:50 20_linux_xen
-rwxr-xr-x 1 root root 13369 Apr 15 23:50 30_os-prober
-rwxr-xr-x 1 root root  1372 Apr 15 23:50 30_uefi-firmware
-rwxr-xr-x 1 root root   700 Feb 19 14:21 35_fwupd
-rwxr-xr-x 1 root root   390 Jul 23 04:33 40_custom
-rwxr-xr-x 1 root root   215 Apr 15 23:50 41_custom

=========================== sda6/etc/grub.d/35_fwupd ===========================

#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
      . /var/lib/fwupd/uefi_capsule.conf
      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
      echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
      ${grub_probe:?}
      prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
    chainloader ${EFI_PATH}
}
EOF
      fi
fi

========================== sda6/etc/grub.d/40_custom ===========================

#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set 2AF7-AD85
        chainloader /efi/Microsoft/Boot/bootmgr.efi
}



Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi of
sda6,
using the following options:  sda2/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file

Blockers in case of suggested repair: __________________________________________

WindowsEFI detected. Please disable BIOS-compatibility/CSM/Legacy mode in your UEFI firmware, and use this software from a live-CD (or live-USB) that is compatible with UEFI booting mode. For example, use a live-USB of Boot-Repair-Disk-64bit (www.sourceforge.net/p/boot-repair-cd), after making sure your BIOS is set up to boot USB in EFI mode. Please use this software in a live-session (live-CD or live-USB). This will enable this feature.

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your UEFI firmware boot on the El sistema operativo que se está usando - Ubuntu 22.04 LTS CurrentSession entry (sda2/efi/****/grub****.efi (**** will be updated in the final message) file) !
If your computer reboots directly into Windows, try to change the boot order in your UEFI firmware.
If your UEFI firmware does not allow to change the boot order, change the default boot entry of the Windows bootloader.
For example you can boot into Windows, then type the following command in an admin command prompt:
bcdedit /set {bootmgr} path \EFI\****\grub****.efi (**** will be updated in the final message)
The boot of your PC is in BIOS-compatibility/CSM/Legacy mode. You may want to retry after changing it to UEFI mode.

如果我没记错的话,我的 BIOS 一直设置为 Legacy/UEFI。如果我尝试设置 UEFI 启动模式,每次重启都会将我引导至 BIOS。在启动优先级中,我只看到我的磁盘,而不是 ubuntu 或 windows。

提前致谢

相关内容