NUC image with qemu/kvm

I bought NUC for ZoneMinder (recording is saved to NAS) and migrating HassOS from Rpi and maybe some other VM’s in future.

Now I have Ubuntu 20.04 as Host OS and use virt-manager for managing virtual machines. First VM with Debian Stretch and ZoneMinder working fine, but I can’t get next VM with HassOS working.

I tried to burn NUC image with Etcher to usb drive and assign it to VM -> no luck. Tried to convert nuc image to qcow2 and assign to VM -> no luck. Tried to add image as next storage and boot from it -> no luck. With every attempt I’m stucked on “Booting from Hard Disk” and nothing happens.

Have anyone idea what could be wrong or is there someone, who run NUC image in KVM? I prefer HassOS instead of Docker or another VM with Docker. Or will be better to start with Docker? Have Docker version supervisor, plugins and updating from lovelace?

Home Assistant Supervised runs in docker as well, all the add-ons are just docker containers. HassOS is the base OS, you can also install Home Assistant Supervised on a generic linux install. I run it on a VM with Ubuntu Server as the OS. See the installation instructions here for more details.

This will be last option. My progress with Hass was virtualenv in LXC running on router -> VM running on NAS -> HassOS on rpi4. And I love HassOS for “maintenance free” OS, it’s much better than virtualenv installation. So now I’m trying to get NUC image working, but if all fails, probably VM with Docker will be last option

1 Like

I’m not sure I can help as I have not tried your scenario, but I boot my VMs from an image in ISO format in a directory somewhere on the hard disk drive, and have virt-manager boot from the HDD instead of a USB. If you can convert your NUC image to ISO, then try it on your hard drive.

Did you get it working? I am having the same issue.

Not yet, I don’t have too much free time now, so still running on Rpi. I’ll try it again in a few days

I got it working!

wget https://www.kraxel.org/repos/jenkins/edk2/edk2.git-ovmf-x64-0-20200422.1380.gfaef5a367c.noarch.rpm
apt-get install rpm2cpio cpio
rpm2cpio edk2.git-ovmf-x64-0-20200422.1380.gfaef5a367c.noarch.rpm | cpio -idmv
virsh edit ha

added in os section, loader with one of the downloaded files

  <os>
    <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
    <loader readonly='yes' type='rom'>/srv/dev-disk-by-label-m3/public/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <boot dev='hd'/>
  </os>

also, changed network adapter from virtio to e1000e, and disk bus changed from virtio to sata.

Notes:

What helped me find the solution this comment: Stuck at boot menu when using VMDK image and QEMU · Issue #151 · home-assistant/operating-system · GitHub
Apparently main point was to “Install edk2-ovmf to be able to boot as UEFI”.
From this link How to run OVMF · tianocore/tianocore.github.io Wiki · GitHub I found pre-built image of OVMF link here Index of /repos
I am using hassos_ova-4.6.qcow2 from HA website.

Still no success, I have only black screen after boot with this edk2-ovmf :frowning:

Can you post full config of your virtual machine? The one which is in virsh edit [machine]

Here is example of VM created in VirtManager - network e1000, disks bus sata, first disk (boot) qcow2 from HA website and second is empty for installation, edited loader with edk2-ovmf - https://pastebin.com/n6zKEBmz

That first image you have there simply expands, so there is no need for second disk(also, there’s no installation, it’s more like unpacking of HA inside as I understood). But that shouldn’t be a problem.
I compared to mine, and see nothing that I can point my finger at…
Here is my config which is working for me, have a look and maybe you’ll get some ideas https://pastebin.com/2x3qhKsG
I changed network to virtio and it works as well. My current VM working for everything except my Aqara gateway - multicast seems to be not working which I can’t fix.

Finally, got it working too :slight_smile:

What helped for me

  • reboot host (NUC) and go to BIOS (F2)
  • reset to defaults
  • disable secure boot (ubuntu booting with uefi)
  • allow third party uefi drivers

Now I can boot official IntelNUC image from Hass website with default OVMF in virt-manager (/usr/share/OVMF/OVMF_CODE.fd)

Resizing downloaded image to bigger size:

  • download Gparted live image
  • power off HA VM
  • qemu-img resize hassos_intel-nuc-3.13.img +200G
  • add Gparted image to VM and set as first on boot
  • in Gparted, resize the partition hassos-data
  • shutdown VM and remove Gparted iso

Now I need to find some time, to move all from RPi to NUC and start enjoying more power :smiley:

1 Like

One more point…I use Nuc image because qcow2 image is still in beta. If you want snapshots in Qemu, convert image to qcow2 with this command:

qemu-img convert -f raw -O qcow2 hassos_intel-nuc-3.11.img HassOS.qcow2

using virt-manager on Ubuntu 20.04 , I’m able to get HA to start but after a few min HA hangs. Similar experience with a converted nuc image, vdi image or the qcow2 beta.

i’m migrating from virtualbox to virt-manager and would like to see it stable before proceeding with the migration. Link to details

I manage to use home assistant with Ubuntu 20.04 installed on an old Mac Book Pro

I install the desktop version so I am using nmcli to setup the network instead of /etc/network/interfaces

This is basically what I did:

  1. Install KVM and ovmf (this is for KVM UEFI bios)
sudo apt-get install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager ovmf
  1. Setup bridge network. My wired network is enp2s0, run “nmcli con show” to get the one use by your linux box
sudo nmcli con add ifname br0 type bridge con-name br0
sudo nmcli con add type bridge-slave ifname enp2s0 master br0
sudo nmcli con down "Wired connection 1"; sudo nmcli con up br0
  1. Download Home Assistant qcow2 image.
  2. extract, use gunzip -k so if things goes wrong, you can extra a new image :slight_smile:
  3. Create the VM using this command:
virt-install --name hassos --memory=2048 --vcpus=2 --disk=hassos_ova-4.10.qcow2,format=qcow2 --boot uefi --import --os-variant=debian9 --network=bridge=br0

The trick is --boot uefi to setup UEFI boot and --os-variant=debian9 to make use of virtio driver for disk and network for less resource usage. Adjust cpus and memory to your own need.

Reference:
Ubuntu 20.04 KVM install: https://linuxconfig.org/install-and-set-up-kvm-on-ubuntu-20-04-focal-fossa-linux
Bridge network setup using nmcli: https://www.cyberciti.biz/faq/how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/

1 Like

I downloaded the qcow2 image (no longer showing as beta) for 111.4 and spun it up with virtual-manager. So far have not had any problems, but I’m not doing much with it at the moment…just wanted to try it out.

got it running but finally decided to run it via Docker over Ubuntu, its much faster.