How to boot a UEFI image from a KVM virtual machine without `virt-manager`? (e.g. Home Assistant on OpenMediaVault/Cockpit)

Super User Asked on January 1, 2022


I would like to run Home Assistant (HASS) in a virtual machine on OpenMediaVault 5. Up until OMV 4, this was easy because OMV (and the underlying Debian) supported VirtualBox and VB apparently didn’t have any problems booting UEFI images. Because OMV 5 (and the underlying Debian 10) no longer support VirtualBox, OMV now uses KVM (libvirt) for virtual machines (and it supports Cockpit to manage them). Unfortunately, this entails that it is no longer trivial to boot UEFI images on OMV/Debian 10, and – you guessed it – the official Home Assistant image for KVM (QCOW2) needs UEFI and trying to import and boot it in Cockpit will fail. I was unable to find any button or command in Cockpit that allows me to set the boot mode to UEFI.

The challenge (in more generic terms)

So what I’m trying to achieve is to boot a QCOW2 image in UEFI mode on a headless system, i.e. without virt-manager. (If you are on a desktop machine, I believe you won’t have this problem but can just use virt-manager instead of Cockpit.)

So how do you do it?

One Answer

Disclaimer: I am not really familiar with UEFI, don't even know exactly what it does, so if this answer can be improved, please comment or edit accordingly.

This is what worked for me:

apt-get install ovmf
cd /usr/share/ovmf/

Check that the file OVMF.fd is there, because that is what libvirt needs to boot the image. (If yours is somewhere else for some reason, find it and change the path below accordingly.)

Assuming that you already have created a virtual machine called HASS (using the import image button in Cockpit and using the QCOW2 image provided on the home assistant installation page, you can now edit that VM on the command line (make sure the machine is turned off before proceeding):

virsh edit HASS

Locate the section, mine looked like this:

     <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
     <boot dev='hd'/>

And insert <loader readonly='yes' type='rom'>/usr/share/ovmf/OVMF.fd</loader> after the type tag:

     <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
     <loader readonly='yes' type='rom'>/usr/share/ovmf/OVMF.fd</loader>
     <boot dev='hd'/>

Save and exit and you're done. If you now start VM it should boot the HASS image.

Answered by Christoph on January 1, 2022

Add your own answers!

Related Questions

Creating a symbolic link to mapped network drive in Windows

8  Asked on December 31, 2020 by vegard-larsen


Bash files open terminal when opened

1  Asked on December 31, 2020 by chris-smith


S3 command not working in cron

1  Asked on December 31, 2020 by kargirwar


Scale to fit option

6  Asked on December 30, 2020 by steven-penny


After downloading Tweepy I don’t know where to locate it

1  Asked on December 30, 2020 by candle


Excel COUNTIF with non-contiguous named ranges

1  Asked on December 30, 2020 by malan88


How to bypass Windows 10 PIN complexity requirement

1  Asked on December 29, 2020 by some-user


Resume uploading with built-in Windows FTP client

1  Asked on December 29, 2020 by vlad-novakovsky


What is the Windows analog of the Linux watch command?

15  Asked on December 29, 2020 by peterjclaw


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir