How to Enable UEFI for VMs in RHEL KVM

by Leonel Mosciski
14 minutes read

How to Enable UEFI for VMs in RHEL KVM

A photograph of a desktop computer PC on height of a white table.

Red Hat Enterprise Linux’s (RHEL) KVM is one of the numerous effective and also accessible Kind 1 hypervisor accessible today. Along wearing Cabin, it permits you to convert your ordinary computer into a virtualization immense wearing the opportunity to host multiple, concurrent VMs. This write-upward validates you how to extend the RHEL KVM to in addition boot UEFI-lone mechanisms wearing its super own UEFI mode in Linux.

Web content
  • Why Enable UEFI for Your KVM?
  • Installing the Dependences for UEFI Promote
  • Unleashing a UEFI-fluent VM in RHEL Cabin
  • Unleashing a UEFI-fluent VM in the Command Blather upward

Why Enable UEFI for Your KVM?

One of the greatest advantages of permitting UEFI is that it permits you to application dynamic OSes in a digital genuinely feel. For instance, permitting UEFI for your Linux KVM will permit you to installed Windows 11 on a digital machine.

Polymorphous other than that, permitting UEFI on your KVM in addition permits you to checkup assorted configurations for your OSes. In my spanning, I’m grossing earn serviceability of of it as a strategy to validate if my separating layout schemes will occupational on real equipment.

Pointer: you can in addition installed Windows 11 on VirtualBox in Linux if you’re peeking for a Kind 2 hypervisor service.

Installing the Dependences for UEFI Promote

The initially intervene permitting UEFI in KVM is to render sure that your unit is totally upward-to-date:

sudo dnf update

Warranty that you’ve installed and also permitted the unit’s KVM subsystem and also schemes:

sudo dnf install module virt sudo dnf install virt-install virt-viewer sudo systemctl start libvirtd

Dashed the obeying command to installed the UEFI firmware for your KVM:

sudo dnf install edk2-ovmf cockpit-machines

Warranty that the Cabin daemon is upward and also sprinting for your unit:

sudo systemctl enable --now cockpit.socket

Reboot your unit to make certain that it will correctly number the brand name-neoteric firmware once it preludes:

sudo reboot

FYI: learn supplemental around Red Hat Linux ecological hamlet by collecting straying home directories grossing earn serviceability of of RHEL IdM.

Unleashing a UEFI-fluent VM in RHEL Cabin

Open a net browser, then navigate to your machine’s Cabin dashboard. You can situate the dashboard at: http://localhost:9090.

A screenshot of RHEL's Cabin login brandish.

Login to your dashboard grossing earn serviceability of of either your root or superuser account, then click Virtual Machines.

A screenshot accentuating the

Click Invent VM on the internet page’s correct side.

A screenshot accentuating the

Fill in the honesty of your VM, then press Invent and also Modify.

A screenshot accentuating the "Invent and also modify" switch under the VM innovation exasperate.

Click the BIOS organization under the Outline detect.

A screenshot accentuating the

This will bring upward a dropdown sustenance selection wherein you can decide between BIOS and also UEFI for your VM’s firmware. Pick UEFI, then click Preserve.

A screenshot attesting the Firmware dropdown sustenance selection for the brand name-neoteric VM.

Chit: It’s super realistic to lug out this in days gone by you boot your VM for the initially time. This is since the KVM won’t permit you to fluctuation the firmware after it preludes.

Open a brand name-neoteric terminal session, then devise a nvram magazine under “/var/libvirt/qemu”:

sudo mkdir /var/libvirt/qemu/nvram

Xerox the non-Safeguard Boot UEFI variables from the default EDK2 directories to your KVM’s NVRAM:

sudo cp /usr/share/edk2/ovmf/OVMF_VARS.fd /var/lib/libvirt/qemu/nvram/YOUR-VM-NAME_VARS.fd

Click Mount to boot your VM in UEFI mode.

A screenshot accentuating the

Sweet to realise: learn supplemental around the differences between BIOS and also UEFI to consultation which one is for you.

Test if your unit is sprinting in UEFI mode by opening a terminal and also sprinting the obeying command:

ls /sys/firmware/efi

Toting out this have to comeback the materials of the EFI variables for the present unit.

A screenshot attesting the VM sprinting in UEFI mode.

Chit: For Windows 10 and also senior, you can ponder this by pressuring Win + R, entering “msinfo32.exe” on the Dashed exasperate, then scrolling to the jabber that preludes wearing BIOS Mode in the Mechanism Explanation window.

Unleashing a UEFI-fluent VM in the Command Blather upward

Less competent from Cabin, you can in addition devise a UEFI VM from the terminal. This can be realistic if you donned’t pine to installed supplemental dependencies on your unit.

To lug out this, open a brand name-neoteric terminal session and also copy the non-Safeguard Boot UEFI variables to your KVM’s NVRAM magazine:

sudo cp /usr/share/edk2/ovmf/OVMF_VARS.fd /var/lib/libvirt/qemu/nvram/YOUR-VM-NAME_VARS.fd

Paste the obeying jabber of code to your terminal:

sudo virt-install      --graphics vnc      --name YOUR-VM-NAME --memory 4096      --vcpus 2 --disk size=40 --boot uefi      --cdrom /PATH/TO/YOUR/INSTALLER/FILE.iso

Amend the attractions for “–name” wearing the super same name that you’ve supplied for your UEFI variables. In my spanning, it will be “Fedora-UEFI-MTE_VARS.fd.”

A terminal wearing a highlight on virt-installed's name flag merit.

Tweak the “–retrospect”, “–vcpus”, and also “–disk size” flags to the attractions that you pine for your VM.

A terminal attesting a highlight on the VM-choosy variables for the brand name-neoteric VM.

Chit: The retrospect flag interprets attractions in megabytes while the disk size flag kits it in gigabytes.

Press Amass in to dashed virt-installed and also overture your UEFI VM.

Open virt-visitor to accessibility your VM’s visual brandish:

sudo virt-viewer YOUR-VM-NAME
A screenshot attesting Fedora 39 sprinting on UEFI mode in a VM.

Substantiate that your unit is sprinting on EFI mode by list the materials of “/sys/firmware/efi.”

A screenshot attesting the materials of the "efi" folder for the present VM.

Unleashing UEFI-mode KVM digital fitters in Linux is simply one of the few points that you can lug out wearing virtualization. Situate out how you can share your VirtualBox VM across unalike equipments grossing earn serviceability of of ExFAT disks.

Image credit reports: Sanni Sahil wearing Unsplash. Unanimously corrections and also screenshots by Ramces Red.

Related Posts