Speaktech.in

GRUB Rescue ubuntu solved

some times on bootup on dual boot we see grub rescue console



grub rescue> ls(hd0) (hd0,msdos5) (hd0,msdos1)grub rescue> ls (hd0,msdos5)(hd0,msdos5): Filesystem is unknown. grub rescue> ls (hd0,msdos1)(hd0,msdos1): Filesystem is ext2. grub rescue> ls (hd0)(hd0>: Filesystem is unknown. grub rescue> set root=(hd0,msdos1)grub rescue> set prefix=(hd0,msdos1)/boot/grubgrub rescue> insmod normalgrub rescue> normal

The state of the OS may affect the recurrent grub rescue mode.


Solution:

57

Reinstall the GRUB boot loader to your Ubuntu installation in EFI mode this way ...

Boot from the Ubuntu installation medium and select 'Try Ubuntu without installing'.
(Boot your install medium in EFI mode, select the Ubuntu entry with UEFI in front.)

Once you are on the Live desktop, open a terminal and execute these commands :

sudo mount /dev/sdXXX /mntsudo mount /dev/sdXX /mnt/boot/efifor i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; donesudo chroot /mntgrub-install /dev/sdXupdate-grub  

Note : sdX = disk | sdXX = efi partition | sdXXX = system partition


Restart pc


grub rescue> ls(hd0) (hd0,msdos5) (hd0,msdos1)grub rescue> ls (hd0,msdos5)(hd0,msdos5): Filesystem is unknown. grub rescue> ls (hd0,msdos1)(hd0,msdos1): Filesystem is ext2. grub rescue> ls (hd0)(hd0>: Filesystem is unknown. grub rescue> set root=(hd0,msdos1)grub rescue> set prefix=(hd0,msdos1)/boot/grubgrub rescue> insmod normalgrub rescue> normal


These instructions are for regular BIOS machines and are not for newer EFI machines.

Did you already run sudo update-grub after booting up Ubuntu? Running this command should update everything.

If not, you may need to reinstall grub to the MBR. Run the following command to do so:

sudo grub-install /dev/sda

Then, run sudo update-grub again for good measure.




or


sudo mount /dev/sdb8 /mnt sudo mount /dev/sdb6 /mnt/boot sudo mount /dev/sdb2 /mnt/boot/efisudo mount --bind /dev /mnt/dev &&sudo mount --bind /dev/pts /mnt/dev/pts &&sudo mount --bind /proc /mnt/proc &&sudo mount --bind /sys /mnt/syssudo chroot /mntgrub-install --target=x86_64-efi /dev/sdbgrub-install --recheck /dev/sdbexit &&sudo umount /mnt/sys &&sudo umount /mnt/proc &&sudo umount /mnt/dev/pts &&sudo umount /mnt/dev &&sudo umount /mnt


This is how I did it on a standard x86_amd64 EFI desktop, without chrooting, assuming you have a partition containing Ubuntu on your hard drive and possibly an EFI partition where GRUB should be installed.

This is how I did it on a standard x86_amd64 EFI desktop, without chrooting, assuming you have a partition containing Ubuntu on your hard drive and possibly an EFI partition where GRUB should be installed.

# boot on a live Ubuntu, I used 18.04 but more recent should work# if you have currently no EFI partition (maybe it was deleted,# or you are migrating to a new drive):# sudo gparted# - create a FAT 32 partition of around 100 MB on the disk of your choice# (in general the one that host the Ubuntu partition). If you plan to# move or resize some paritions, anticipate that (for instance by# creating the EFI partition at the end of the free space).# - set the flag esp on this partition (the flag boot will also be selected)# now assuming that the Ubuntu partition is `/dev/nvme0n1p1` and the (possibly new) EFI partition is `/dev/nvme0n1p2`sudo apt install grub-efisudo mkdir /media/root && sudo mount /dev/nvme0n1p1 /media/rootsudo mkdir /media/efi && sudo mount /dev/nvme0n1p2 /media/efisudo grub-install --target=x86_64-efi /dev/nvme0n1 --efi-directory=/media/efi --root-directory=/media/root