Ubuntu – Removed UEFI partition, how to fix a new one


I just upgraded my XPS 13 laptop from Ubuntu 14.04 to 16.04. I wanted to use full disc encryption, so I chose to let the installer delete everything and install in an encrypted LVM. My laptop show me a message saying it can't find a boot option, something I now understand is because i deleted my /efi partition. I was unaware that there was such a thing as a UEFI partition, and i would like to restore it/create a new one but have NO idea how to do it in the easiest way. It works to use the legacy boot option, so the installation is working just fine as it is, it is just annoying to be forced to use the boot menu when starting the computer

I really don't feel like restore the 14.04 with the Dell tools and reinstall everything since i have not been able to get things such as swap work for encrypted computers without using the option to go full disc encryption in the installer. Would it maybe be possible to install the Dell restore disc along side 16.04, and then just delete it, let the /efi partition alone and reclaim the disc space into the 16.04 LVM.

As might be evident from my post, I am still very much a (happy) linux newbi

Best Answer

If you've got sufficient free (unallocated/unpartitioned) space on the disk, you can use GParted, parted, gdisk, or other tools to create a new partition in that space. The partition must:

  • Be big enough -- I recommend 550 MiB or a bit more, but significantly smaller than that can work.
  • Use a FAT filesystem, preferably FAT32 (a really small partition would need FAT16, though).
  • Have the type code for an EFI System Partition (ESP), which is identified as having a "boot flag" in GParted, parted, and other tools based on libparted; or as having a type code of EF00 in gdisk.

Note that if you don't have sufficient unpartitioned space on your disk, you'll need to shrink an existing partition. Depending on how your partitions are set up, this could be a tricky task. This question and its answer covers this task. If you need more help, I suggest you post a new question, but be sure to include partitioning and LVM details, since there are so many variables related to these details that a meaningful answer without them will be impossible.

Also, creating the partition is not sufficient; it must also contain a boot loader, and the firmware must be configured to boot that boot loader. There are many ways to set this up, but the two easiest are:

  • Run Boot Repair on the computer. This must be done from an EFI-mode boot, so you'll need to boot from an installation or emergency disk in EFI mode, which can be tricky to do if you don't understand the details of how your computer manages its boot modes.
  • Install my rEFInd boot manager on the computer. The best way to do this is to boot your normal installation using rEFInd on a USB drive or CD-R (download links for both are available on the rEFInd downloads page) and then install rEFInd via the Debian package or PPA.

You should need to do one of the above two things (or any of many other things that will have similar end results); however, if one doesn't work for you, you can either try to debug it or try the other approach.