UEFI is a firmware interface that is widespread on recent computers, especially those more recent than 2010. It is intended to replace the traditional BIOS firmware interface that is prevalent on earlier machines. This page provides information about installing and booting Ubuntu using UEFI, as well as about switching between UEFI mode and legacy BIOS mode using Ubuntu. While Ubuntu supports UEFI, unless absolutely required, it is recommended to switch your BIOS into legacy mode, and install Ubuntu in it. This is how some UEFI vendor implementations (ex. HP) will no longer recognize the drive as bootable through UEFI if you have made hardware changes, even though it worked prior to the switching, and you switched it back to the original configuration.
Installing Ubuntu Quickly and Easily via Trial and Error
If you have a computer that is more recent than 2010 and you do not know whether or not you need to install Ubuntu in UEFI mode, you should be able to get Ubuntu installed quickly and correctly using the following steps:
Create a LiveDVD or LiveUSB of Ubuntu (>=12.04.2) 64bit.
- Install Ubuntu from the Live CD/DVD or Live USB in the usual manner, then reboot the PC.
If the PC does not load Ubuntu (but instead loads Windows, for example, as in Bug #1050940), or if the Windows entry in the GRUB 2 menu does not boot Windows (see Bug #1024383), boot your PC using the Live CD/DVD or Live USB and choose "Try Ubuntu" once again. When the live session has loaded, run Boot-Repair (see link for details). When Boot-Repair loads, click on the "Recommended repair" button, and write on a paper the URL (paste.ubuntu.com/XXXXXX/) that will appear. Then reboot the pc. Do not run Boot-Repair unless you have problems booting the computer; the expression "if it ain't broke, don't fix it" applies to this tool.
This should fix most boot problems. If this does not fix your boot problems, please create a new thread in this forum, describing your problem and indicating the URL you wrote in the previous step.
Installing Ubuntu in UEFI mode
Warning: if you are a new Ubuntu user, you may want to follow the advice of the previous paragraph.
Case when Ubuntu must be installed in UEFI mode
Having a PC with UEFI firmware does not mean that you need to install Ubuntu in UEFI mode. What is important is below:
- if the other systems (Windows Vista/7/8, GNU/Linux...) of your computer are installed in UEFI mode, then you must install Ubuntu in UEFI mode too.
if the other systems (Windows, GNU/Linux...) of your computer are installed in Legacy (not-UEFI) mode, then you must install Ubuntu in Legacy mode too. Eg if your computer is old (<2010), is 32bits, or was sold with a pre-installed Windows XP.
- if Ubuntu is the only operating system on your computer, then it does not matter whether you install Ubuntu in UEFI mode or not.
To install Ubuntu in UEFI mode:
Use a 64bit disk of Ubuntu. (Ubuntu32bit cannot be easily installed in UEFI mode. This is a problem if 32-bit UEFI is the only way your computer can boot, e.g. if you have a modern Intel Atom based laptop. In this case, you will need a complicated work-around.)
You might want to use an EFI-only image to avoid troubles with mistakenly booting the image and installing Ubuntu in BIOS mode.
Use a supported version of Ubuntu. Support for UEFI appeared in 11.10, but has become more reliable in next versions. Support for UEFI SecureBoot appeared in 12.10 and 12.04.2.
Set up your firmware (BIOS) to boot the disk in UEFI mode (see the "Identifying if the computer boots the HDD in UEFI mode" paragraph below)
- nothing special is required if you use the automatic installer of Ubuntu ("Install Ubuntu alongside others" or "Erase the disk and install Ubuntu"). Important: if you have a pre-installed Windows and you want to keep it, do not choose "Erase the disk and install Ubuntu".
if you use the manual partitioning ("Something else"), the difference is that you will have to set the /boot/efi mount point to the UEFI partition. And if there was not any UEFI partition on your HDD, you first will have to create it (see the "Creating an UEFI partition" paragraph below).
Identifying if the computer boots the HDD in UEFI mode
This is possible only if you have already installed Ubuntu on the HDD, or by looking at the BIOS setup (see paragraph below).
From an Ubuntu installed on the HDD (neither liveCD nor liveUSB), open a terminal (Ctrl+Alt+T), then type the following command:
[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
Remark: if the result is "Legacy boot on HDD", then either the BIOS is not UEFI type, or the BIOS is not set up to boot the HDD in UEFI mode.
Identifying if the computer boots the Ubuntu DVD in UEFI mode
Warning: even if your PC boots the DVD in UEFI mode, it might boot the HDD in Legacy mode (and the contrary).
When booting on a 64-bit Ubuntu disk:
- If the BIOS is set up to boot the CD in UEFI mode, then you will see the screen below:
- If the BIOS is NOT set up to boot the CD in UEFI mode, or if the disk is not 64-bit, then you will see the screen below:
Set up the BIOS in UEFI or Legacy mode
Some recent computers (>2011) allow to set up the boot either in UEFI mode or in Legacy (not-EFI) mode. The way to carry out this setting depends on the computers, but generally this setting is located in the "Boot order" tab of the BIOS (to access the BIOS screens, it is generally necessary to press a key during the PC startup).
Note: Some BIOSes (e.g. American Megatrends' "Aptio", found on the Asus vivobook series) call Legacy mode "Compatibility Support Module" or simply "CSM".
Remark: Some BIOSes allow one to set up the boot mode for the optical drive separately from the boot mode for the HDD.
For example, below:
- the "UEFI Hitachi" line allows to boot the HDD in UEFI mode,
- the "P1: Hitachi" line allows to boot the HDD in Legacy (not-UEFI) mode,
- the "P3: DVD" line allows to boot the Ubuntu CD in Legacy mode
- the "UEFI: USB" line allows to boot the Ubuntu liveUSB in UEFI mode.
Here is a 2nd example of BIOS, simpler, where the "Boot Mode" parameter allows one to choose the boot mode ("UEFI" or "Legacy") for all media (hard disk, CD, USB...) at the same time.
Some other firmwares (BIOSes) propose an "UEFI/Legacy Boot:" option with the following choices: [Legacy only], [UEFI only] and [Both]. This last one boots in UEFI mode when possible, then in Legacy mode if no UEFI files are detected.
Creating an UEFI partition
If you are manually partitioning your disk in the Ubuntu installer, you need to make sure you have an UEFI partition set up.
- If your disk already contains an UEFI 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 UEFI partition per disk.
An UEFI 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:
Mount point: /boot/efi (remark: no need to set this mount point when using the manual partitioning, the Ubuntu installer will detect it automatically)
Size: minimum 100Mib. 200MiB recommended.
Other: needs a "boot" flag.
Identifying if an Ubuntu has been installed in UEFI mode
An Ubuntu installed in UEFI mode can be detected the following way:
- its /etc/fstab file contains an UEFI partition (mount point: /boot/efi)
- it uses the grub-efi bootloader (not grub-pc)
- from the installed Ubuntu, open a terminal (Ctrl+Alt+T) then type the following command:
[ -d /sys/firmware/efi ] && echo "Installed in UEFI mode" || echo "Installed in Legacy mode"
Converting Ubuntu into UEFI or Legacy mode
Converting Ubuntu into UEFI mode
Note: Do not follow this procedure if your computer is already booting correctly. Use this procedure only if you believe you've accidentally installed Ubuntu in BIOS/CSM/legacy mode and you want it to boot in UEFI/UEFI mode.
Start Boot-Repair, click on "Advanced options", go to the "GRUB location" tab.
- If you do not see a "Separate /boot/efi partition" line, this means that your PC does not have any UEFI partition. In this case, exit Boot-Repair, then create an UEFI partition (see the "Creating an UEFI partition" paragraph above).
- If you see a "Separate /boot/efi partition" line, tick it then click the "Apply" button.
Set up your BIOS so that it boots the HDD in UEFI mode (see the ""Set up the BIOS in UEFI or Legacy mode" paragraph above).
Converting Ubuntu into Legacy mode
Note: Use this procedure only to convert an UEFI-mode Linux installation to boot in BIOS/CSM/legacy mode. Such a conversion may be necessary if some hardware doesn't work correctly under UEFI mode. (Video cards are a common source of problems.) Converting to boot in BIOS/CSM/legacy mode while Windows boots in UEFI mode can make the boot process more awkward -- you'll need to use the computer's built-in boot manager to switch between OSes, and some computer's have such poor boot managers that this may be impossible.
If Ubuntu is installed on a GPT disk (you can check it via the 'sudo parted -l' command), use Gparted to create a BIOS-Boot partition (1MB, unformatted filesystem, bios_grub flag) at the start of its disk.
Start Boot-Repair, click on "Advanced options", go to the "GRUB location" tab.
- Untick the "Separate /boot/efi partition" option
- Click the "Apply" button.
Set up your BIOS so that it boots the HDD in Legacy mode (see the ""Set up the BIOS in UEFI or Legacy mode" paragraph above).
"Secure Boot" is a new UEFI feature that appeared in 2012, with Windows8 preinstalled computers. All current Ubuntu 64bit (not 32bit) versions now support this feature, but as PCs implementing support for it have only become widespread at the end of 2012 it is not yet widely tested, so it's possible that you may encounter problems booting Ubuntu under Secure Boot. If you do, please file a bug report against the shim package in Ubuntu, preferably using the command ubuntu-bug shim once you've installed with Secure Boot disabled.
Disabling SecureBoot in the BIOS
Here is an example of BIOS showing that "Secure Boot" is enabled:
To disable or enable Secure Boot, find a similar option in your BIOS, and use the keyboard to switch it to Enabled/Disabled.
Remark: if your PC has Windows8, you may need to follow the procedure below to access your BIOS.
Accessing the UEFI settings from Windows8
Go to the PowerOff options, and while holding the SHIFT key, click on Restart.
When the menu below appears, select Troubleshoot, then UEFI Firmware Settings.
The PC will reboot and you will be able to enter the BIOS (if not press the necessary key).
- UEFIBooting (older documentation, maybe useful for Mac)
- Installing Ubuntu on a Pre-Installed UEFI Supported Windows 8 System: Step by Step guide to install Ubuntu on an UEFI/Secure Boot enabled computer that comes pre-installed with Windows 8