I want to clean a computer to a near-pristine state with Windows 10 after having tried Ubuntu 18.04 on it. I have all the overall procedure under the belt.

The last detail is that the boot loader still sees an ubuntu entry. This is because there is a legacy EFI/ubuntu directory in the EFI partition. I would like to clean that too.

Windows installer, and expectation

When reinstalling Windows I don't want go as far as making a new user profile though.

I understand from the discussion in Completely remove Ubuntu from Windows 10 PC that, even when you proceed with the repair mode in Windows installer, that that EFI directory will survive. To remove it you need to act from a user profile using dedicated commands. This is another guided tour I bumped in: https://www.makeuseof.com/tag/delete-boot-menu-options-windows/ My first option is to avoid this avenue.

Ubuntu installer, and questions

Likewise, before reinstalling Windows 10, I can use the Ubuntu Live USB to mount and manipulate the EFI partition. Simply sudo rm -rf EFI/ubuntu from the terminal would clean that directory (repeat: not partition).

The questions are:

  • Is that safe and in which way it is not?
  • Are there, for example, other files in the EFI partition keeping the books of the contents and potentially throwing exceptions down the line? There is another directory EFI/BOOT, for example, containing BOOTX64.EFI and fbx64.efi.

    Or would the boot loader and the future Windows 10 splash into and roam around EFI/windows, insouciant of what its siblings are/were?

  • If this perhaps safer using a better command than rm ...?

Do-nothing versus Do-nothing-harmful

I am aware that keeping EFI/ubuntu is no harm. I would know whether removing it is just as much so, and opt accordingly.


Your plan is sound, but please make a backup of this partition first. I'd recommend Clonezilla because of its ease of use.

Is that safe and in which way it is not?

It is safe.

Are there, for example, other files in the EFI partition [...]?

Yes. The EFI/BOOT directory gets special treatment from UEFI - EFI/BOOT/BOOTX64.EFI wil boot by default if no other loaders are configured in UEFI. Both Windows 10 and Ubuntu will drop its files into EFI/BOOT. I'm not sure which set you do currently have, but removing EFI/BOOT entirely should be safe.

If you don't find this method elegant, you can format the partition to FAT32 and recreate it using Windows 10 installation media (Microsoft offers free downloads for those). On the first screen press Shift+F10 to open command prompt, then assign a letter to EFI partition and recreate boot files:

  1. Run diskpart:

    • list disk
    • select disk 0 (or other number listed by previous command, but usually it's 0)
    • list partition
    • select partition 1 (or other number listed by previous command - EFI partition will have type "System").
    • assign letter=a

    EFI partition will be mounted as A:.

    • exit
  2. Recreate boot files:

    bcdboot X:\windows /s A: (installation media is always mounted as X:)

If this perhaps safer using a better command than rm ...?

rm is fine. The nice thing about UEFI is that it uses regular FAT filesystem with regular files - nothing exotic, no hidden sectors etc.

Resources I've used:

  • EFI/BOOT contains BOOTX64.EFI and fbx64.efi only. I checked that they relate to Microsoft with strings [filename] | grep -i microsoft and left them alone --- I have then removed the EFI/ubuntu directory; at the new reboot, it disappeared from the boot list as intended. It worked. Thanks for sparring – XavierStuvw Mar 25 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.