最初一切都运行正常,但是突然在单击 grub 菜单中的 Windows 时开始显示此错误:
```none
Setting partition type to 0x7
error: failure writing sector 0x0 to 'hd1'
```
(注意:hd0 是我的未使用的硬盘,而 hd1 是我的 SSD。)
所以我update-grub
在我的 Ubuntu 机器上运行,然后 Windows 选项从 grub 菜单中消失了。
我试过:
我发现 Windows 和 Ubuntu 都采用旧版 BIOS,因此没有兼容性问题。
在 /etc/grub.d/40_custom menuentry 'Windows 10' 中手动添加了这些条目 { search --fs-uuid --no-floppy --set=root 205C8FE55C8FB3D6 chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi }
我也尝试使用地址,
/mnt/nvme0n1p1/Windows/Boot/EFI/bootmgfw.efi
因为我只在这个地址上找到了 bootmgfw.efi 文件,而不是上面的地址。編輯
/etc/default/grub
:GRUB_DISABLE_OS_PROBER=false
运行
update-grub
后未检测到 Windows 操作系统。输出如下:Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.19.0-41-generic Found initrd image: /boot/initrd.img-5.19.0-41-generic Found linux image: /boot/vmlinuz-5.19.0-38-generic Found initrd image: /boot/initrd.img-5.19.0-38-generic Found linux image: /boot/vmlinuz-5.15.0-71-generic Found initrd image: /boot/initrd.img-5.15.0-71-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. done
同样,os-prober 也没有产生任何输出。
手动添加 Windows 后,grub 现在显示 Windows 选项,但单击时会产生此错误:
error: invalid signature Press any key to continue.
我也尝试运行 Boot-Repair,但它也找不到窗口。输出如下:输出链接
============================= Boot Repair Summary ==============================
Default settings: ______________________________________________________________
The default repair of the Boot-Repair utility would reinstall the grub2 of
nvme0n1p5 into the MBR of nvme0n1.
Grub-efi would not be selected by default because no ESP detected.
Additional repair would be performed: unhide-bootmenu-10s win-legacy-basic-fix
User settings: _________________________________________________________________
The settings chosen by the user will reinstall the grub2 of
nvme0n1p5 into the MBR of nvme0n1.
Grub-efi will not be selected by default because no ESP detected.
The boot flag will be placed on nvme0n1p1.
Additional repair will be performed: unhide-bootmenu-10s win-legacy-basic-fix
Quantity of real Windows: 1
WinSE in nvme0n1p1
/mnt/nvme0n1p1/ may need repair.
/mnt/nvme0n1p1/bootmgr may need repair.
Unhide GRUB boot menu in nvme0n1p5/etc/default/grub
======================= Reinstall the grub2 of nvme0n1p5 =======================
grub-install --version
grub-install (GRUB) 2.06-2ubuntu7
==> Reinstall the GRUB of nvme0n1p5 into the MBR of nvme0n1
grub-install /dev/nvme0n1
Installing for i386-pc platform.
Installation finished. No error reported.
update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.19.0-41-generic
Found initrd image: /boot/initrd.img-5.19.0-41-generic
Found linux image: /boot/vmlinuz-5.19.0-38-generic
Found initrd image: /boot/initrd.img-5.19.0-38-generic
Found linux image: /boot/vmlinuz-5.15.0-71-generic
Found initrd image: /boot/initrd.img-5.15.0-71-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Unhide GRUB boot menu in nvme0n1p5/boot/grub/grub.cfg
Boot successfully repaired.
You can now reboot your computer.
============================ Boot Info After Repair ============================
=> Grub2 (v2.00) is installed in the MBR of /dev/nvme0n1 and looks at sector
1 of the same hard drive for core.img. core.img is at this location and
looks for (,msdos5)/boot/grub. It also embeds following components:
modules
---------------------------------------------------------------------------
fshelp ext2 part_msdos biosdisk
---------------------------------------------------------------------------
nvme0n1p1: _____________________________________________________________________
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 10 or 11
Boot files: /Windows/System32/winload.exe
nvme0n1p2: _____________________________________________________________________
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:
nvme0n1p3: _____________________________________________________________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
nvme0n1p5: _____________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 22.04.1 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
/boot/grub/i386-pc/core.img
================================ 2 OS detected =================================
OS#1: Ubuntu 22.04.1 LTS on nvme0n1p5
OS#2: Windows 10 or 11 on nvme0n1p1
================================ Host/Hardware =================================
CPU architecture: 64-bit
Video: UHD Graphics 620 GP108M [GeForce MX150] from Intel Corporation NVIDIA Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.19.0-41-generic root=UUID=1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f ro quiet splash vt.handoff=7
df -Th / : /dev/nvme0n1p5 ext4 63G 53G 6.1G 90% /
===================================== UEFI =====================================
BIOS/UEFI firmware: V1.10(1.10) from Insyde Corp.
The firmware seems EFI-compatible, but this installed-session is in Legacy/BIOS/CSM mode (not in EFI mode).
============================= Drive/Partition Info =============================
Disks info: ____________________________________________________________________
nvme0n1 : notGPT, no-BIOSboot, has-noESP, not-usb, not-mmc, has-os, has-win, 2048 sectors * 512 bytes
Partitions info (1/3): _________________________________________________________
nvme0n1p5 : is-os, 64, apt-get, grub-pc , grub2, grub-install, grubenv-ok, update-grub, farbios
nvme0n1p1 : is-os, 64, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
nvme0n1p2 : no-os, 64, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
Partitions info (2/3): _________________________________________________________
nvme0n1p5 : isnotESP, fstab-without-efi, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
nvme0n1p1 : isnotESP, part-has-no-fstab, no-nt, haswinload, no-recov-nor-hid, no-bmgr, notwinboot
nvme0n1p2 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
Partitions info (3/3): _________________________________________________________
nvme0n1p5 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, nvme0n1
nvme0n1p1 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, nvme0n1
nvme0n1p2 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, nvme0n1
fdisk -l (filtered): ___________________________________________________________
Disk nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk identifier: 0x3bc18fd1
Boot Start End Sectors Size Id Type
nvme0n1p1 * 2048 842551295 842549248 401.8G 7 HPFS/NTFS/exFAT
nvme0n1p2 842551296 843599871 1048576 512M 7 HPFS/NTFS/exFAT
nvme0n1p3 843603966 976771071 133167106 63.5G 5 Extended
nvme0n1p5 843603968 976771071 133167104 63.5G 83 Linux
parted -lm (filtered): _________________________________________________________
nvme0n1:500GB:nvme:512:512:msdos:WDC WDS500G2B0C-00PXH0:;
1:1049kB:431GB:431GB:ntfs::boot;
2:431GB:432GB:537MB:ntfs::;
3:432GB:500GB:68.2GB:::;
5:432GB:500GB:68.2GB:ext4::;
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
sda
nvme0n1
├─nvme0n1p1 ntfs 205C8FE55C8FB3D6 3bc18fd1-01
├─nvme0n1p2 ntfs 3A208E6B208E2E47 3bc18fd1-02 New Volume
├─nvme0n1p3 3bc18fd1-03
└─nvme0n1p5 ext4 1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f 3bc18fd1-05
Mount points (filtered): _______________________________________________________
Avail Use% Mounted on
/dev/nvme0n1p1 51.2G 87% /mnt/boot-sav/nvme0n1p1
/dev/nvme0n1p2 502M 2% /mnt/boot-sav/nvme0n1p2
/dev/nvme0n1p5 6G 85% /
Mount options (filtered): ______________________________________________________
=================== nvme0n1p5/boot/grub/grub.cfg (filtered) ====================
Ubuntu 1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f
Ubuntu, with Linux 5.19.0-41-generic 1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f
Ubuntu, with Linux 5.19.0-38-generic 1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f
Ubuntu, with Linux 5.15.0-71-generic 1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###
Windows 10
Windows 101
======================== nvme0n1p5/etc/fstab (filtered) ========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=1cdf9ad1-9af0-4dc9-b0b4-f2705ebe502f / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p2 during installation
/swapfile none swap sw 0 0
/dev/nvme0n1p1 /mnt/nvme0n1p1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
==================== nvme0n1p5/etc/default/grub (filtered) =====================
GRUB_DISABLE_OS_PROBER=false
GRUB_DEFAULT="2"
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
================= nvme0n1p5: Location of files loaded by Grub ==================
GiB - GB File Fragment(s)
408.578414917 = 438.707732480 boot/grub/grub.cfg 1
460.581150055 = 494.545244160 boot/grub/i386-pc/core.img 1
452.108428955 = 485.447729152 boot/vmlinuz 1
452.108428955 = 485.447729152 boot/vmlinuz-5.15.0-71-generic 1
429.991817474 = 461.700198400 boot/vmlinuz-5.19.0-38-generic 2
446.679325104 = 479.618273280 boot/vmlinuz-5.19.0-41-generic 2
446.679325104 = 479.618273280 boot/vmlinuz.old 2
439.511135101 = 471.921487872 boot/initrd.img 4
439.511135101 = 471.921487872 boot/initrd.img-5.15.0-71-generic 4
426.010238647 = 457.425010688 boot/initrd.img-5.19.0-38-generic 99
457.261714935 = 490.981027840 boot/initrd.img-5.19.0-41-generic 5
457.261714935 = 490.981027840 boot/initrd.img.old 5
=================== nvme0n1p5: ls -l /etc/grub.d/ (filtered) ===================
-rwxr-xr-x 1 root root 18683 Apr 16 2022 10_linux
-rwxr-xr-x 1 root root 43031 Apr 16 2022 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 16 2022 20_linux_xen
-rwxr-xr-x 1 root root 13398 May 24 20:57 30_os-prober
-rwxr-xr-x 1 root root 1372 Apr 16 2022 30_uefi-firmware
-rwxr-xr-x 1 root root 700 Feb 21 2022 35_fwupd
-rwxr-xr-x 1 root root 511 May 26 20:02 40_custom
-rwxr-xr-x 1 root root 215 Apr 16 2022 41_custom
drwxr-xr-x 4 root root 4096 May 25 11:42 backup
======================== nvme0n1p5/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' {
search --fs-uuid --no-floppy --set=root 205C8FE55C8FB3D6
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
#menuentry 'Windows 101' {
# search --fs-uuid --no-floppy --set=root 3A208E6B208E2E47
# chainloader (${root})/Windows/Boot/EFI/bootmgfw.efi
#}
- 我还按照一些帖子中的建议创建了一个可启动的 U 盘来修复 Windows,但它也无法找到 Windows。
答案1
最后,我将一个新的 SSD 连接到我的笔记本电脑,并将所有数据复制到其中。
然后安装新的窗户。