Accidently wiped EFI partition on Pop_OS

I managed to make a pre-coffee error a month ago and wiped my EFI partition. I also was using LUKS to make matters worse. Currently I can see my Pop OS entry when I boot up my laptop, but it doesn’t do anything but reload the list.
I can boot into a live environment with either PartedMagic or PopOS and see my data partition when analysing with TestDisk. I tried using fEFInd from the live environment, but it wouldnt install.
I was going to try DMDE and see what that looks like next.
Mainly, I would like to know am I able to create a new EFI partition and map my installation with a new UUID ?
I’m unsure how to recover this.
I can dd an image of the drive also.
Any guidance is greatly appreciated.

TLDR: Wiped EFI partition. Can’t boot. I see a data partition with TestDisk. Currently unsure how to proceed.

If the ESP is clean, grub-install can write what’s needed to it. There isn’t much, a few megabytes. Once one would have to chroot into the Pop OS and run grub-install from it, but grub-install with --boot-directory and --efi-directory options should to the trick.

If the ESP is not clean, recreate it with gparted as FAT32.

I’ve fixed this a few times, but the process is a little involved - depends how much linux experience you have. Standard warning of potentially dangerous instructions below, make backups before hand.

In essence you just need to boot from a live cd then:

  • Unlock luks (cryptsetup luksOpen /dev/…)
  • Mount root to somewhere (/mnt)
  • Mount /sys, /dev and /proc to respective places in /mnt
  • Mount /boot, recreate efi and mount appropriately in /mnt
  • Chroot into /mnt
  • Reinstall grub and shim (not sure if shim is an ubuntu thing?)
  • If you’re paranoid, reinstall kernel and initramfs, ensure you copy the previous ones before you do!

I’ve mostly done this on many distros except debian/ubuntu/popos. But the instructions I found from google here - repairing boot for LUKS encrypted fs · GitHub - appear to have all the steps I’d expect. (PopOS is based on Ubuntu IIRC? So they should be similar).

Before you start though I’d recommend making a copy of your files first. You can do this once you’ve unlocked the LUKS volume and mounted the LV.

You may also need to create a new efibootmgr entry, or modify the existing one to point at the new EFI partition UUID. However efi has a default boot entry that should make it all just work.

Thanks for the in depth info. I copied my LUKS partition to an img, used testdisk to search for other partitions…
I’ll follow your steps next and report back.