- 使用ls 命令查看
ls 命令查看系统安装在哪个分区
我的出现的是 (hd0) (hd0,gpt1) (hd0,gpt2) (hd0,gpt3)
结果发现安装在 (hd0,gpt2)
grub rescue> ls (hd0,gpt2)/
其中 /boot目录下有两个文件,vmlinuz 和initrd
**- **
grub rescue> set root=(hd0,gpt2)
grub rescue> set prefix=(hd0,gpt2)/boot/grub
grub rescue> set #查看我们现在设置的变量
grub rescue> insmod normal
grub rescue> normal
grub rescue> boot
或者
grub> linux /boot/vmlinuz-4.15.0-20-generic root=/dev/sda2
grub> initrd /boot/initrd.img-4.15.0-20-generic
自己电脑报错
error: attempt to read or write outside of disk “hd0”
To check the file system on your Ubuntu partition...
boot to the GRUB menu
choose Advanced Options
choose Recovery mode
choose Root access
at the # prompt, type sudo fsck -f /
repeat the fsck command if there were errors
type reboot
If for some reason you can't do the above...
boot to a Ubuntu Live DVD/USB
start gparted and determine which /dev/sdaX is your Ubuntu EXT4 partition
quit gparted
open a terminal window
type sudo fsck -f /dev/sdaX # replacing X with the number you found earlier
repeat the fsck command if there were errors
type reboot
boot后可以顺利进入系统,进行Grub 修复,否则下次依然是grub rescue 模式
sudo update-grub
sudo grub-install /dev/sda
insmod —load grub module
参考:
https://linuxhint.com/grub_rescue_ubuntu_1804/
或者最后的方法-----重装