How to Fix Ubuntu 19.10 after it stops booting

As a usual day, I went ahead and started my computer, and I was greeted by this. “Reboot and Select Proper Boot device or Insert Boot Media in selected Boot device and press a key”

It was strange since a day before everything was running fine. There was a lot of important data on my machine and as a normal person, I felt, my hard disk has crashed and let me find ways to recover the important data atleast.

Step 1: Backup the Data I created a bootable USB stick with ubuntu. Then I followed the steps on this web page https://www.intowindows.com/use-ubuntu-live-usb-to-back-up-data-from-unbootable-windows-pc/

It does not matter if you had windows before or ubuntu, I am assuming you had ubuntu. You can find the Hard Disk in other locations and copy the files to another usb stick if you like. Once you are done we move on to next step.

Step 2: Reinstalling GRUB (Assuming BIOS Mode and not EFI) It took me a while to understand what BIOS Mode and EFI mode is, you can read this for better explanation. https://superuser.com/a/903153

Basically I was running BIOS mode on my earlier ubuntu installation. I figured it out by using this guide. https://unix.stackexchange.com/questions/120221/gpt-or-mbr-how-do-i-know

Finally I went ahead with boot-repair utility which ofcourse did not work for me as it would always give me an error saying “You need to use a Live-session” to be able to use the software.
So instead I went with the terminal method. Both the methods are explained on this link https://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/

It wasnt smooth though, I was greeted with an error on the terminal mode which said the following

Installing for i386-pc platform.
grub2-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub2-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub2-install: error: will not proceed with blocklists.

Well I was stuck again, I found that I can use the ( — force) flag along with the command mentioned to install grub to override the error.

So I used the following as explained in the guide to install by terminal.

sudo grub-install --force --boot-directory=/mnt/ubuntu/boot /dev/sdX

This time there was only the warning, but the installtion was fine. I removed the USB and rebooted and voila, I had my old ubuntu running fine!

I hope this helps someone 4 hours of time. :)