Grub console how to

I’m sure it happened to migrate a linux server, maybe in a slightly dirty way (rsync’ing) or had some issues with the boot loader.

And when you reach the point with this:

…and you start to cry (or almost) ūüôā

Well, here some steps that helped me to boot the server and restore grub.

Use  ls to see the list of available partitions. Find the one where you know (or think) the kernel is installed. In my case it was  (hd0,msdos1) , which is basically /dev/sda1

After that, use the following:

With these commands, I have been able to boot into my OS.

After that, I re-installed grub:

NOTE: UUID could be a cause of failed boot too.
Under Debian/Ubuntu there is a file  /etc/default/grub where you can disable the UUID format. This could generate some issues if you have swapped the disk so it might be good to check this config file and eventually enable  GRUB_DISABLE_LINUX_UUID=true and re run the  update-grub . To remember as well, the UUID is set in  /etc/fstab . You can replace that with /dev/sdXy accordingly as well.

I hope this will help someone else that, like me, got stuck in restoring a VM.