Linux: Boot from GRUB shell

GRUB is the grand unified bootloader to allow multiple operating systems to coexist on a single disk. The GRUB menu allows a simple boot selection, but sometimes it gets corrupted. When this happens, you will find yourself at a mystifying grub> prompt with a notice that Minimal BASH-like line editing is supported...

If you find yourself in this situation, then you will need to boot the system yourself and then recreate your GRUB menus after you recover.

Some hints

  1. Pressing TAB will show you your available commands
  2. ls -l will show the file system available to you
  3. File systems are referred to as (hd#,#) where the first number is the number of the disk found by GRUB and the second number is the partition. Letters before the second number are ignored. The first number might change from one boot to the next.
  4. The root environment variable is like a current disk / partition.

A commented example of initiating the boot sequence

grub> set pager=1 # paged display
grub> set root=(hd1,5) # set base disk partition
grub> ls -l (hd1,5)/boot # show what is on the base partition
grub> linux /boot/vmlinuz-6.8.0-49-generic root=/dev/nvme0n1p5 ro # load linux. the root parameter is very important
grub> initrd /boot/initrd.img-6.8.0-49-generic # load initial ram disk
grub> boot # do the boot
12 / 2024