I have run into this situation by doing several silly thing in a row.
It all started when I made distribution upgrade from 17.10 to 18.04. The machine is dual-boot with Windows 8, and there was secure boot activated on the machine (ASUS X75A laptop). After the upgrade was complete and the computer rebooted, I accidentally pressed "Continue to boot" instead of "Enter MOK" or something similar. It did not continue to boot, however, regardless of how many time I restarted it. I even got the password right, but since the second boot there was no option to "Enter MOK" or so, I could just "enroll keys from disk" (which I supposedly don't have?).
So I decided to reinstall grub, but most stupidly used the old 16.04 Lubuntu alternate iso disk to do that (it was the disk from which the system was installed once, later upgraded to 17.04 and then to 17.10). Installation of grub failed, of course.
Then I burned 18.04 disk and tried again with no success. I tried rewriting the partition table from testdisk, changing EFI partiition type from "Microsoft data" to "EFI", with no gain. It even showed linux partition as "Microsoft data", oddly enough, of "ext4" type (which is correct).
Then I tried chrooting in rescue mode, removing grub and installing grub-efi, with no success: it complained about missing /usr/lib/grub/i386-pc/modinfo.sh (that's grub-efi). I tried to follow advices of purging grub manually and then installing grub-efi, but the error persisted. I then tried to install grub-pc, which gave me the best results so far - grub rescue shell prompt. I didn't like it so, though (silly me), and after some other efforts decided to reinstall lubuntu from scratch, leaving windows partitions untouched (if possible). Installation freezed at update-grub in the very end, and the machine is not bootable by now ("Insert appropriate boot media and press any key" message after turning on); also, BIOS menu (opened after F2 is hit right after reboot) doesn't show any boot option connected with HDD. Next time during the rescue mode chroot session update-grub ran smoothly, but the picture after reboot is the same.
Then I read about gdisk and launched it from Knoppix, but is showed that the partition table is OK (GPT with MBR):
GPT fdisk (gdisk) version 1.0.1
Type device filename, or press <Enter> to exit: /dev/sda
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 747C0D94-3D8A-9C4A-A47B-40714820931D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2029 sectors (1014.5 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 616447 300.0 MiB EF02
2 616448 1845247 600.0 MiB 0700
3 2107392 391895039 185.9 GiB 0700
4 391895040 392816639 450.0 MiB 0700
5 392816640 926996479 254.7 GiB 8300
6 926996480 934809599 3.7 GiB 8200
7 934809600 976773119 20.0 GiB 0700
8 1845248 2107391 128.0 MiB 8300
Then I also ran testdisk again, and this is shown:
TestDisk 6.14-WIP, Data Recovery Utility, September 2012
Christophe GRENIER <[email protected]>
http://www.cgsecurity.org
Disk /dev/sda - 500 GB / 465 GiB - CHS 60801 255 63
Partition Start End Size in sectors
>P MS Data 13960 628359 614400 [NO NAME]
P MS Data 660424 666597 6174 [Boot]
P MS Data 1109040 1115213 6174 [Boot]
P MS Data 1659760 1665933 6174 [Boot]
P MS Data 1845247 3074046 1228800
P Mac HFS 42763530 42978641 215112
P MS Data 61659936 61666109 6174 [Boot]
P MS Data 61842568 61848741 6174 [Boot]
P MS Data 63305686 63326424 20739 [NO NAME]
P MS Data 73289656 73295829 6174 [Boot]
P Mac HFS 118840118 246439479 127599362 [~X^D]
P MS Data 366007096 366013269 6174
Structure: Ok. Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
P=Primary D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
Enter: to continue
FAT32, blocksize=4096, 314 MB / 300 MiB
Actual contents of partitions are the following:
sda1: EFI
sda2: MS Windows Recovery
sda3: MS Windows main
sda4: ??? (something from Windows probably)
sda5: Lubuntu /
sda6: Linux swap
sda7: ASUS things (?)
sda8: Lubuntu /boot
PLease, can anyone suggest anything except for complete repartitioning of the disk? Backups have been made, files copied from linux and Windows partitions dd'd.