grub2修复NVMe驱动器引导

分享于 

3分钟阅读

ubuntu

  繁體

问题

我尝试迁移到NVMe三星950 pro。


chroot /mnt/boot-sav/nvme0n1p3 update-grub


grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.



sudo fdisk -l


Device Start End Sectors Size Type


/dev/nvme0n1p1 2048 206847 204800 100M Microsoft basic data


/dev/nvme0n1p2 206848 487878655 487671808 232.6G Microsoft basic data


/dev/nvme0n1p3 487878656 864057343 376178688 179.4G Linux filesystem


/dev/nvme0n1p4 864057344 897484799 33427456 16G Linux swap



Device Boot Start End Sectors Size Id Type


/dev/sda1 * 0 2301535 2301536 1.1G 0 Empty


/dev/sda2 2279532 2284075 4544 2.2M c W95 FAT32 (LBA)



这是最新的尝试:


sudo mount /dev/nvme0n1p3 /mnt


sudo mount /dev/nvme0n1p1 /mnt/boot/efi



for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done



sudo cp --remove-destination /etc/resolv.conf /mnt/etc/resolv.conf



sudo chroot /mnt


grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot 



结果:


Installation finished. No error reported.



$ update-grub


grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.




答案1

 
sudo fdisk -l



然后,查看ubuntu安装的分区(ext4文件类型),然后:


sudo mount -t ext4 /dev/sda6 /mnt 



(确认sda6是ubuntu分区)

然后


sudo grub-install --root-directory=/mnt /dev/sda



重新安装grub,并查看所有OS,并组织它们。


答案2

这绝对有用。


Device Start End Sectors Size Type


/dev/nvme0n1p1 2048 206847 204800 100M Microsoft basic data


/dev/nvme0n1p2 206848 487878655 487671808 232.6G Microsoft basic data


/dev/nvme0n1p3 487878656 864057343 376178688 179.4G Linux filesystem


/dev/nvme0n1p4 864057344 897484799 33427456 16G Linux swap



在这里我看不到EFI分区和单独的启动分区。

然后引导至Ubuntu Live介质。

挂载root parition


sudo mount /dev/nvme0n1pX /mnt/



挂载efi分区


sudo mount /dev/nvme0n1pX /mnt/boot/efi



;将X替换为实际的设备id

Chroot和重新安装Grub


sudo chroot /mnt


grub-install





rep  BOO  引导  Drive  cop  拷贝