Fixing a Broken GRUB2 Configuration After a Failed Update
A kernel update left the system unable to boot into any menu entry, or grub-mkconfig fails outright. Here's how to regenerate a working configuration from a rescue environment.
A GRUB2 configuration corrupted by an interrupted update — or one that simply references a kernel/initrd pair that no longer exists — needs to be regenerated from a working environment, not hand-edited entry by entry.
Step 1: boot from a live USB/rescue image
Any Linux live environment matching your system’s architecture works for the repair steps below.
Step 2: identify and mount your root partition
lsblk
mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot/efi # if using UEFI with a separate ESP
Step 3: chroot into the installed system
for d in dev proc sys; do mount --bind /$d /mnt/$d; done
chroot /mnt /bin/bash
This makes the installed system’s own tools (its specific GRUB version, its specific kernel packages) the ones doing the repair, rather than mismatched tools from the live environment.
Step 4: regenerate the GRUB configuration
grub-mkconfig -o /boot/grub/grub.cfg
On Debian/Ubuntu-based systems, update-grub is a wrapper around the same command.
Step 5: reinstall the GRUB bootloader itself
grub-install /dev/sda
For UEFI systems, this instead targets the EFI System Partition rather than a disk device directly — confirm you’re using the correct invocation for BIOS vs. UEFI boot mode.
Step 6: verify the configuration actually lists valid kernels
grep -A1 "menuentry" /boot/grub/grub.cfg | grep vmlinuz
ls /boot/vmlinuz-*
Confirm every kernel referenced in the generated config file actually exists on disk — a config referencing a removed kernel version means the underlying package state, not GRUB itself, needs cleanup first.
Step 7: clean up orphaned kernel packages if that’s the underlying cause
dpkg --list | grep linux-image # Debian/Ubuntu
rpm -qa | grep kernel # RHEL/Fedora
Remove genuinely orphaned old kernel packages, then regenerate the GRUB config again — this prevents the same broken-reference problem from recurring.
Step 8: exit the chroot and reboot
exit
umount -R /mnt
reboot
Why regenerating beats hand-editing grub.cfg
grub.cfg is an auto-generated file, built from templates in /etc/grub.d/ and the actual installed kernel packages — hand-editing it directly fixes the symptom for exactly one boot, since any future kernel update or grub-mkconfig run overwrites your manual changes. Fixing the underlying package state and regenerating properly is the only change that survives the next update.