![安装 Windows 8 后如何修复 grub 以实现双启动?](https://linux22.com/image/909402/%E5%AE%89%E8%A3%85%20Windows%208%20%E5%90%8E%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%20grub%20%E4%BB%A5%E5%AE%9E%E7%8E%B0%E5%8F%8C%E5%90%AF%E5%8A%A8%EF%BC%9F.png)
我在双启动中运行了加密的 ubuntu 16.04lts 和 windows 8.1.重新安装 windows 后我丢失了 grub 菜单..我尝试通过运行 bootrepair 使用推荐的修复按钮来修复它但没有起作用..我想是因为分区是加密的。
来自 Live CD:
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 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
Disk /dev/loop0: 1.3 GiB, 1433468928 bytes, 2799744 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/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0x8448020a
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 567158783 567156736 270.5G 7 HPFS/NTFS/exFAT
/dev/sda2 567158784 568135679 976896 477M 83 Linux
/dev/sda3 568137726 764157951 196020226 93.5G 5 Extended
/dev/sda4 771971445 976768064 204796620 97.7G 7 HPFS/NTFS/exFAT
/dev/sda5 568137728 764157951 196020224 93.5G 83 Linux
Partition 3 does not start on physical sector boundary.
Partition 4 does not start on physical sector boundary.
Partition table entries are not in disk order.
Disk /dev/sdb: 3.8 GiB, 4089970688 bytes, 7988224 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: 0x00255f71
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 7988223 7986176 3.8G c W95 FAT32 (LBA)
Disk /dev/mapper/encrypted-volume: 93.5 GiB, 100360257536 bytes, 196016128 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
sda4:noname3 是没有任何操作系统的分区,sda1 有 Windows 8。
ubuntu@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 270.5G 0 part
├─sda2 8:2 0 477M 0 part /mnt
├─sda3 8:3 0 1K 0 part
├─sda4 8:4 0 97.7G 0 part /media/ubuntu/NoName3
└─sda5 8:5 0 93.5G 0 part
└─encrypted-volume 252:0 0 93.5G 0 crypt
sdb 8:16 1 3.8G 0 disk
└─sdb1 8:17 1 3.8G 0 part /cdrom
sr0 11:0 1 1024M 0 rom
loop0 7:0 0 1.3G 1 loop /rofs
以下是我遇到的错误:
ubuntu@ubuntu:~$ sudo update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'.
ubuntu@ubuntu:~$ sudo cryptsetup luksOpen /dev/sda5 encrypted-volume
Enter passphrase for /dev/sda5:
Cannot use device /dev/sda5 which is in use (already mapped or mounted)
ubuntu@ubuntu:~$ sudo vgchange -ay
ubuntu@ubuntu:~$ sudo lvscan
ubuntu@ubuntu:~$ sudo ls /dev/mapper/
control encrypted-volume
ubuntu@ubuntu:~$ sudo mount /dev/mapper/sda5 /mnt/system/
mount: special device /dev/mapper/sda5 does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt/system/boot/
mount: mount point /mnt/system/boot/ does not exist
ubuntu@ubuntu:~$ sudo mount /dev/mapper/sda5 /mnt
mount: special device /dev/mapper/sda5 does not exist
ubuntu@ubuntu:~$ sudo mount /dev/sda5 /mnt
mount: unknown filesystem type 'crypto_LUKS'
老实说,我对 Linux 还是个菜鸟,但在过去的两年里,我真的很喜欢使用 ubuntu。我希望有人能帮助我解决这个问题。提前谢谢大家。
答案1
您的硬盘配置有点混乱。请注意,加密会导致大量备份/恢复问题,因此如果您真的不需要加密,请不要使用它。另外,我猜您只有少量的 RAM,使用 ramdisk 软件可能也帮不上忙。
您的较小 sda 显示两个 Linux 分区(为什么?)和两个 ntfs 分区(为什么?),没有交换(除非您使用 /swapfile),并且您的扩展分区和第二个 ntfs 分区未正确对齐...
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 0x8448020a
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 567158783 567156736 270.5G 7 HPFS/NTFS/exFAT
/dev/sda2 567158784 568135679 976896 477M 83 Linux
/dev/sda3 568137726 764157951 196020226 93.5G 5 Extended
/dev/sda4 771971445 976768064 204796620 97.7G 7 HPFS/NTFS/exFAT
/dev/sda5 568137728 764157951 196020224 93.5G 83 Linux
Partition 3 does not start on physical sector boundary.
Partition 4 does not start on physical sector boundary.
Partition table entries are not in disk order.
如果是我的话...我会...
- 备份你的 Windows 和 Ubuntu 数据
- 放置一个新的 MBR 分区表(这将擦除磁盘)
- 首先重新安装 Windows
- 重新安装 Ubuntu SECOND
- 重新运行
sudo fdisk -l
并确认没有错位的分区 - 要开心