this may sound stupid and appear to have a bunch of duplicates but I have spent almost 3 days looking for a solution without look, see, I accidentally issued a mkfs.xfs command on /dev/sda2 instead of /dev/sdd2 and completely wiped my /boot partition (along with all vmlinuz and initrd files), and so I tried the standard recovery method from live media (with a few changes since my system was installed with LVM partitions and in EFI mode):
mkdir /mnt/fedsys
mount /dev/fedora/root /mnt/fedsys
mount /dev/sda2 /mnt/fedsys/boot
mkdir /mnt/fedsys/boot/efi (I had to create a new efi dir since it was lost)
mount /dev/sda1 /mnt/fedsys/boot/efi
mount --bind /proc/ /mnt/fedsys/proc
mount --bind /sys/ /mnt/fedsys/sys
mount --bind /dev/ /mnt/fedsys/dev
chroot /mnt/fedsys
It worked fine up until here, then I tried regenerating the grub.cfg file:
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
However it fails with the following messages:
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
device-mapper: reload ioctl on osprober-linux-sdd1 failed: Invalid argument
Command failed
done
I then ignore the errors and proceed to install grub:
grub2-install /dev/sda
And it gives the following output:
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
Installation finished. No error reported.
And when I reboot I am greeted with the grub prompt. Now, I think the problem lies in the fact that either vmlinuz nor initrd are anywhere to be found (of course, because I nuked /dev/sda2) but I can't find a way to either rebuild them or make the system boot.
What can I do? Is there a way to rebuild those files from live media? The system I'm trying to rescue was running Fedora 25 64 bits on EFI mode and on LVM.