我双启动 Windows 10 和 Ubuntu 18.04。我的 SSD 上的空间有点拥挤,所以我想删除我的大交换分区,改用交换文件,就像在默认安装中一样。我正确地创建了一个交换文件,并在 fstab 中编辑了相应的行,然后重新启动并free
显示它正在使用该文件。我启动到 ubuntu 的实时 usb 并运行 gparted 以删除交换分区并将 ubuntu 扩展到可用空间,一切顺利。
当我尝试启动 grub2 时,它一直进入救援模式。我尝试启动 Windows,但它给出了一个错误。我重新启动到实时 USB 以运行启动修复,但无法修复 grub,因此我切换到修复 MBR,然后我能够再次启动 Windows,但没有提供启动 ubuntu 的选项。
现在我尝试使用启动修复重新安装 grub,但它一直出错。我有 pastebin这里并且它说找不到 EFI 分区。sudo fdisk -l
给出以下内容:
Disk /dev/loop0: 1.8 GiB, 1864450048 bytes, 3641504 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: 86.9 MiB, 91099136 bytes, 177928 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: 34.7 MiB, 36323328 bytes, 70944 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: 140.9 MiB, 147722240 bytes, 288520 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: 2.3 MiB, 2433024 bytes, 4752 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/loop5: 13 MiB, 13619200 bytes, 26600 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/loop6: 14.5 MiB, 15196160 bytes, 29680 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/loop7: 3.7 MiB, 3887104 bytes, 7592 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/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 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
Disklabel type: dos
Disk identifier: 0x0001a5ef
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 914407423 914405376 436G 7 HPFS/NTFS/exFAT
/dev/nvme0n1p2 914407424 915329023 921600 450M 27 Hidden NTFS WinRE
/dev/nvme0n1p3 915331070 1000214527 84883458 40.5G 5 Extended
/dev/nvme0n1p5 915331072 1000214527 84883456 40.5G 83 Linux
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x6f63051a
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 206847 204800 100M 7 HPFS/NTFS/exFAT
/dev/sda2 206848 1953110015 1952903168 931.2G 7 HPFS/NTFS/exFAT
/dev/sda3 * 1953110016 1953519615 409600 200M 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0x0000ddff
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 976769023 976766976 465.8G 7 HPFS/NTFS/exFAT
Disk /dev/sdc: 232.9 GiB, 250059350016 bytes, 488397168 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
Disklabel type: dos
Disk identifier: 0xb95cbb7b
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 488394751 488392704 232.9G 7 HPFS/NTFS/exFAT
Disk /dev/sdd: 29.7 GiB, 31914983424 bytes, 62333952 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
Disklabel type: dos
Disk identifier: 0x663eb4c4
Device Boot Start End Sectors Size Id Type
/dev/sdd1 * 0 3815135 3815136 1.8G 0 Empty
/dev/sdd2 3737268 3741939 4672 2.3M ef EFI (FAT-12/16/32)
我知道我有很多装有旧安装的物理驱动器,但我想要的是/dev/nvme0n1
我的主启动驱动器。我的 ubuntu 是为我的开发环境定制的,所以如果只是启动错误,我真的不想重新安装 ubuntu。如何将 grub2 设置为默认启动管理器。
编辑:我尝试按照以下方法创建 EFI 分区这指南和我创建了分区,但我无法安装 grub。sudo update grub
输出/usr/sbin/grub-probe: error: failed to get canonical path of ``/cow'. (only one backtick near cow)
按照要求sudo parted -l
给出这个
Model: ATA WDC WD10EARX-00N (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 106MB 105MB primary ntfs
2 106MB 1000GB 1000GB primary ntfs
3 1000GB 1000GB 210MB primary ntfs boot
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 500GB 500GB primary ntfs boot
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sdc: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 250GB 250GB primary ntfs
Warning: The driver descriptor says the physical block size is 2048 bytes, but
Linux says it is 512 bytes.
Ignore/Cancel?
Ignore/Cancel? ignore
Model: Generic- SD/MMC (scsi)
Disk /dev/sdd: 128GB
Sector size (logical/physical): 2048B/512B
Partition Table: mac
Disk Flags:
Number Start End Size File system Name Flags
1 2048B 6143B 4096B Apple
2 1913MB 1916MB 2392kB EFI
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
3 1049kB 211MB 210MB fat32 EFI System boot, esp
1 211MB 468GB 468GB ntfs Microsoft basic data msftdata
2 468GB 469GB 472MB ntfs Windows RE diag
5 469GB 512GB 43.5GB ext4 Linux filesystem
编辑 2:所以我能够将我的 ubuntu 安装启动到 efi 模式,并且能够安装 grub-efi。我能够启用安全启动并禁用 CSM,并且 ubuntu 仍然加载。唯一的问题是 Windows 现在无法启动,尽管我猜是因为它仍然认为它处于 MBR 模式。我正在制作一个实时 Windows usb 来修复这个问题,但我不知道它是否会弄乱我设置的 EFI 分区。这是修复它的正确方法吗?
答案1
我最终修复了这个问题,并且没有擦除任何数据。我认为使用创建 EFI 分区gdisk
然后安装 efi 版本的 grub 可以修复这个问题。至于损坏的 Windows,我运行了bootrec
您在线创建的安装 usb,并使用了重建 bcd 和 fixmbr 等选项,然后它启动了。之后我sudo update-grub
在 Ubuntu 中运行,它检测到了 Windows。