Covers chroot setup from a live environment, GRUB reinstall, and kernel recovery for when boot fails but the root filesystem is intact.
3.2 KiB
EFI Partition Repair
Table of Contents
Overview
Use this procedure when a Debian machine fails to boot but the root filesystem appears intact — for example after a failed kernel upgrade, a corrupted EFI partition, or GRUB being wiped by another OS. Boot from a live environment, chroot into the installed system, and reinstall GRUB.
Placeholders
Replace the placeholders below with the appropriate values for your setup:
-
Devices
- Disk:
<disk>(e.g., /dev/sda, /dev/nvme0n1) - EFI partition:
<efi-part>(e.g., /dev/sda1, /dev/nvme0n1p1) - Root partition:
<root-part>(e.g., /dev/sda2, /dev/nvme0n1p2)
- Disk:
-
Filesystem
- Root subvolume name:
<root-subvol>(e.g., @rootfs)
- Root subvolume name:
Repair Procedure
1. Verify What You're Working With
Identify the disk layout, partition types, UUIDs, and current mount points:
lsblk -o NAME,SIZE,FSTYPE,PARTTYPE,UUID,MOUNTPOINT
Confirm which partition is EFI and which is root before proceeding.
2. Mount Everything for Chroot
Mount the root filesystem
mkdir -p /mnt
mount -o subvol=<root-subvol> <root-part> /mnt
Mount the EFI partition
mkdir -p /mnt/boot/efi
mount <efi-part> /mnt/boot/efi
Bind mount the pseudo-filesystems
mkdir -p /mnt/{dev,proc,sys,run}
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /run /mnt/run
Bind mount EFI vars
Required for grub-install to write boot entries to the firmware:
mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
3. Chroot In
chroot /mnt /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"
4. Reinstall GRUB
Run grub-install on the disk
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck <disk>
If you get an error about EFI vars not being writable:
mount -o remount,rw /sys/firmware/efi/efivars
Then re-run grub-install.
5. Regenerate GRUB Config
update-grub
Check the output — it should find your kernel on the btrfs volume. If it complains about not finding a kernel, you may need to also reinstall it:
Check what kernel is installed
dpkg -l | grep linux-image
Reinstall the kernel if missing or broken
apt-get install --reinstall linux-image-amd64
Then re-run update-grub.
6. Verify fstab
Confirm the EFI and root entries look correct before rebooting:
cat /etc/fstab
7. Exit and Reboot
Exit the chroot
exit
Unmount everything
umount -R /mnt
Reboot
reboot