a-d.s

Recovering from deleted /boot/efi (dual boot)

When shit hits the fan.

🚧🏗️🚚HTML WORK AHEAD (i) play pause stop 🚧

"Recovering from deleted /boot/efi (dual boot)" on https://aligot-death.space, available at https://aligot-death.space/wiki/sysadmin/linux/recover-deleted-efi-en


the "/boot/efi" partition used to boot is not exclusive to Linux: it is shared with Windows, and thus you can (and should) provide it to utility tools that fix boot. It is usually on /dev/sda2. You can ls -l /boot/efi from a functioning linux to check its content.

The command to "install" grub requires to provide the disk, not a specific partition (e.g. /dev/sda, not /dev/sda2)

The following lines are a crude hint, the full operation might require some other mounting.

First, create a live USB/CD system, and boot on it.

Then we mount the dead system to be able to work with it:

1 for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B /mnt$i; done

And we chroot to act as if we were on the dead system:

1 chroot /mnt

Then we mount the EFI partition:

1 mount /dev/sda2 /boot/efi

And finally we execute the "grub-install" command: The bootloader-id argument will be the name appearing in the EFI boot list if you go to the boot menu. Type the following command very carefully, a lot of people online seem to have errors simply due to typos:

1 sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck --debug /dev/sda

You may eventually do (once you left chroot with exit like any shell instance):

1 update-grub

contact

contact

Support

Ko-fi