Installing Operating Systems on UEFI Systems

From Thomas-Krenn-Wiki
Jump to: navigation, search

The Unified Extensible Firmware Interface (UEFI) and GUID Partition Table (GPT) have appeared as the successors to traditional BIOSs and the Master Boot Record (MBR) scheme. Modern operating systems (OSs) like Ubuntu have all of the utilities for booting in UEFI mode, even from GPT data media. Microsoft Windows has even determined that booting under UEFI will only be supported from GPT devices for their 64-bit systems.[1]

An explicit selection of UEFI boot entries guarantees booting the installation medium in UEFI mode

UEFI provides its own boot manager, which makes loading boot loaders for UEFI-supported file systems possible. The management of a set boot entries already in the platform firmware is the objective of the UEFI boot manager.[2] This menu allows selection of all UEFI conformant boot media that are available to the system. For this, the boot loader sequence is stored in the persistent NVRAM.[3]

To ensure that the installation medium will be started in UEFI mode, any entry known to the UEFI system can be selected from the UEFI menu.

  • For example: UEFI:DVD/CD drives or UEFI:USB-sticks

Linux

According to the Ubuntu documentation about UEFI[4] there are several ways to install Ubuntu under UEFI:

Assumption UEFI CSM (Legacy Mode)
Other OS under UEFI Yes No
Other OS Legacy No Yes
Ubuntu single OS Yes Yes

In terms of correct partitioning it is possible to use:

  • BIOS Boot via MBR

There are no barriers to using the traditional approach.

  • BIOS Boot via GPT

For booting from a GPT device, Linux requires a Bios Boot Partition and a boot loader that can work with the GPT format (such as Grub2).[5] One simple option involves moving the system partition to a non-GPT partition, booting from there and then adding the individual GPT devices. Windows (see below) can boot from GPT devices only in UEFI mode.

  • UEFI Boot via MBR

The specification has determined that a UEFI system partition is needed for booting from a block device via UEFI. Whether this system partition is stored on a device formatted using GPT or MBR is not important. For Windows, a GPT device is mandatory however.

  • UEFI BOOT via GPT

The boot manager will manage the boot entries in the persistent NVRAM. The appropriate boat loader is located on the UEFI system partition (ESP). /dev/sdc1 is an ESP on a GPT-formatted hard disk in the following example. The partitions can be read by means of gdisk.

:~$ sudo gdisk /dev/sdc
[...]
Partition number (1-4): 1
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: A81C2DB8-E808-4853-A67B-3982C65C23C2
First sector: 34 (at 17.0 KiB)
Last sector: 293002 (at 143.1 MiB)
Partition size: 292969 sectors (143.1 MiB)
[...]
:~$ mount -l
[...]
/dev/sdc1 on /boot/efi type vfat (rw)
[...]
:~$ ls /boot/efi/EFI/ubuntu/
grubx64.efi

EFI System Partition

As already said if Ubuntu is installed under UEFI an ESP is required. The current installer of Ubuntu 12.04 creates by default an ESP if automated partitioning is chosen while installing. When creating the partitions manually it is important to fulfill the following requirements:

  • Mount point: /boot/efi
  • Size between 100MB and 250MB
  • Type: FAT32
  • Set Boot Flag and locate partition at the start of the GPT-Partition

Since Ubuntu 12.04 it is also possible to use an already existing Windows ESP. In this case this partition must not be formatted but the mount point must be set to "boot/efi".

efibootmgr

efibootmgr is a user space utility under Linux for manipulating the UEFI boot manager.[6] For example, the current sequence of UEFI boot entries can be determined as well as changed with this utility. Here is the output from our UEFI test system.

:~$ sudo efibootmgr 
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,000A,0009,0003,0007,0006
Boot0000* ubuntu
Boot0003* Network Card 
Boot0006* UEFI: Built-in EFI Shell 
Boot0007* USB 
Boot0009* Hard Drive 
Boot000A* UEFI: ATP Nano Vision 1100

The ubuntu entry corresponds to the entry under /boot/efi/EFI/ubuntu/ in the example above.

Windows

The following partition will be automatically be created by the Windows installer in UEFI mode. Source: Installing Windows on UEFI Systems, p.4 (msdn.microsoft.com)

The following versions of Windows have the ability to boot from GPT hard disks under UEFI:[7]

  • Desktops
    • The 64-bit version of Windows 8, Windows 7 and Windows Vista with Service Pack 1 (SP1)
  • Servers
    • Windows Server 2012, Windows Server 2008 R2 and Windows Server 2008 (also 64-bit)

The following files will automatically be stored in the UEFI system by the Windows installer:

  • Windows Boot Manager (boot managers from other operating systems will also be found on this partition)
  • Boot configuration data

In addition, Windows will require at least three partitions on GPT data media:[8]

  1. The UEFI System Partition (ESP) already mentioned
    • At least 100 megabytes, FAT32
    • 260MB for advanced format 4k hard disks
  2. A Microsoft-reserved partition (MSR), for drive management
  3. Windows Partition
  4. In addition, a Windows Recovery Environment tools partition, if desired

The 32-bit versions will currently be setup using the Compatibility Support Module (CSM), giving them the ability to run on UEFI systems as well. However, they will not benefit from the UEFI changes. If the CSM mode is available for so-called legacy systems will depend upon the respective firmware. An operating system that has been booted under the CSM will thereafter not appear any different from traditional BIOS systems.[9]

References

  1. Windows and GPT FAQ (msdn.microsoft.com)
  2. UEFI Specification (uefi.org)
  3. Boot Manager (software.intel.com)
  4. Ubuntu UEFI (help.ubuntu.com)]
  5. Booting from GPT (rodsbooks.com)
  6. efibootmgr man page (linux.die.net)
  7. Installing Windows on UEFI Systems (msdn.microsoft.com)
  8. How to Configure UEFI/GPT-Based Hard Drive Partitions (http://technet.microsoft.com)
  9. UEFI FAQ (heise.de)

Related articles

Extreme Privilege Escalation UEFI Security Vulnerability
Installing Windows in UEFI-mode
Restoring UEFI Boot Entry after Ubuntu Update