how to restore a non booting grub bootloader
# This method requires you to boot into your Linux install first.
# On BIOS systems (sdX is the device where grub is installed)
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --target=i386-pc /dev/sdX
# On EFI/UEFI systems (the bootloader id can but adjusted to suit your distro)
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS-grub