This is high on Google, but all of the other answers seem only partially complete, at least for someone in my situation.
My computer has now twice (and more to come, knowing my luck) lost awareness that my Debian 8.2 installation exists. This might somehow be caused by a bug in my UEFI firmware and/or my use of a SATA slot that doesn't officially exist... or maybe some program is interfering with the partition, or the SSD itself is suspect... I dunno.
Anyway, the first time, I was so early in the process of getting everything set up - that I just reinstalled altogether. That fixed it. But it did feel a bit sledgehammerish.
This time around, that isn't an option. I've invested too much time in my configuration!
Today, my more diagnostic approach indicated that (at least this time) the cause was not - or not only - the firmware 'forgetting' the EFI partition existed - but also said partition had somehow gotten corrupted. Again, I can't explain this: it may be a shoddy firmware, unrelated filesystem horror, or something else entirely. I just have to deal with it, I guess.
The symptoms were:
- My UEFI was suddenly totally unaware the
debianEFI boot partition existed - The handy
efibootmgrnow reported the disk as ye olde BIOS type, not EFI - I couldn't just
mountas/boot/efisince... - ...the trusty
fsckcomplained about the boot sector being different from the intention/backup and a corrupted root FAT node (dat lingo) or something - Pretty much everything was stuffed, overall, is what I'm saying.
So, here's a full and reasoned list of what I did to fix it (for now?):
- downloaded the exciting rEFIt @ http://refit.sourceforge.net/
- used the quality Win32 Disk Imager a.k.a. "unamed sequel" @ http://sourceforge.net/projects/win32diskimager/ on a borrowed PC to write rEFIT to a USB pen drive
- which brought the very welcome news that my
/partition was still intact - booted said partition
- reformatted the errant EFI partition as
mkdosfs -F 32 /dev/sdXN- substitute your ownKNAME- and avoid them in anything except transient runtime situations because they're asking for trouble if disks are shuffled - reinstalled GRUB to the newly formatted partition by
grub-install /dev/sdXN - rebooted from my resurrected EFI partition - stuck in rescue mode because it was still filed in
/etc/fstabby its old UUID, causingsystemdto fall over on dependencies - rewrote
/etc/fstabto refer to the/dev/disk/by-id/ata-EVILCORP-C3PO-partNpathtype paths for all disks - since (A)KNAMEis risky and (B) UUIDs change if you suddenly have to reformat, like poor me... - magically returned to the adequacy of a normally bootable Debian. for now.
As they say, "until next time" - perhaps literally. Maybe this will help some other lost soul, frantically searching Google on some failing borrowed PC.