Skip to content

GRUB Rescue Commands and How to Fix Linux Boot Failures

8 min read

Applies to: GRUB 2.12 (Debian 13, Ubuntu 24.04, AlmaLinux 10), initramfs-tools 0.148 (Debian 13) and dracut (AlmaLinux 10, Ubuntu 26.04)

The screen your server stops at tells you which part of the boot failed:

  • grub rescue>: GRUB started but cannot load its normal module, usually because it cannot find /boot/grub. Use ls, set prefix, set root, insmod normal and normal, then reinstall GRUB.
  • grub>: GRUB works but has no usable menu. Boot by hand with linux, initrd and boot, then rebuild grub.cfg.
  • (initramfs) with BusyBox, or "Entering emergency mode" from dracut: the kernel started but could not mount the root file system. Usually a disk check (fsck) or a wrong root= device.
  • Kernel panic - not syncing: VFS: Unable to mount root fs: the kernel could not find the root disk at all. Usually a missing or broken initramfs; boot an older kernel and rebuild it.

All of these need the server's console, not SSH: the VPS console in your VPS panel, or IPMI on a dedicated server. If the system cannot be repaired from its own boot screens, start the VPS in rescue mode in Virtualizor, or boot a dedicated server from an ISO (Supermicro IPMI virtual media).

grub rescue commands

According to the GNU GRUB manual, rescue mode normally offers only ls, set, unset and insmod. That is enough to point GRUB at the right partition:

  1. List the disks and partitions: ls
  2. Look inside each partition until you find the one with /boot/grub (or /grub if /boot is a separate partition): ls (hd0,msdos1)/. On GPT disks the names look like (hd0,gpt2).
  3. Point GRUB at it (adjust the partition):
    set root=(hd0,msdos1)
    set prefix=(hd0,msdos1)/boot/grub
    insmod normal
    normal
  4. The usual menu appears. Boot the system and reinstall GRUB properly (below), because this fix only lasts until the next reboot.

Lab example: GRUB 2.12 running as grub-emu (GRUB's emulator) on Debian 13 against a test disk image with an ext4 root partition and a swap partition. The emulator shows grub>; on a broken server the same commands are typed at grub rescue>.

grub> ls
(proc) (hd0) (hd0,msdos2) (hd0,msdos1) (host)
grub> ls (hd0,msdos1)
        Partition hd0,msdos1: Filesystem type ext* - Last modification time
2026-10-10 13:31:49 Saturday, UUID e8214882-b5d6-4298-a9a1-92aa27f5a282 -
Partition start at 1024KiB - Total size 300000KiB
grub> ls (hd0,msdos1)/
lost+found/ boot/ etc/ home/
grub> ls (hd0,msdos2)/
error: unknown filesystem.
grub> ls (hd0,msdos3)/
error: disk `hd0,msdos3' not found.
grub> set root=(hd0,msdos1)
grub> set prefix=(hd0,msdos1)/boot/grub
grub> ls /boot/
grub/ initrd.img-6.12.48+deb13-amd64 vmlinuz-6.12.48+deb13-amd64

error: unknown filesystem. here is normal: it was the swap partition. Use set on its own to see the current prefix and root, which shows where GRUB was looking.

Reinstall GRUB after booting

On Debian and Ubuntu with BIOS boot, install GRUB to the disk (not a partition) and rebuild the menu:

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

update-grub is a short script that runs grub-mkconfig -o /boot/grub/grub.cfg. On UEFI servers, and on AlmaLinux, Rocky Linux and RHEL, follow how to reinstall GRUB2 from rescue mode: those systems use grub2- commands, and UEFI needs a different procedure from the one above. If the server cannot boot even with the commands above, do the reinstall from rescue mode with chroot, as that article shows.

The grub> prompt: boot by hand

At grub> you have all commands, and Tab completes device and file names. Load the newest kernel and its initramfs from /boot:

set root=(hd0,msdos1)
linux /boot/vmlinuz-VERSION root=/dev/sda1 ro
initrd /boot/initrd.img-VERSION
boot

Use your real kernel version (Tab shows it) and root partition. Once the system is up, run sudo update-grub (Debian, Ubuntu) to write a new menu. To change kernel options from the normal menu instead, see how to change GRUB kernel parameters before booting.

The (initramfs) BusyBox prompt

Debian and Ubuntu 24.04 use initramfs-tools. When it cannot continue, it prints a reason and drops to a small BusyBox shell. The two messages you will meet most, taken from the initramfs-tools scripts on Debian 13, are:

  • The root filesystem on /dev/sda1 requires a manual fsck: the automatic disk check found errors it may not fix alone. The initramfs includes fsck for the root and /usr file systems listed in /etc/fstab. Run it on the device named in the message, answer yes to the repairs, then type exit to continue booting (or reboot):
    (initramfs) fsck -y /dev/sda1
    (initramfs) exit
    Lab example of the same check on a test image with one error:
    e2fsck 1.47.2 (1-Jan-2025)
    /root/sda1.img contains a file system with errors, check forced.
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Inode 15 ref count is 3, should be 1.  Fix? yes
    
    Pass 5: Checking group summary information
    
    /root/sda1.img: ***** FILE SYSTEM WAS MODIFIED *****
    Exit code 1 means errors were corrected. More on the tool: use fsck to repair file system errors.
  • ALERT! UUID=... does not exist. Dropping to a shell!, after "Gave up waiting for root file system device": the disk in root= was not found. Compare cat /proc/cmdline with the UUIDs from blkid (both work at the BusyBox prompt). A changed UUID (after a disk swap or restore) or a missing disk driver are the usual causes. Reboot, press e on the menu entry, correct root=, boot, then fix /etc/fstab and run sudo update-grub and sudo update-initramfs -u -k all.

"Entering emergency mode" (dracut)

AlmaLinux, Rocky Linux and RHEL build the initramfs with dracut, and so does a new Ubuntu 26.04 install: in our test, the Ubuntu 26.04 kernel package recommends dracut first and ubuntu-minimal conflicts with initramfs-tools. Check which one a server has with dpkg -l dracut initramfs-tools. When dracut cannot find or mount the root file system, it prints Entering emergency mode. Exit the shell to continue. and writes a report to /run/initramfs/rdsosreport.txt. Run journalctl to see what failed. The causes and fixes are the same as above. For RHEL-family recovery and emergency targets, see booting into emergency or recovery mode.

Kernel panic: VFS: Unable to mount root fs

The full message is Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) (the numbers can differ). In the Linux source, unknown-block(X,Y) is the device number of the root disk; (0,0) means the kernel found no device at all. The kernel itself understands root=/dev/..., PARTUUID= and PARTLABEL=, but not root=UUID=..., which GRUB uses by default on Debian and Ubuntu. Only the initramfs can resolve that, so a missing or broken initramfs for that kernel is the most common cause. A /boot partition that filled up during a kernel update often leaves one behind (fix a full /boot).

  1. Reboot and open the GRUB menu (on Ubuntu, hold Shift on BIOS systems or press Esc on UEFI systems while the server starts, according to Ubuntu). Choose Advanced options and an older kernel.
  2. Check whether every kernel has a matching initramfs: ls /boot. A vmlinuz-VERSION without an initrd.img-VERSION (Debian, Ubuntu) or initramfs-VERSION.img (RHEL family) is the problem.
  3. Rebuild it for that kernel and update the menu:
    # Debian, Ubuntu (also on Ubuntu 26.04 with dracut)
    sudo update-initramfs -c -k VERSION
    sudo update-grub
    # AlmaLinux, Rocky Linux, RHEL
    sudo dracut -f --kver VERSION
    Lab output: update-initramfs: Generating /boot/initrd.img-6.12.111+deb13-amd64 (first line). Ubuntu 26.04's dracut package ships its own update-initramfs with the same options.
  4. Reboot into the newest kernel. If no kernel boots, run the same commands from rescue mode inside a chroot (see reinstall GRUB2 from rescue mode for the mount and chroot steps).

"Initramfs unpacking failed"

The kernel prints Initramfs unpacking failed: followed by the reason (such as a decompression error) when it cannot fully unpack the initramfs file. According to the kernel source, this is a message, not a panic: boot goes on with whatever was unpacked. If the server then boots fine, rebuild the initramfs anyway; if it stops at (initramfs), emergency mode or a VFS panic, use the steps above. To test an image, list it: a good file lists cleanly, a truncated one fails. Lab example on Debian 13:

$ lsinitramfs /boot/initrd.img-6.12.111+deb13-amd64 > /dev/null && echo OK
OK
$ lsinitramfs /root/initrd-truncated.img > /dev/null
unmkinitramfs: /root/initrd-truncated.img: unexpected EOF

On dracut systems use lsinitrd instead.

Prefer not to do this yourself? Ucartz engineers can repair a server that will not boot through Hire an Expert.

Related articles: how to determine and fix boot issues in Linux, recover missing GRUB2 files from /boot, increase boot log verbosity.

Official documentation: GNU GRUB manual (section "GRUB only offers a rescue shell").

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket