You are on page 1of 8

8/13/2014 Linux on UEFI: A Quick Installation Guide

http://www.rodsbooks.com/linux-uefi/ 1/8
For several years, a new firmware technology has been
lurking in the wings, unknown to most ordinary users. Known
as the Extensible Firmware Interface (EFI), or more recently
as the Unified EFI (UEFI, which is essentially EFI 2.x), this
technology has begun replacing the older Basic Input/Output
System (BIOS) firmware with which most experienced
computer users are at least somewhat familiar.
This page is a quick introduction to EFI for Linux users,
including advice on getting started installing Linux to such a
computer. Unfortunately, EFI is a dense topic; the EFI
software itself is complex, and many implementations have
system-specific quirks and even bugs. Thus, I cannot describe
everything you'll need to know to install and use Linux on an
EFI computer on this one page. It's my hope that you'll find
this page a useful starting point, though, and links within each
section and in the References section at the end will point you
toward additional documentation.
Linux on UEFI:
A Quick Installation Guide
by Roderick W. Smith, rodsmith@rodsbooks.com
Originally written: 10/19/2013; last modified: 10/20/2013
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge
and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If
you find this Web page useful, please consider making a small donation to help keep this site up and running.
Thanks!
Donate $1.00 Donate $2.50 Donate $5.00 Donate $10.00 Donate $20.00 Donate another value

Introduction
Contents
Introduction
Does Your Computer Use EFI?
Does Your Distribution Support EFI?
Preparing to Install Linux
Installing Linux
Fixing Post-Installation Problems
References
Does Your Computer
Use EFI?
EFI is a type of firmware, meaning that it's
software built into the computer to handle low-
level tasks. Most importantly, the firmware controls the computer's boot process, which in turn means that EFI-
based computers boot differently than do BIOS-based computers. (A partial exception to this rule is described
shortly.) This difference can greatly complicate the design of OS installation media, but it has little effect on the
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 2/8
Note: The EFI that Apple uses on Macs is
unusual in many respects. Although much of this
page applies to Macs, some details differ,
particularly when it comes to setting up EFI boot
loaders. This task is best handled from OS X by
using the Mac's bless utility, which I don't
describe here.
day-to-day operation of the computer, once everything is set up and running. Note that most manufacturers use
the term "BIOS" to refer to their EFIs. I consider this usage confusing, so I avoid it; in my view, EFIs and
BIOSes are two different types of firmware.
EFI has been used on Intel-based Macs since they
were first introduced in 2006. Beginning in late 2012,
most computers that ship with Windows 8 or later boot
using UEFI by default, and in fact most PCs released
since mid-2011 use UEFI, although they may not boot
in EFI mode by default. A few PCs sold prior to 2011
also support EFI, although most such computers boot
in BIOS mode by default.
If you're uncertain about your computer's EFI support
status, you should check your firmware setup utility and your user manual for references to EFI, UEFI, or
legacy booting. (Searching a PDF of your user manual can be a quick way to do this.) If you find no such
references, your computer probably uses an old-style ("legacy") BIOS; but if you find references to these terms,
it almost certainly uses EFI. You can also try booting a boot medium that contains only an EFI-mode boot
loader. The USB flash drive or CD-R image of rEFInd is a good choice for this test.
Before proceeding further, you should understand that most EFIs on x86 and x86-64 computers include a
component known as the Compatibility Support Module (CSM), which enables the EFI to boot OSes using
the older BIOS-style boot mechanisms. This can be a great convenience because it provides backwards
compatibility; but it also creates complications because there's no standardization in the rules and user interfaces
for controlling when a computer boots in EFI mode vs. when it boots in BIOS (aka CSM or legacy) mode. In
particular, it's far too easy to accidentally boot your Linux installation medium in BIOS/CSM/legacy mode, which
will result in a BIOS/CSM/legacy-mode installation of Linux. This can work fine if Linux is your only OS, but it
complicates the boot process if you're dual-booting with Windows in EFI mode. (The opposite problem can also
occur.) The following sections should help you boot your installer in the right mode.
One optional feature of UEFI deserves mention: Secure Boot. This feature is designed to minimize the risk of a
computer becoming infected with a boot kit, which is a type of malware that infects the computer's boot loader.
Boot kits can be particularly difficult to detect and remove, which makes blocking them a priority. Microsoft
requires that all desktop and laptop computers that bear a Windows 8 logo ship with Secure Boot enabled. This
type of configuration complicates Linux installation, although some distributions handle this problem better than
do others. Do not confuse Secure Boot with EFI or UEFI, though; it's possible for an EFI computer to not
support Secure Boot, and it's possible to disable Secure Boot even on x86-64 EFI computers that support it.
Microsoft requires this for Windows 8 certification; however, this requirement is reversed for ARM computers
such computers that ship with Windows 8 must not permit the user to disable Secure Boot. Fortunately,
ARM-based Windows 8 computers are currently rare. I recommend avoiding them.
Does Your Distribution Support EFI?
As I write (in late 2013), most Linux distributions support EFI; in fact, most have supported it for years. The
quality of that support varies from one distribution to another, though. In my estimation, the quality of EFI
support is best in Fedora and drops off through OpenSUSE, Ubuntu, and Mint, to name a few popular
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 3/8
distributions. Some more "do-it-yourself" distributions, such as Gentoo, don't officially support EFI, but their
nature makes it easy to add EFI support to them. In fact, it's possible to add EFI support to any Linux
distribution: You need to install it (even in BIOS mode) and then install an EFI boot loader on the computer. See
my Managing EFI Boot Loaders for Linux page for information on how to do this.
You should check your distribution's feature list to determine if it supports EFI. You should also pay attention to
your distribution's support for Secure Boot, particularly if you intend to dual-boot with Windows 8. Note that
even distributions that officially support Secure Boot may require that this feature be disabled, since Linux Secure
Boot support is often poor or creates complications.
Preparing to Install Linux
A few preparatory steps will help make your Linux installation on an EFI-based computer go more smoothly:
1. Upgrade your firmwareSome EFIs are badly broken, but hardware manufacturers occasionally
release updates to their firmware. Thus, I recommend upgrading your firmware to the latest version
available. If you know from forum posts or the like that your EFI is problematic, you should do this before
installing Linux, because some problems will require extra steps to correct if the firmware is upgraded after
the installation. On the other hand, upgrading firmware is always a bit risky, so holding off on such an
upgrade may be best if you've heard good things about your manufacturer's EFI support.
2. Learn how to use your firmwareYou can usually enter a firmware setup utility by hitting the Del key
or a function key early in the boot process. Check for prompts soon after you power on the computer or
just try each function key. Similarly, the Esc key or a function key usually enters the firmware's built-in
boot manager, which enables you to select which OS or external device to boot. Some manufacturers are
making it hard to reach such settings. In some cases, you can do so from inside Windows 8, as described
on this page.
3. Adjust the following firmware settings:
Fast bootThis feature can speed up the boot process by taking shortcuts in hardware
initialization. Sometimes this is fine, but sometimes it can leave USB hardware uninitialized, which
can make it impossible to boot from a USB flash drive or similar device. Thus, disabling fast boot
may be helpful, or even required; but you can safely leave it active and deactivate it only if you have
trouble getting the Linux installer to boot.
Secure BootFedora, OpenSUSE, Ubuntu, and some other distributions officially support
Secure Boot; but if you have problems getting a boot loader or kernel to start, you might want to
disable this feature. Unfortunately, describing how to do so is impossible because the settings vary
from one computer to another. See my Secure Boot page for more on this topic.
CSM/legacy optionsIf you want to install in EFI mode, set such options off. Some guides
recommend enabling these options, and in some cases they may be requiredfor instance, they
may be needed to enable the BIOS-mode firmware in some add-on video cards. In most cases,
though, enabling CSM/legacy support simply increases the risk of inadvertently booting your Linux
installer in BIOS mode, which you do not want to do. Note that Secure Boot and CSM/legacy
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 4/8
options are sometimes intertwined, so be sure to check each one after changing the other.
4. Disable the Windows Fast Startup featureThis page describes how to disable this feature, which is
almost certain to cause filesystem corruption if left enabled. Note that this feature is distinct from the
firmware's fast boot feature.
5. Check your partition tableUsing GPT fdisk, parted, or any other partitioning tool, check your disk's
partitions. Ideally, you should create a hardcopy that includes the exact start and end points (in sectors) of
each partition. This will be a useful reference, particularly if you use a manual partitioning option in the
installer. If Windows is already installed, be sure to identify your EFI System Partition (ESP), which is a
FAT partition with its "boot flag" set (in parted or GParted) or that has a type code of EF00 in gdisk.
Installing Linux
Most Linux distributions provide adequate installation instructions; however, I've observed a few common
stumbling blocks on EFI-mode installations:
Ensure that you're using a distribution that's the right bit depthEFI runs boot loaders that are the
same bit depth as the EFI itself. This is normally 64-bit for modern computers, although the first couple
generations of Intel-based Macs and a handful of obscure computers use 32-bit EFIs. I have yet to
encounter a 32-bit Linux distribution that officially supports EFI, although it is possible to add a 32-bit EFI
boot loader to 32-bit distributions. (My Managing EFI Boot Loaders for Linux covers boot loaders
generally, and understanding those principles may enable you to modify a 32-bit distribution's installer,
although that's not a task for a beginner.) Installing a 32-bit Linux distribution on a computer with a 64-bit
EFI is difficult at best, and I don't describe the process here; you should use a 64-bit distribution on a
computer with a 64-bit EFI.
Properly prepare your boot mediumThird-party tools for moving .iso images onto USB flash
drives, such as unetbootin, often fail to create the proper EFI-mode boot entries. I recommend you
follow whatever procedure your distribution maintainer suggests for creating USB flash drives. If no such
recommendation is made, use the Linux dd utility, as in dd if=image.iso of=/dev/sdc to create an
image on the USB flash drive on /dev/sdc. Ports of dd to Windows, such as WinDD and dd for
Windows, exist, but I've never tested them.
Back up the ESPIf you're installing to a computer that already boots Windows or some other OS, I
recommend backing up your ESP before installing Linux. Although Linux shouldn't damage files that are
already on the ESP, this does seem to happen from time to time. Having a backup will help in such cases.
A simple file-level backup (using cp, tar, or zip, for example) should work fine.
Booting in EFI modeIt's too easy to accidentally boot your Linux installer in BIOS/CSM/legacy
mode, particularly if you leave the CSM/legacy options enabled in your firmware. A few tips can help you
to avoid this problem:
You should verify an EFI-mode boot by dropping to a Linux shell and typing ls
/sys/firmware/efi. If you see a list of files and directories, you've booted in EFI mode and you
can ignore the following additional tips; if not, you've probably booted in BIOS mode and should
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 5/8
review your settings.
Use your firmware's built-in boot manager (which you should have located earlier; see Learn how
to use your firmware) to boot in EFI mode. Typically, you'll see two options for a CD-R or USB
flash drive, one of which includes the string EFI or UEFI in its description, and one of which does
not. Use the EFI/UEFI option to boot your medium.
Disable Secure BootEven if you're using a distribution that officially supports Secure Boot,
sometimes this doesn't work. In this case, the computer will most likely silently move on to the next
boot loader, which could be your medium's BIOS-mode boot loader, resulting in a BIOS-mode
boot.
If you can't seem to get the Linux installer to boot in EFI mode, try using a USB flash drive or CD-
R version of my rEFInd boot manager. If rEFInd boots, it's guaranteed to be running in EFI mode,
and on a UEFI-based PC, it will show only EFI-mode boot options, so if you can then boot to the
Linux installer, it should be in EFI mode. (On Macs, though, rEFInd shows BIOS-mode boot
options in addition to EFI-mode options.)
Preparing your ESPExcept on Macs, EFIs use the ESP to hold boot loaders. If your computer came
with Windows pre-installed, an ESP should already exist, and you can use it in Linux. If not, I recommend
creating an ESP that's 550MiB in size. (If you existing ESP is smaller than this, go ahead and use it.)
Create a FAT32 filesystem on it. If you use GParted or parted to prepare your disk, give the ESP a
"boot flag." If you use GPT fdisk (gdisk, cgdisk, or sgdisk) to prepare the disk, give it a type code of
EF00. Some installers create a smallish ESP and put a FAT16 filesystem on it. This usually works fine,
although if you subsequently need to re-install Windows, its installer will become confused by the FAT16
ESP, so you may need to back it up and convert it to FAT32 form.
Using the ESPDifferent distributions' installers have different ways of identifying the ESP. For instance,
Ubuntu calls the ESP the "EFI boot partition" and does not show you an explicit mount point (although it
will mount it behind the scenes); but a distribution like Arch or Gentoo will require you to mount it. The
closest thing to a standard ESP mount point in Linux is /boot/efi, although /boot works well with
some configurationsparticularly if you want to use gummiboot or ELILO. Some distributions won't let
you use a FAT partition as /boot, though. Thus, if you're asked to set a mount point for the ESP, make it
/boot/efi. Do not create a fresh filesystem on the ESP unless it doesn't already have oneif Windows
or some other OS is already installed, its boot loader lives on the ESP, and creating a new filesystem will
destroy that boot loader!
Setting the boot loader locationSome distributions may ask about the boot loader's (GRUB's)
location. If you've properly flagged the ESP as such, this question should be unnecessary, but some
distributions' installers still ask. Try telling it to use the ESP.
Other partitionsOther than the ESP, no other special partitions are required; you can set up root (/),
swap, /home, or whatever else you like in the same way you would for a BIOS-mode installation. Note
that you do not need a BIOS Boot Partition for an EFI-mode installation, so if your installer is telling you
that you need one, this may be a sign that you've accidentally booted in BIOS mode. On the other hand, if
you create a BIOS Boot Partition, that will give you some extra flexibility, since you'll be able to install a
BIOS version of GRUB to boot in either mode (EFI or BIOS).
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 6/8
Fixing blank displaysA problem that many people are having through much of 2013 is blank displays
when booted in EFI mode. Sometimes this problem can be fixed by adding nomodeset to the kernel's
command line. You can do this by typing e to open a simple text editor in GRUB. In many cases, though,
you'll need to research this problem in more detail, because it often has more hardware-specific causes.
In some cases, you may be forced to install Linux in BIOS mode. You can sometimes then manually install an
EFI-mode boot loader for Linux to begin booting in EFI mode. See my Managing EFI Boot Loaders for Linux
page for information on available boot loaders and how to install them.
Fixing Post-Installation Problems
If you can't seem to get an EFI-mode boot of Linux working but a BIOS-mode boot works, you can abandon
EFI mode entirely. This is easiest on a Linux-only computer; just install a BIOS-mode boot loader (which the
installer should have done if you installed in BIOS mode). If you're dual-booting with an EFI-mode Windows,
though, the easiest solution is to install my rEFInd boot manager. Install it from Windows and edit the
refind.conf file: Uncomment the scanfor line and ensure that hdbios is among the options. This will enable
rEFInd to redirect the boot process to a BIOS-mode boot loader. This solution works for many systems, but
sometimes it fails for one reason or another.
If you reboot the computer and it boots straight into Windows, it's likely that your Linux boot loader or boot
manager was not properly installed. (You should try disabling Secure Boot first, though; as I've said, it often
causes problems.) There are several possible solutions to this problem:
Use efibootmgrYou can boot a Linux emergency disc in EFI mode and use the efibootmgr utility
to re-register your Linux boot loader, as described here.
Use bcdedit in WindowsIn a Windows Administrator Command Prompt window, typing bcdedit
/set {bootmgr} path \EFI\fedora\grubx64.efi will set the EFI/fedora/grubx64.efi file on
the ESP as the default boot loader. Change that path as necessary to point to your desired boot loader. If
you're booting with Secure Boot enabled, you should set shim.efi, shimx64.efi, or PreLoader.efi
(whichever is present) as the boot program, rather than grubx64.efi.
Install rEFIndSometimes rEFInd can overcome this problem. I recommend testing by using the CD-R
or USB flash drive image. If it can boot Linux, install the Debian package, RPM, or .zip file package.
(Note that you may need to edit your boot options by highlighting a Linux vmlinuz* option and hitting F2
or Insert twice. This is most likely to be required if you've got a separate /boot partition, since in this
situation rEFInd can't locate the root (/) partition to pass to the kernel.)
Use Boot RepairUbuntu's Boot Repair utility can auto-repair some boot problems; however, I
recommend using it only on Ubuntu and closely-related distributions, such as Mint. In some cases, it may
be necessary to click the Advanced option and check the box to back up and replace the Windows boot
loader.
Hijack the Windows boot loaderSome buggy EFIs boot only the Windows boot loader, which is
called EFI/Microsoft/Boot/bootmgfw.efi on the ESP. Thus, you may need to rename this boot
loader to something else (I recommend moving it down one level, to EFI/Microsoft/bootmgfw.efi)
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 7/8
and putting a copy of your preferred boot loader in its place. (Most distributions put a copy of GRUB in a
subdirectory of EFI named after themselves, such as EFI/ubuntu for Ubuntu or EFI/fedora for
Fedora.) Note that this solution is an ugly hack, and some users have reported that Windows will replace
its boot loader, so it may not even work 100% of the time. It is, however, the only solution that works on
some badly broken EFIs. Before attempting this solution, I recommend upgrading your firmware and re-
registering your own boot loader with efibootmgr in Linux or bcdedit in Windows.
Another class of problems relates to boot loader troublesIf you see GRUB (or whatever boot loader or boot
manager your distribution uses by default) but it doesn't boot an OS, you must fix that problem. Windows often
fails to boot because GRUB 2 is very finicky about booting Windows. This problem can be exacerbated by
Secure Boot in some cases. See my page on GRUB 2 for a sample GRUB 2 entry for booting Windows. Linux
boot problems, once GRUB appears, can have a number of problems, and are likely to be similar to BIOS-
mode Linux boot problems, so I don't cover them here.
Despite the fact that it's very common, my opinion of GRUB 2 is rather lowit's an immensely complex
program that's difficult to configure and use. Thus, if you run into problems with GRUB, my initial response is to
replace it with something else. My Web page on EFI boot loaders for Linux describes the options that are
available. These include my own rEFInd boot manager, which is much easier to install and maintain, aside from
the fact that many distributions do manage to get GRUB 2 workingbut if you're considering replacing GRUB 2
because of its problems, that's obviously not worked out for you!
Beyond these issues, EFI booting problems can be quite idiosyncratic, so you may need to post to a Web forum
for help. Be sure to describe the problem as thoroughly as you can. The Boot Info Script can provide useful
informationrun it and it should produce a file called RESULTS.txt that you can paste into your forum post. Be
sure to precede this pasted text with the string [code] and follow it with [/code], though; otherwise people will
complain. Alternatively, upload RESULTS.txt to a pastebin site, such as pastebin.com, and post the URL that
the site gives you.
References and Additional Information
Informational Web pages
My Managing EFI Boot Loaders for Linux page covers the available EFI boot loaders and boot
managers.
The man page for OS X's bless tool may be helpful in setting up a boot loader or boot manager
on that platform.
The EFI Boot Process describes, in broad strokes, how EFI systems boot.
The Arch Linux UEFI wiki page has a great deal of information on UEFI and Linux.
This page describes how to adjust EFI firmware settings from within Windows 8.
Matthew J. Garrett, the developer of the shim boot loader to manage Secure Boot, maintains a
blog in which he often writes about EFI issues.
8/13/2014 Linux on UEFI: A Quick Installation Guide
http://www.rodsbooks.com/linux-uefi/ 8/8
If you're interested in developing EFI software yourself, my Programming for EFI can help you get
started.
Additional programs
The official rEFInd Web page
The official gummiboot Web page
The official ELILO Web page
The official GRUB Web page
The official GPT fdisk partitioning software Web page
Ubuntu's Boot Repair utility can help fix some boot problems
Communications
The rEFInd discussion forum on Sourceforge provides a way to discuss rEFInd with other users or
with me.
Pastebin sites, such as http://pastebin.com, provide a convenient way to exchange largeish text files
with users on Web forums.
copyright 2013 by Roderick W. Smith
If you have problems with or comments about this Web page, please e-mail me at rodsmith@rodsbooks.com.
Thanks.
Return to my main Web page.

You might also like