Boot from GRUB prompt
Sometimes, GRUB displays a grub> prompt rather than the expected menu list.
It is possible to boot your Ubuntu system from this prompt and eventually restore GRUB from a working session.
On this page, a command that starts with
grub> indicates that the command should be run from within the GRUB prompt.1. List disks and partitions using the ls command
grub> ls
Example output:
(memdisk) (proc) (hd0) (hdo,gpt2) (hdo,gpt1)
(hd0,gpt1) is the ESP (EFI System Partition).
(hd0,gpt2) is the system partition.
If the system uses msdos partition table, then the corresponding partitions would be (hd0,msdos1) and (hd0,msdos2).
2. List folders under system partition 2 - looking for boot/
grub> ls (hd0,gpt2)/
Example output:
lost+found/ boot/ bin lib lib64 sbin cdrom/ dev/ etc/ home/ media/ mnt/ opt/ proc/ root/ run/ snap/ srv/ sys/ tmp/ usr/ var/ swapfile
3. Double check that the target OS has been identified
grub> cat (hd0,gpt2)/etc/issue
Example output:
Ubuntu 26.04.4 LTS \n \l
4. List files in boot - looking for vmlinuz and initrd
grub> ls (hd0,gpt2)/boot
Example output:
efi/ initrd.img initrd.img.old vmlinuz vmlinuz.old config-7.0.0-22-generic initrd.img-7.0.0-22-generic System.map-7.0.0-22-generic memtest86+ia32.bin memtest86+ia32.efi memtest86+x64.bin memtest86+x64.efi vmlinuz-7.0.0-22-generic config-7.0.0-22-generic config-7.0.0-27-generic System.map-7.0.0-27-generic initrd.img-7.0.0-27-generic vmlinuz-7.0.0-27-generic
5. Set root after locating vmlinuz
grub> set root=(hd0,gpt2)
6. Linux command to make the relative path of vmlinuz file known to GRUB bootloader
Choose a known working kernel and set the location of the root filesystem e.g. nvme0n1 disk with partition nvme0n1p2:
grub> linux /boot/vmlinuz-7.0.0-27-generic root=/dev/nvme0n1p2
Nota bene - double check device i.e disk type:
root=/dev/sda2 for sda disk
root=/dev/mmcblk0p2 for eMMC disk
root=/dev/vda2 for virtual machine
7. Initrd command to make the initrd image known to the GRUB bootloader
Choose the .img from the same working kernel above i.e. matched pair:
grub> initrd /boot/initrd.img-7.0.0-27-generic
8. Boot the OS
grub> boot
Assuming that you have successfully booted into your Ubuntu system, GRUB can be re-installed in a working session.
Open a terminal Ctrl Alt t and enter:
sudo grub-install /dev/nvme0n1
or:
sudo grub-install --efi-directory=/boot/efi /dev/nvme0n1
Example output:
Installing for x86_64-efi platform
Installation finished. No error reported
Replace /dev/nvme0n1 with your correct disk i.d. e.g. sda or mmcblk0.
GRUB is always installed to a disk nvme0n1 rather than a partition nvme0n1p1.