I faced a strange problem i went to college in the morning and when i came back in the evening my laptop was booting up to grub 2 command shell. And the reason was not known to me then i started looking for solutions. To my surprise there were no specific solutions available for Debian, However i thought i should try maybe they can work.

The solutions were correct however somehow confusing so i thought i should write a blog about that so that if someone goes through same problem he can refer this blog.

The link to the solution .

When you boot up to the grub-2 command shell.

List out the partitions by using

grub>ls
(proc)(hd0) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
grub>(hd0,gpt<strong>X</strong>)

Now we have to look for the partition which will give us an output like below

you have to do it by changing the number X where x =1,2,3,4 till we get the output like below.

lost+found/ bin/ boot/ cdrom/ dev/ etc/ home/  lib/
lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ 
srv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old 
initrd.img initrd.img.old

Now as you got the value of x which worked for you, like for me it is 2. Set the root and type till linux /boot/ after that you have to press tab so that you can view the possible versions of kernel for you.

the options available for me was and i selected vmlinuz-5.14.0-4-amd64. Now you have do same with initrd /boot/ and select the same version as you selected previously.

initrd.img-5.14.0-2-amd64  initrd.img-5.14.0-3-amd64  
vmlinuz-5.14.0-2-amd64     initrd.img-5.14.0-4-amd64 
vmlinuz-5.14.0-3-amd64     vmlinuz-5.14.0-4-amd64 
efi                        grub                   
grub> set root=(hd0,gpt<strong>2</strong>)
grub> linux /boot/vmlinuz-5.14.0-4-amd64 root=/dev/sda<strong>2</strong>
grub> initrd /boot/initrd.img-5.14.0-4-amd64
grub> boot

If it gives an error than enter the code written below. Now the pc should boot up.

set prefix=(hd0,gpt<strong>2</strong>)/boot/grub
set root=(hd0,gpt<strong>2</strong>)
insmod normal
normal 

Fixing grub Permanently

sudo update-grub
sudo grub-install /dev/sda
reboot