UEFI is the successor to BIOS for communicating with the Firmware on your Mainboard.
While the first BIOS was released with the IBM-PC in 1981, the first UEFI version (EFI 2.0) was released 25 years later in 2006 building upon the lessons learned in that timespan. So UEFI is without any doubt the more modern solution.
The user-visible advantages of using UEFI instead of BIOS are
- you can reboot to the firmware (BIOS) setup directly from the grub screen – without the need to press buttons during startup
- firmware (BIOS) updates from within Ubuntu
- Secure Boot for Windows and Ubuntu. While this might seem controversial, it will prevent you being hacked by the Hacking Team
You could reinstall both Windows and Ubuntu to get UEFI. However it is also possible to convert existing installations of both on the fly – without the backup/ restore cycle. You should still do a backup in case something goes wrong though.
Prerequisites
Only the 64bit Versions of Windows support UEFI. Therefore this guide assumes that you run the 64bit versions of both Windows and Ubuntu.
Furthermore verify the following items before you continue – otherwise you will not be able to finish the conversion. Use GParted in case you have not enough space before the first or after the last partition.
- 250MB space in front of first partition
Typically Windows 8 creates a 350MB System Partition upon installation. This space can be reclaimed for a 100MB EFI partiton and a new 100MB Windows System partition. - 1-2MB behind last partiton (for the GPT backup)
- UEFI bootable Ubuntu USB drive.
You can use the startup disk creator on ubuntu with an Ubuntu 14.04+ ISO. - UEFI bootable Windows USB drive.
You can use the Microsoft Media Creation tool for Windows 10 to get one.
to test that the sticks are indeed UEFI compatible, try booting them with CSM Mode disabled in your BIOS.
Convert the drive to GPT
UEFI requires a GUID Partition Table (GPT), so first we need to convert from MBR to GPT.
After this step you will not be able to boot your system any more. So make sure you have the Ubuntu USB drive ready.
We will use gdisk to perform the conversion as following:
sudo gdisk /dev/sdX
Command (? for help): w
where sdX is your system drive (e.g. sda)
Convert Windows to UEFI
Now boot your Windows USB drive and enter the command prompt as described in this Microsoft Technet article at step 6.
Continue with the following steps from the Article. Note that we have skipped steps 1-4 as we used Ubuntu to convert the disk to GPT.
We have now created a EFI partition, a new EFI compatible Windows System Partition and we have installed the Windows Bootloader to the EFI partition. Your Windows installation should now start again.
At this point you could also perform an upgrade to Windows 10, as the upgrade would erase grub from the EFI partition anyway.
Next we are going to install grub to the EFI partition and make it manage the boot.
Enter a Ubuntu chroot
As we can not directly boot our Ubuntu installation, we will instead boot from the Ubuntu USB drive and the switch to the installed Ubuntu.
To do the switch we have to setup and enter a chroot as following
sudo mount /dev/sdXY /mnt
sudo mount /dev/sdX1 /mnt/boot/efi
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /sys /mnt/sys
sudo mount -t proc /proc /mnt/proc
sudo cp /proc/mounts /mnt/etc/mtab
sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
sudo chroot /mnt
where sdXY is the partition where your Ubuntu system is installed (e.g. sda5)
Convert Ubuntu to UEFI
Inside your Ubuntu Installation we have to replace grub for BIOS (aka grub-pc) with grub for UEFI (aka grub-efi) as:
sudo apt-get --reinstall install grub-common grub-efi-amd64 os-prober
this would be enough to get the system booting again, however we also aim for secure boot so we also need to install the following:
sudo apt-get install shim-signed grub-efi-amd64-signed linux-signed-generic
This installs signatures for grub and the kernel which are used to verify the integrity of these at boot. Furthermore we install shim, which is a passthrough bootloader that translates from the Microsoft signatures on you mainboard to the signatures by Canonical used to sign grub and the kernel (see this for details).
Next we finally install grub to the EFI partition by:
sudo grub-install --uefi-secure-boot /dev/sdX
sudo update-grub
where sdX is again your system drive (e.g. sda).
Now you can enable secure boot in your BIOS and benefit. Note that some BIOS implementations additionaly require you to select the trusted signatures. Look out for an option called “Install Default Secure Boot keys” or similar to select the Microsoft signatures.