Unable to boot newly installed Ubuntu 16.04 using UEFI mode?

I have a laptop with Ubuntu 14.04 installed in BIOS (Legacy mode).

sudo dmidecode

BIOS Information
    Vendor: Dell Inc.
    Version: A16
    Release Date: 12/05/2013
...
System Information
    Manufacturer: Dell Inc.
    Product Name: Latitude E6410

Instead of upgrading, I tried to install new Xubuntu 16.04 in UEFI mode.

  • Switched BIOS boot from Legacy to UEFI and disabled the RAID for SATA.

    (SoftRAID/FakeRAID corrupt the GPT table backup in the end of disk, on each boot)

  • Booted using USB key in UEFI mode & resized and converted partition table from MBR to GPT.

  • Booted again using USB key in UEFI mode and installed Xubuntu. Created a new boot EFI (FAT32) partition.

On reboot, There is a Ubuntu entry in UEFI menu but selecting it raise a BIOS error message about no boot media.

Tried multiple things but no success:

  • Boot-repair.
  • Change EFI partition to FAT16.
  • Reinstalled Xubuntu.

partition in gparted

sudo sfdisk -d /dev/sda

label: gpt
label-id: 4A4481B5-0322-411E-8D05-552FBE6189AC
device: /dev/sda
unit: sectors
first-lba: 34
last-lba: 976773134

/dev/sda1 : start=     4194304, size=   127924224, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=F1D50A87-ACB2-4868-B1EA-66C3D5223EA4, name="Linux filesystem"
/dev/sda2 : start=   874115072, size=    98463744, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C96E6320-18EA-40B2-BA46-79FC66407917, name="Linux filesystem"
/dev/sda4 : start=        2048, size=      409600, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BCB6E471-44F7-4C42-81EC-B276F1D6B6E6, name="EFI"
/dev/sda5 : start=   154339328, size=   715456512, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=AEBBA3F2-F8B6-40C0-ABFE-9F530FC5F641, name="Linux filesystem"
/dev/sda6 : start=   136513536, size=    17825792, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=515C9B77-B282-4007-8F1A-B0C5D908591E, name="Linux swap"

Solution 1:

Finally, I got it to boot in UEFI. The problem is with UEFI firmware which seems buggy. It does require the EFI partition to be the first one in the GPT table. The partition entries in GPT table were unordered. (EFI was the first one on disk, but 4th in the table).

I followed instruction below to fix that:

  1. Boot using Live USB
  2. Backup GPT table

    sudo su
    swapoff
    sfdisk -d /dev/sda > sda.bkp
    
  3. Modify new table with new order (EFI is the first)

    cp sda.bkp sda.new
    nano sda.new
    

    sda.new

    label: gpt
    label-id: 4A4481B5-0322-411E-8D05-552FBE6189AC
    device: /dev/sda
    unit: sectors
    first-lba: 34
    last-lba: 976773134
    
    /dev/sda1 : start=        2048, size=      409600, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BCB6E471-44F7-4C42-81EC-B276F1D6B6E6, name="EFI"
    /dev/sda2 : start=     4194304, size=   127924224, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=F1D50A87-ACB2-4868-B1EA-66C3D5223EA4, name="Linux filesystem"
    /dev/sda5 : start=   136513536, size=    17825792, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=515C9B77-B282-4007-8F1A-B0C5D908591E, name="Linux swap"
    /dev/sda6 : start=   154339328, size=   715456512, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=AEBBA3F2-F8B6-40C0-ABFE-9F530FC5F641, name="Linux filesystem"
    /dev/sda4 : start=   874115072, size=    98463744, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C96E6320-18EA-40B2-BA46-79FC66407917, name="Linux filesystem"
    
  4. Restore the GPT table

    sfdisk /dev/sda < sda.new
    

Now, I'm able to boot.

References:

  • Change the number of the partition from sda1 to sda2
  • How to renumber GPT partitions on an umounted disk? (simpler but i didn't try it)