You are currently viewing Home Assistant OS VM, This HAOS (Home Assistant Operating System) VM is running

Home Assistant OS VM, This HAOS (Home Assistant Operating System) VM is running

Anyone venturing into the world of professional home automation will quickly come across Home Assistant OS (HAOS). Home Assistant OS VM puts an end to the search for the perfect hosting environment, which often feels like an odyssey. While many start with Windows-based solutions or Docker containers, experience shows that if you want it to run truly stable—including HomeKit and Google Home—there’s no way around KVM on Linux.

This guide is for everyone looking for a solution that doesn’t just “somehow” work, but remains permanent and performant. Compatible with Linux Mint, Ubuntu, Debian, and all other Debian-based distributions.

Video: Home Assistant OS VM, This HAOS (Home Assistant Operating System) VM is running

Language: 🇩🇪|🇬🇧
☝️ Use YouTube subtitles for all languages.

Why other platforms often fail

Windows, VMware, VirtualBox, and Hyper-V

Many start with VirtualBox or VMware under Windows. For a 24/7 smart home, however, this is a dead end:

  • Network Isolation: Windows hypervisors have massive problems with mDNS (Multicast DNS). HomeKit and Google Home rely on mDNS to find devices. In a virtualized Windows environment, this traffic often “dies” at the virtual bridge.
  • Resource Overhead: Windows consumes too much RAM and CPU as a host. Additionally, background updates often lead to unwanted restarts of the entire smart home center.
  • Hardware Passthrough: Passing through USB sticks (Zigbee, WLAN) is unstable. After a reboot, the VM often loses the connection to the hardware.

The Docker Limitation

Docker is efficient, but unsuitable for HAOS if you want the full range of functions (Supervisor, Add-ons, Backups). Furthermore, network configuration for HomeKit in Docker environments is a nightmare, as the container requires direct access to the host network stack, which often leads to port conflicts.


The Solution: KVM under Linux

KVM (Kernel-based Virtual Machine) is integrated directly into the Linux kernel. It offers the performance of a “bare metal” installation. It is the gold standard for mDNS stability and thus the basic requirement for a functioning HomeKit and Google Home integration.


Connectivity: LAN vs. WLAN

The Advantages of a LAN Connection

A smart home server belongs on an Ethernet cable. LAN offers minimal latency and maximum stability. Since most WLAN chipsets on the host do not support “bridging” (they only allow one MAC address), the VM must be connected via a NAT network. This is where our network fix (see below) comes into play.

The WLAN Solution (With a dedicated USB stick)

If no cable is possible, standard VMs usually fail miserably. The solution: a dedicated USB WLAN stick passed through exclusively to the VM.

  • Advantage: The VM receives its own real IP from the router and bypasses the mDNS problem via hardware.
  • Important: Even when using WLAN, the following network fix is advisable as a “management backup” to guarantee access from the host to the VM at all times.

Step-by-Step Installation Guide

1. Download & Prepare the Image

Download the current KVM image (.qcow2):

Unpack the file. The best place for storage under Linux is the default directory for VM images to avoid permission issues:

# Create Directory
sudo mkdir -p /var/lib/libvirt/images

# Copy to the destination (example path)sudo cp /pfad/zu/deinem/download/haos_ova-xx.x.qcow2 /var/lib/libvirt/images/home_assistant.qcow2

2. Install KVM & Management Tools

sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
sudo adduser $USER libvirt
sudo adduser $USER kvm

(Afterwards, log out and log back in once!)

3. The Network Fix (Essential for LAN & HomeKit)

To ensure communication between the host and the VM (and thus HomeKit/Google Home) works over the virtual bridge virbr0, we need to adjust the iptables.

Create the script:

sudo nano /usr/local/bin/ha-network-fix.sh

Insert content:

#!/bin/bash
sysctl -w net.ipv4.ip_forward=1
iptables -A FORWARD -i virbr0 -j ACCEPT
iptables -A FORWARD -o virbr0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE

Grant permissions: sudo chmod +x /usr/local/bin/ha-network-fix.sh

Systemd service for autostart:

sudo nano /etc/systemd/system/ha-network.service

Content:

[Unit]
Description=HA Network Fix
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/ha-network-fix.sh

[Install]
WantedBy=multi-user.target

Enable: sudo systemctl enable --now ha-network.service

4. Creating the VM in Virt-Manager

Open the Virtual Machine Manager.

“New Virtual Machine” → “Import existing disk image”.

Select /var/lib/libvirt/images/home_assistant.qcow2.

At the bottom, select “Choose the operating system you are installing.”
Here we use Debian 13. To get a selection displayed, simply enter “deb” in the search field. Then select “Debian 13” and click → “Forward”.

For the installation, we increase the memory from 2048 MB to 6000 MB and set the CPUs to 6 cores. Note that you are limited to the maximum values your hardware physically supports. After the installation, you can reduce the values again. This is only for a faster installation. Then click → “Forward”.

Name of the virtual machine / Presettings

  • Name of the VM: Assign a name.
  • Customize configuration before install: Enable – important!
  • Network: Select “Virtual Network ‘default’: NAT”. If you receive a message that it is disabled, click “Enable”.

Then click → “Forward”.

Configuration before installation

  • Chipset: q35 – should already be preselected; otherwise select it manually.
  • Firmware: Be sure to select UEFI x86_64:/usr/share/OVMF/OVMF_CODE_4m.fd. This option should work. If you are using different hardware, you may need to try the other available options to find a compatible one.

Optional for WLAN

“Add Hardware” → “USB Host Device” → Select your USB WLAN stick.

Now you must click “Begin Installation” in the upper left corner!


Data Migration

If you want to migrate data from an already existing instance, please copy a backup of your old installation from Mount-Point/Volume/ha/config/backups to the desktop of the computer on which the new virtual machine is running.

Tips!!!

Start a backup manually directly before copying the backup if you want to migrate data, so that the most current state of the data possible can be migrated.

Disable the old installation or shut down the installation. Otherwise, there will be conflicts with the identities when the new HAOS installation tries to access your devices/sensors while your old installation still has control over them.

Start the Home Assistant interface as shown in the VM window, for example in a browser:

http://192.168.122.114:8123

Select “Create my smart home”, “Home Assistant Cloud”, or “Upload Backup” on your start screen.

In the video, we do this using “Upload Backup”.


Operation

If you have created a new smart home, you can now continue with the setup, configure your integrations, and add your devices.

If you selected “Restore Backup”, you must first restart your integrations or restore the configuration through the service login.

In the video, this is shown using the Tuya Smart app integration.

Setting up a second USB WLAN adapter

Go to “Settings” → “System” → “Network” and configure the USB WLAN stick as shown in the video.

Under network interfaces, you will find two network adapters. We are editing the network adapter that is displayed on the HA VM screen as “Without Address”.

Follow the video here as well for the details.

Install File Editor and configure trusted proxies. This is also demonstrated in the video using the graphical interface.

Automation

Automatic System Startup

To ensure that Home Assistant starts up immediately after a host reboot:

virsh autostart [Your_VM_Name]

The Shutdown Problem

Automatic shutdown via the host often does not work with HAOS.

  • Why? HAOS often does not react fast enough to the ACPI signals from KVM. The host then “kills” the VM hard after a timeout.
  • The Danger: This can corrupt the Home Assistant database.
  • Important: Before you switch off the Linux host, always shut down Home Assistant manually via the interface (Settings -> System -> Hardware -> Shutdown).

Donate Bild

Support / Donation Link for the Channel
If my posts have been helpful or supported you in any way, I’d truly appreciate your support 🙏

PayPal Link
Bank transfer, Bitcoin and Lightning


#SmartHome #HomeAssistant #Linux #KVM #HomeKit #GoogleHome #SelfHosting #LinuxTips #HAOS

Leave a Reply