Using UEFI mode for virtual machines

You can boot a virtual machine (VM) in Unified Extensible Firmware Interface (UEFI) mode.

About UEFI mode for virtual machines

Unified Extensible Firmware Interface (UEFI), like legacy BIOS, initializes hardware components and operating system image files when a computer starts. UEFI supports more modern features and customization options than BIOS, enabling faster boot times.

It stores all the information about initialization and startup in a file with a .efi extension, which is stored on a special partition called EFI System Partition (ESP). The ESP also contains the boot loader programs for the operating system that is installed on the computer.

Booting virtual machines in UEFI mode

You can configure a virtual machine to boot in UEFI mode by editing the VirtualMachine manifest.

Prerequisites

  • Install the OpenShift CLI (oc).

Procedure

  1. Edit or create a VirtualMachine manifest file. Use the spec.firmware.bootloader stanza to configure UEFI mode:

    Booting in UEFI mode with secure boot active

    1. apiversion: kubevirt.io/v1
    2. kind: VirtualMachine
    3. metadata:
    4. labels:
    5. special: vm-secureboot
    6. name: vm-secureboot
    7. spec:
    8. template:
    9. metadata:
    10. labels:
    11. special: vm-secureboot
    12. spec:
    13. domain:
    14. devices:
    15. disks:
    16. - disk:
    17. bus: virtio
    18. name: containerdisk
    19. features:
    20. acpi: {}
    21. smm:
    22. enabled: true (1)
    23. firmware:
    24. bootloader:
    25. efi:
    26. secureBoot: true (2)
    27. ...
    1OKD Virtualization requires System Management Mode (SMM) to be enabled for Secure Boot in UEFI mode to occur.
    2OKD Virtualization supports a VM with or without Secure Boot when using UEFI mode. If Secure Boot is enabled, then UEFI mode is required. However, UEFI mode can be enabled without using Secure Boot.
  2. Apply the manifest to your cluster by running the following command:

    1. $ oc create -f <file_name>.yaml