Skip to main content

#Grub - How to boot a linux kernel from a Grub console?

2 min read

After upgrading my personal servers to Debian Stretch, one of them would not reboot.
I had to use KVM over IP (via iLO) to figure there was an issue with the bootloader configuration.

I've successively encountered the following error messages:

no loaded kernel
file not found

After rebooting the server in rescue mode, I recovered the configuration file generated by Grub and I run the following commands in Grub console :

grub > insmod gzio
grub > insmod part_msdos
grub > insmod ext2
grub > set root='hd0,msdos1'
grub > search --no-floppy --fs-uuid --set=root BXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
grub > linux /vmlinuz-4.9.0-3-amd64 root=UUID=RXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ro quiet
grub > initrd /initrd.img-4.9.0-3-amd64
grub > boot

The first UUID (BXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) matches with a boot partition (hd0,msdos1) of a disk drive and the second UUID (RXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) matches with a root partition of a disk drive.


After gaining access to a remote shell over ssh again, I've fixed Grub installation by running the following command:  

sudo grub-install /dev/sda

Eventually, I've ensured everything was OK by using greb-emu before rebooting again

sudo apt install grub-emu
grub-install --version # returns "grub-install (GRUB) 2.02~beta3-5"