1

I had a dual boot Ubuntu/Windows 8, and I wanted to remove Windows for good. I backed up both my Ubuntu and Windows data.

I decided to use OS-Uninstaller, so I booted a Ubuntu 18.04.1 live-USB and proceeded to the removal of "Windows (/dev/sda1)".

The OS-Uninstaller process ended with an error message saying

"An error occurred during uninstallation"

Before exiting this live session, I backed up the output of a dmesg command (I can post it if it helps).

Then I rebooted, expecting my installed Ubuntu to start. Instead, a black screen appeared with the message

"Invalid parition table!"

I just pressed shortly the switchoff button of my computer and it switched off. Then I rebooted a live session to use boot-repair. I didn't execute the "Recommended repair", I just produced the report (I can post it if needed).


EDIT: After some reading, I realize that the problem is that /dev/sda1 was my /boot/efi partition. It has apparently been formatted to ntfs, but the other partitions, especially the Ubuntu partitions, seem untouched. Is it possible to restore this /boot/efi partition? Should I try first the "Recommended repair" of boot-repair?


Could you please help me to have my Ubuntu boot as before? I know there is this post, but I am not sure what to do in my case and I am afraid to screw something up even more.

Giuseppe
  • 187
  • 1
    Best to file a bug report with os-uninstaller. It may only be valid for BIOS/MBR configurations. Change sda1 type back to FAT32 with boot flag using gparted/parted/Disks or gdisk. If you just change type it may still have /EFI/ubuntu folder. If not use Boot-Repair to totally reinstall grub which will recreate UEFI entries. Boot-Repair will not add or change partition info. – oldfred Aug 03 '18 at 16:10
  • Thank you very much. Do I understand well that I should first reformat /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:35
  • 1
    It looks like it now is difficult to just change type & it probably was erased when changed. So just use gparted, make sure partition is unmounted and change format to FAT32 and right click to add boot flag and/or esp flag. Then use Boot-Repair - see details on advanced mode for full reinstall of grub: https://help.ubuntu.com/community/Boot-Repair – oldfred Aug 03 '18 at 19:41
  • @oldfred I did exactly this: using GParted I formatted /dev/sda1 to FAT32, and made sure the "boot" and "esp" flags were set to it. Then I rebooted, and I did the "Recommended repair" of Boot-Repair. It ended saying Please 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 named bootx64.efi to that partition, but I am not sure what to do... – Giuseppe Aug 05 '18 at 20:24
  • 1
    You do not want bios_grub partition. That is for BIOS boot using gpt partitioned drive. You need to reboot Ubuntu live installer in UEFI boot mode. Then add Boot-Repair so it can install the UEFI version of grub2. – oldfred Aug 05 '18 at 21:53
  • @oldfred But this is what I did. I first made sure UEFI was enabled in my BIOS parameters (and that Legacy mode was off). Then I booted the live-USB in UEFI mode (in the boot menu, the live-USB is referred to by "UEFI: PMAP"). So what can I do more to make sure Boot-Repair installs the UEFI version of grub2? – Giuseppe Aug 06 '18 at 08:02
  • @oldfred I realize you answered also to my question on Ubuntu Forums, thanks a lot :). You can just answer there and I will post here the link to it when my problem is solved. – Giuseppe Aug 06 '18 at 08:06

1 Answers1

2

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.

Giuseppe
  • 187