在新驱动器上全新安装 Ubuntu 后,Grub 无法识别 Windows

在新驱动器上全新安装 Ubuntu 后,Grub 无法识别 Windows

我知道这是一个非常常见的问题,但到目前为止,我读到的所有答案都对我不起作用。我有两个 M.2 NVMe SSD。我在其中一个上安装了 Windows 10,想在另一个上安装 Ubuntu 20.04。我认为对我来说更安全的方法是拔下 Windows 驱动器并进行全新安装。然后,将其插入并运行,sudo update-grub以识别另一个驱动器中的 Windows 安装。

但生活并没有那么容易(或者我忽略了一些东西):'(

$ sudo 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.8.0-63-generic
Found initrd image: /boot/initrd.img-5.8.0-63-generic
Found linux image: /boot/vmlinuz-5.8.0-43-generic
Found initrd image: /boot/initrd.img-5.8.0-43-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  55,5M  1 loop /snap/core18/1988
loop1         7:1    0   219M  1 loop /snap/gnome-3-34-1804/66
loop2         7:2    0  64,8M  1 loop /snap/gtk-common-themes/1514
loop3         7:3    0    51M  1 loop /snap/snap-store/518
loop4         7:4    0  31,1M  1 loop /snap/snapd/11036
nvme1n1     259:0    0 465,8G  0 disk 
└─nvme1n1p1 259:1    0 465,8G  0 part /media/username/System
nvme0n1     259:2    0 465,8G  0 disk 
└─nvme0n1p1 259:3    0 465,8G  0 part /

条目为:

nvme1n1     259:0    0 465,8G  0 disk 
└─nvme1n1p1 259:1    0 465,8G  0 part /media/username/System

是 Windows 所在的驱动器。

$ sudo fdisk -l
Disk /dev/loop0: 55,48 MiB, 58159104 bytes, 113592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 218,102 MiB, 229629952 bytes, 448496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 64,79 MiB, 67915776 bytes, 132648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 51,4 MiB, 53522432 bytes, 104536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 31,9 MiB, 32595968 bytes, 63664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme1n1: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: PNY CS3030 500GB SSD                    
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: dos
Disk identifier: 0xdef856b7

Device         Boot Start       End   Sectors   Size Id Type
/dev/nvme1n1p1       2048 976771071 976769024 465,8G  7 HPFS/NTFS/exFAT


Disk /dev/nvme0n1: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: PNY CS3030 500GB SSD                    
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: dos
Disk identifier: 0x84bb543f

Device         Boot Start       End   Sectors   Size Id Type
/dev/nvme0n1p1 *     2048 976771071 976769024 465,8G 83 Linux

还:

$ [ -d /sys/firmware/efi ] && echo "Installed in UEFI mode" || echo "Installed in Legacy mode"
Installed in Legacy mode

我想知道,我该怎么做才能将 Windows 添加到 GRUB 并实现双重启动?

提前谢谢您。如果您需要更多信息,请告诉我

更新 1:

首先,我删除了我的 Ubuntu 驱动器,但 Windows 无法启动 :( 我意识到我还有其他驱动器被拔掉了。我把它们插上,它正常启动了 Windows。显然,Windows 引导加载程序已安装在其他地方。奇怪!我拔掉了 Windows 驱动器以外的所有东西,试图解决引导加载程序问题。

我尝试了 Windows 方面的不同方法。我创建了一个媒体安装驱动器并启动到故障排除区域。在那里,我进入命令行提示符并用来diskpart创建 Windows 分区active

我使用bootrec /fixmbrbootrec /fixbootbootrec /rebuildbbcd。这个也不起作用。然后我使用bcdboot c:\windows /d和 ,这个就起作用了。我重新启动并正常启动了 Windows,没有插入任何其他驱动器。

插入我的 Ubuntu 驱动器并运行sudo 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.8.0-63-generic
Found initrd image: /boot/initrd.img-5.8.0-63-generic
Found linux image: /boot/vmlinuz-5.8.0-43-generic
Found initrd image: /boot/initrd.img-5.8.0-43-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 10 on /dev/nvme1n1p1
done

终于!

附言:不知道我是否应该将这次更新作为我自己问题的答案来帮助其他人。我稍后会尝试。

相关内容