My problem is solved: I recovered my system as it was before the problem.
For those having the same problem as I had (EFI partition formatted but all other partitions intact), you should first have an Ubuntu live-USB. Once you have it, here is exactly what to do (check out also the links at the end of this answer):
1. Read the following docs to know the necessary about EFI partitions:
https://en.wikipedia.org/wiki/EFI_System_partition
https://help.ubuntu.com/community/UEFI#Creating_an_UEFI_partition
2. Make sure the boot mode of your computer is UEFI: Access you BIOS settings (if on a Dell computer, press F2 before startup), and make sure the UEFI boot is enabled (and Legacy mode disabled).
3. Boot your Ubuntu live-USB, select "Try Ubuntu without installing" in the grub menu. Once on the desktop, verify that you effectively booted in UEFI mode by running the following command in the terminal:
[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
This should output Legacy boot on HDD
. It is important to boot the live-USB in UEFI mode, because we use Boot-Repair in a following step. Boot-Repair can regenerate automatically the EFI files that were deleted from the EFI partition when it was formatted, as from my understanding, but the live-USB from which you use it should have booted in UEFI.
From this point it will be a good habit to take screenshots of your partitions and of the messages you get from the different utilities.
4. Format the EFI partition to fat32: Open GParted; make sure you identify the partition that used to be your EFI partition (normally mounted as /boot/efi
; it was 500MB-large on my install); right click on the partition in the lower part of GParted's window and choose to format to fat32. Apply this change. Then, make sure this partition has the "boot" and "esp" flags (if not, you can set them with a right click on the partition, then apply the change).
5. Install and run Boot-Repair: First read the Boot-Repair doc. Then install Boot-Repair (using the commands indicated in this doc). Once Boot-Repair is opened, it is advised to do the "Recommended repair", though it didn't work in my case: it ended by a Please create a BIOS-Boot partition
message, as if it did not recognize that the UEFI boot mode was on. Instead, I simply went to the "Advanced options" of Boot-Repair, then in the "GRUB location" tab, I found a box called "Separate /boot/efi partition: (select a partition)". I checked this box with verifying that the selected partition was the EFI one, and left all the other options as they were. Then I applied the repair. Accept to create a BootInfo report and to post it into a pastebin (note well the link to this pastebin, just in case).
After that, a reboot should show you a GRUB, from which to access your previous install.
Useful/Related posts
Note: In the OS-Uninstaller doc, there should be a warning with an invitation to verify that the partition found by OS-Uninstaller as the one to format is not shared with another installed OS. In my case, to uninstall Windows, OS-Uninstaller proposed automatically to delete the content of my EFI partition, while it was also used by my linux install. All of this happened because I trusted the ability of OS-Uninstaller to do what was needed.
/dev/sda1
to FAT32 + boot flag in GParted? Could you please tell me in detail how to do it once I open GParted? I want to avoid any more mistakes. And if this doesn't work you suggest using Boot-Repair, right? Could you please explain in details how to proceed with Boot-Repair? – Giuseppe Aug 03 '18 at 16:35Please create a BIOS-Boot partition
(same message as in this question). Could you please tell me in detail what to do now? I have read some posts suggesting to copy a file namedbootx64.efi
to that partition, but I am not sure what to do... – Giuseppe Aug 05 '18 at 20:24