Grub – Emergency Boot

If Grub fails to boot your operating system, you can take steps to find and boot your system then reinstall grub to fix the problem. The following example shows you how to use commands in the emergency grub command line to find your operating system and boot it. Lines that start with the comment character ‘//’ is a description of what the command is doing.

// use the 'ls' command to find all partitions that grub can find
grub  rescue> ls 
(hd0,gpt1) (hd0,gpt2) etc 

// use 'ls' to see what filesystem each partition uses
grub rescure> ls (hd0,gpt2) 
Filesystem is ext4/btrfs/etc 

// use command to see what the filesystem contains
grub rescure> ls (hd0,gpt2)/etc/fstab

// now that you've found your operating system, boot it
grub rescure> set root=(hd0,gpt2) 
grub rescure> set prefix=(hd0,gpt2)/boot/grub (or grub2) 
grub rescure> insmod normal 
grub rescure> normal 

// Once you're back in the system, fix grub
# sudo update-grub  
or sudo grub-mkconfig –o /boot/grub/grub.cfg 
or sudo grub2-mkconfig –o /boot/grub2/grub.cfg 
or sudo grub2-mkconfig –o /boot/efi/EFI/fedora/grub.cfg 

# grub-install /dev/nvme0n1 (or /dev/sda) 
or sudo grub2-install /dev/nvme0n1 (or /dev/sda)

Make sure that you know where your grub.cfg is located and the location to install grub (/dev/nvme0n1, /dev/sda, etc) and modify the above appropriately.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s