Fedora 开机进grub,无法进os
=====原因是:grub.cfg文件出问题了,gpt1就是第一个分区,gpt2就是第二个分区…=====
grub>set
发现root=(hd0,gpt1)
ls (hd0.gpt1)/EFI/fedora/grub.cfg 为空的,内容被清空了
=======解决办法,手动进系统,重新生产(hd0,gpt1)下面的grub.cfg文件====
1. grub> ls
(hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) (lvm/fedora-root) (lvm/fedora-swap)
2.找boot 分区,依次ls
grub>ls (hd0,gpt1)/
./ ../ 99bfb892969e49d7b5481e7f25ecc64b/ EFI/
grub> ls (hd0,gpt2)/
./ ../ lost+found/ efi/ grub2/ vmlinuz-4.13.9-300.fc27.x86_64
System.map-4.13.9-300.fc27.x86_64 config-4.13.9-300.fc27.x86_64
.vmlinuz-4.13.9-300.fc27.x86_64.hmac initramfs-4.13.9-300.fc27.x86_64.img
initramfs-0-rescue-99bfb892969e49d7b5481e7f25ecc64b.img
vmlinuz-0-rescue-99bfb892969e49d7b5481e7f25ecc64b
vmlinuz-4.15.10-300.fc27.x86_64 System.map-4.15.10-300.fc27.x86_64
config-4.15.10-300.fc27.x86_64 .vmlinuz-4.15.10-300.fc27.x86_64.hmac
vmlinuz-4.16.6-202.fc27.x86_64 vmlinuz-4.14.10-300.fc27.x86_64
System.map-4.14.10-300.fc27.x86_64 config-4.14.10-300.fc27.x86_64
.vmlinuz-4.14.10-300.fc27.x86_64.hmac initramfs-4.14.10-300.fc27.x86_64.img
vmlinuz-4.15.6-300.fc27.x86_64 System.map-4.15.6-300.fc27.x86_64
config-4.15.6-300.fc27.x86_64 .vmlinuz-4.15.6-300.fc27.x86_64.hmac
initramfs-4.15.6-300.fc27.x86_64.img initramfs-4.15.10-300.fc27.x86_64.img
System.map-4.16.6-202.fc27.x86_64 config-4.16.6-202.fc27.x86_64
.vmlinuz-4.16.6-202.fc27.x86_64.hmac initramfs-4.16.6-202.fc27.x86_64.img
下面有grub2/ 和image 文件 所以(hd0,gpt2)就是boot 分区(或者提示是ext2的系统格式也是boot 分区)
3. grub> set root=(hd0,gpt2) #临时修改root 所在分区
grub> linuxefi (hd0,gpt2)/vmlinuz-4.17.3-100.fc27.x86_64 root=/dev/mapper/fedora-root
grub> initrdefi (hd0,gpt2)/initramfs-4.17.3-100.fc27.x86_64.img
grub> boot
4.进系统后,修复grub2
df 发现sda1是/boot/efi
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
reboot 就可以正常进系统了