47

TL; DR How do I create an EFI system partition from scratch? How do I put the EFI firmware on it onces it is created?

Long version

I hava Toshiba T430 laptop. I received it with Windows 7 installed (but I think originally it has shipped with Windows 8). I installed Ubuntu on it, but deleted some partitions on the disk so that I ended up wiping out the Windows and only having Ubuntu. Among the deleted partitions was the EFI System partition. I discovered that Ubuntu now boots in Legacy mode (and not UEFI). I am trying to follow this guide on converting my Ubuntu installation from Legacy to UEFI. The problem - since there is no EFI partition whenever I choose from BIOS to boot using UEFI I cannot boot. That counts not only for the harddrive, but usb and DVD as well. I think this is logical - it expects an EFI partition and since it can't find it, it cannot continue booting futher, be it from HDD or DVD. So how do I recreate the EFI partition?

The guide above says:

Creating an EFI partition

If you are manually partitioning your disk in the Ubuntu installer, you need to make sure you have an EFI partition set up.

  1. If your disk already contains an EFI partition (eg if your computer had Windows8 preinstalled), it can be used for Ubuntu too. Do not format it. It is strongly recommended to have only 1 EFI partition per disk.

  2. An EFI partition can be created via a recent version of GParted (the Gparted version included in the 12.04 disk is OK), and must have the following attributes:

    1. Mount point: /boot/efi (remark: no need to set this mount point when using the manual partitioning, the Ubuntu installer will detect it automatically)

    2. Size: minimum 100Mib. 200MiB recommended.

    3. Type: FAT32

    4. Other: needs a "boot" flag.

I had some trouble creating this partition:

  • I boot from a live Ubuntu DVD, open GParted, create a 200MB partition and format it to FAT32.
  • In GParted I cannot set the mount point and thus cannot set the bootflag.
  • I didn't set the mount point in /etc/fstab since it's a live CD and fstab looked quite differently from what I expected compared to a normal boot. Anyway, I just didn't know what values to set.

I booted again via the live DVD and then chose to install Ubuntu. I then created a partition with the mentioned criteria - mount point, 200MB, FAT32, boot flag.

However, I continue to have this problem and I suppose it's because on that partition there is no EFI firmware, it's just an empty partition, which is suitable to have EFI firmware.

So again, how do I create an EFI partition, which has the EFI software, so that the laptop can once again boot in UEFI mode?

SOLUTION Thank you both for the answers. What I did was install Windows 8.1 from scratch by formatting the whole disk and then installing (this time properly) Ubuntu next to it. These are my partitions now:

Disk partitions

During the Win 8 setup, as soon as I deleted all existing partitions and let Windows reformat the disk, it automatically created, besides the main install partition, three additional partitions, namely 1, 2, 3. Now, after I had a proper ESP, I could boot both from HDD or DVD in UEFI mode.

You say that the ESP doesn't store any info by default, but I guess that when an OS installs, it puts some info there. So I guess my case was the following: I had wiped it out and even though I recreated it, it was not filled with any info, since the creation of the ESP was done after an OS had been installed. I lost the Ubuntu installation (no big deal, it was a fresh install anyway), but I guess that in order to save it, I should have followed grawity's advice. Didn't have time, though, but happily everything is fine now.

2
  • 1
    The ESP stores boot loaders. Thus, if you've got an existing installation and delete the ESP, you'll lose the ability to boot the computer. This type of problem is actually fairly straightforward to fix -- IF you know how!
    – Rod Smith
    Jun 9, 2014 at 1:08
  • Well was all what my question was about :) Jun 9, 2014 at 4:48

5 Answers 5

49

First, you don't set the mount point in GParted; that's done manually (and temporarily) via the mount command or permanently by editing /etc/fstab. Thus, your concern over this issue is misplaced.

Second, an EFI System Partition (ESP) is simply a FAT partition with a particular type code (namely, C12A7328-F81F-11D2-BA4B-00A0C93EC93B on GPT disks) set. Note that the mount point in /etc/fstab is not part of the ESP's definition; it's just conventional (but not required) in Linux to access the ESP by mounting it at /boot/efi, typically via an /etc/fstab entry. How you set the type code varies from one program to another:

  • In gdisk, you set the type code to EF00. (gdisk uses two-byte type codes that expand out to the real type codes on the disk; "EF00" is just a mnemonic for "C12A7328-F81F-11D2-BA4B-00A0C93EC93B".)
  • In GParted or parted, you set the "boot flag." Note, however, that this works only on GPT disks; you cannot set the ESP type code on MBR disks with these programs. (This isn't normally a big deal, since EFI-based computers usually boot from GPT disks.)
  • In the Ubuntu installer, you identify the partition as an "EFI boot partition." It then sets the type code and will set up /etc/fstab appropriately.
  • In recent versions of Linux fdisk, you set the partition type by its number (1 for "EFI System" on GPT disks or 0xEF on MBR disks) or by entering the full type code on GPT disks.

Third, the ESP does not hold firmware -- firmware is, by definition, stored in chips on the motherboard. Thus, your effort to install the EFI firmware on the ESP is a wild goose chase. (There are two exceptions to this rule. First, you might store a firmware file on the ESP in order to update the firmware on your computer. This is just a temporary holding area, though. Second, the DUET or Clover boot loader, the EFI is loaded as a regular program, typically from the ESP. These tools are BIOS boot loaders, though, that enable BIOS-only computers to boot as if they were EFI machines; they are not normally used on computers with EFI firmware, which you claim your computer has. Technically, neither DUET nor Clover is firmware; they're BIOS boot loaders that do the same job as EFI.)

Finally, I can think of a number of possible causes for your problem, but without further information, I'd need to write half a book to cover them all. I recommend you run the Boot Info Script on the computer. This will produce a file called RESULTS.txt. Post it to a pastebin site and post back with the URL to your document. That will give hard data on your configuration, which will greatly reduce the range of possible causes of your problem.

4
  • 2
    How to use gdisk to "set the type code to EF00"?
    – B Seven
    Dec 27, 2014 at 22:38
  • @BSeven t, 1, ef00.
    – hobbs
    Mar 9, 2015 at 6:11
  • In gparted, which partition name and which label do you give to the EFI partition?
    – user1236854
    Mar 16, 2022 at 12:43
  • The partition name/label is irrelevant, from a technical point of view, since that field is meant to help you as a human identify the purpose of a partition. You can call the ESP whatever you like. What's important for machine functioning is that the type code is set correctly, as outlined in the answer.
    – Rod Smith
    Mar 17, 2022 at 13:19
14

The EFI partition doesn't keep firmware (which is stored in a chip on the motherboard); it keeps the boot loaders for installed operating systems. It is basically the EFI alternative of putting the boot loader in the 0th sector of your disk, as was the case with BIOS PCs.

This means that once you have such a partition, it should get filled automatically when you install the operating system. (Quite likely though that the install disc itself must be booted in EFI mode, too, otherwise it won't bother setting up UEFI boot... in fact, certain parts of the setup can't even be done from BIOS mode.)

If you already have Ubuntu installed, you'll need to:

  1. Install the UEFI version of GRUB; I think it is in the grub-efi-amd64-signed package.

    grub-install --target=x86_64-efi-signed
    

    (For the unsigned grub-efi-amd64 version, it's x86_64-efi.)

  2. Ensure that GRUB has installed itself as \EFI\Boot\bootx64.efi in the EFI system partition. (I'm using the EFI path syntax here; if you mount the partition at /boot on Linux, it would be /boot/EFI/Boot/bootx64.efi.)

    If it hasn't, copy grubx64.efi manually to that location.

    This is necessary because grub-install cannot add itself to the EFI boot menu unless the system has already booted in EFI mode. (The "EFI variables" are impossible to access in BIOS moed.) Therefore the only way to boot GRUB is by putting it at the "fallback boot loader" location.

  3. Reboot. Try to select some kind of EFI mode in your firmware's boot menu (EFI firmwares have a boot menu of their own, even before GRUB).

  4. Check if dmesg | grep "efi:" shows anything, to confirm that you're in EFI mode.

3
  • 1
    I don't mean to bring up an old thread, but I'm trying to find a solution to my problem and came across this thread. I'm trying to update the BIOS firmware on my Dell computer and Dell provides it as EXE in Windows format or some file that one should put on an EFI formatted partition. i.e., I'm asked to "Download the file to the EFI partition on a removable media device." I don't know if the OP meant this, but just wanted to point out what you said in your first paragraph.
    – Ray
    Mar 1, 2019 at 4:00
  • @Ray: You're downloading the future firmware into this partition. It's still not used as actual firmware when you turn on the computer; it's merely used as a datafile for the "firmware updater" program that'll be writing/flashing it into the motherboard. (Remember when such instructions used to say "download the file to a MS-DOS bootable floppy disk" or something? Well, that disk didn't hold your main BIOS either. It just held the reflashing program and the data it's supposed to flash. Same here.) Mar 1, 2019 at 5:27
  • 1
    Yes, I know. I guess I'm just saying that the OP may not have been necessarily wrong, but just imprecise. Likewise, you're right that firmware is stored on the chip and now I'm being asked to store a future firmware on the EFI partition. But, someone could say that firmware is stored in the EFI if they are careless with their description. (i.e., not completely wrong but half wrong)
    – Ray
    Mar 1, 2019 at 6:35
2

Create two files with notepad and save them to your USB Windows install drive.
SaveAs: CreatePartitions-UEFI.txt

select disk 0
clean
convert gpt
rem == 1. System Partition  =====================
create partition efi size=210
format fs=fat32 quick label="SYSTEM"
active
rem == 2. Microsoft Reserved (MSR) partition  ======
create partition msr size=16
rem == 3.  Windows partition  ===================
create partition primary size=xxxxxx
format fs=ntfs quick label="Windows"
assign letter="W"
rem == 4. Recovery tools partition  ================  
create partition primary size=460
format fs=ntfs quick label="Recovery"
assign letter="R"
list volume

Create another text file with Notepad:
SaveAs: diskpart-UEFI.txt

diskpart /s D:\CreatePartitions-UEFI.txt   

REM where D:/ is the usb drive. This command runs the text file to install the partitions.

If you are using MBR the command will be, convert mbr.

To get the size of the Windows partition, Multiply your HD size times 1024, a 100 gig hard drive times 1024 equals 102400 minus 210 (efi size) minus 16 (msr size) minus 460 (reserved size) equals the size you will put in the Windows partition size. (xxxxxx)

You can change the partitions size from the terminal (Command Prompt) cd /d D: > notepad CreatePartitions-UEFI.txt

While you are in the USB drive open with notepad diskpart-UEFI.txt and leave open or write the command down so you will not make a mistake. Once you have change the size of the partitions to your liking,close it, then cd /d x:/Sources then run the diskpart /s D:\CreatePartitions-URFI.txt.
list volume as the last command shows you the partitions, if happy, exit > turn off computer > restart > install

0

I bought a second-hand Lenovo T590, installed with Windows 11.

I wanted to install Ubuntu 22.04.3 into the notebook as dual boot system.

To my surprise, Ubuntu cannot detect the Windows OS and the error message was "No EFI System Partition Found".

After some research, I realized my Windows 11 was installed using Legacy BIOS mode. It seems the popular Ubuntu and Mint cannot easily support dual boot with Legacy BIOS mode. I have to somehow create an EFI System Partition.

The solution I found is not to "create" an EFI System Partition. However it is to use mbr2gpt.exe command to convert MBR to GPT in Windows.

The so-called convertion is surprisingly fast and simple. Execution of mbr2gpt.exe is less than 5-10 seconds for my case.

Refer to [Convert an existing Windows 10 Installation from Legacy BIOS to UEFI] https://answers.microsoft.com/en-us/windows/forum/all/convert-an-existing-windows-10-installation-from/aa8c2de3-460b-4a8c-b30b-641405f800d7

Following the instructions in the link, mainly:

Pre-requisites:

  1. The MBR disk must have at most 3-partitions.

    In Windows 11, I use Disk Management to check out my existing disk partition.

    I have the following:

    • 100MB MBR System Partition
    • C Drive
    • 625MB Recovery Partition
    • D Drive

    For my case, I delete D Drive partition so the harddisk only has 3-partitions.

  2. Bitlocker or encryption must be turned off.

    Bitlocker is not on by default, so this requirement will pass.

Step 1: Boot to the Recovery environment

The idea here is to reboot the computer into Windows Recovery mode with Command Prompt.

System > Recovery > Windows Recovery > Advance startup > [Restart now]

After restarting, choose the option where we can get to Command Prompt.

Step 2: Validate if the MBR2GPT tool can convert your disk

On the Command Prompt Window, execute mbr2gpt.exe /validate

Step 3: Convert the disk

On the Command Prompt Window, execute mbr2gpt.exe /convert

That's it. EFI System Partition is created.

-1

use gnome-disks , package "gnome-disk-utility", it is super handy.

2
  • 2
    Welcome to Super User! I'm not the DV-er, but while one line answers can sometimes work, but if you edit your answer to include an explanation it would work better :) How would they create an EFI system partition in gnome-disk-utility.
    – bertieb
    Nov 9, 2018 at 19:46
  • this answer for me helped and was the easiest. I had created a fat32 500mb partition at the beginning of the disk and labeled it boot using gparted, but the linux installer wasn't accepting it. In Gnome Disks, I clicked the partition, clicked the gear icon, edit partition, and selected EFI (FAT 12/16/32) (0xef). I restarted the installer and it accepted the partition Feb 16, 2021 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .