Using Xen for installing Home Assistant Operating System

Hi,

Since the supervised installation method is deprecated now, I needed to move my supervised-on-Xen-VM HA installation to something new.
Something new being another VM on a Debian machine.

Rough steps, assuming that you have Xen setup up and running.

  1. Backup and shutdown
    Make a last backup of your supervised setup (if you have HA running already).
    Make sure that the backup file is also available on your local PC (which you use for step 5). And that you have the encryption key. :slight_smile:

Shutdown and prevent it from turning on again (e.g. à la /etc/xen/auto).

  1. Download the HA image
    I used the .qcow2 version from Linux - Home Assistant

  2. Convert the image to .img
    Used Learning Xen: Converting Existing Non-Xen Hypervisor Images for Use in Xen

Let’s assume as output: disk-haos.img

  1. Xen config (big thanks to Claude, with some tweaking)
name    = '<your hostname>'
type    = "hvm"
vcpus   = '2'
memory  = '3072'

bios    = 'ovmf'
boot = 'c'

# Architecture specific
arch = "x86_64"
acpi = 1
apic = 1
pae = 1
hap = 1

rtc_timeoffset = 0
localtime = 0

# Memory features
shadow_memory = 16     # Adequate shadow memory

#
#  Disk device(s).
#
disk        = [ 'file:/<path>/disk-haos.img,xvda,rw' ]

#  Networking
#
vif         = [ 'mac=00:16:3E:<aa:bb:cc> ,bridge=<your bridge>'  ]

serial = 'pty'

#
#  Behaviour
#
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

The VM did not boot with more than 3072MB RAM (Grub started but then went into a reboot loop), which might be an issue with my overall setup. Did not bother yet to figure out the details.

  1. DHCP setup
    Configure your DHCP server to assign a permanent IP, based on the one set in the Xen config file.

  2. Boot and restore
    xl create .cfg
    Wait…
    Navigate to :8123
    When asked, upload the last backup.

Worked immediately for me.

  1. Additional add-ons installed
    Advanced SSH & Web Terminal
    Remote syslog support: GitHub - mib1185/ha-addon-syslog: Syslog Home Assistant AddOn - to send your HAOS logs to a remote syslog server

Hello KomtGoed,

I’m looking to virtualize my HA and found your post. I using XCP-NG as my hypervisor, a drivative of Citrix Xen. I was wondering if you were able to install the xe-guest-tools doing the install the way you did,

I used Generic x86-64 instructions to install the os and while I was able to boot the VM and connect in through the console I was not able to find any utillity to install the guest tools.

Kind regards,
MJ

Hi,
thanks for the hint. I have a running HAOS on XEN now. The Reason for the RAM ist that the standard OVMF Bios File, which is shipped with XEN is not able to do that.
i had to compile my own one with

  • sudo apt update && sudo apt install git nasm iasl build-essential uuid-dev
  • git clone GitHub - tianocore/edk2: EDK II
  • cd edk2
  • git submodule update --init --recursive
  • make -C BaseTools
  • . edksetup.sh
  • edit Conf/target.txt to
    ACTIVE_PLATFORM = OvmfPkg/OvmfXen.dsc
    TARGET = RELEASE
    TARGET_ARCH = X64
    TOOL_CHAIN_TAG = GCC5
    then do
  • build

you will get the bios files at edk2/Build/OvmfXen/RELEASE_GCC5/FV
copy it where you want to
my cfg file looks like

device_model_version=‘qemu-xen’
hdtype=‘ahci’

name = ‘smart10’
type = “hvm”
vcpus = ‘2’
memory = 8192

bios = ‘ovmf’
bios_path_override = “/etc/xen/BIOS/FV/OVMF.fd”
boot = ‘c’

Architecture specific

arch = “x86_64”
acpi = 1
apic = 1
#pae = 1
hap = 1

device_model_args_hvm = [

Debug OVMF

‘-chardev’, ‘file,id=debugcon,path=/var/log/xen/ovmf.log,’,
‘-device’, ‘isa-debugcon,iobase=0x402,chardev=debugcon’,
]

rtc_timeoffset = 0
localtime = 0

Memory features

shadow_memory = 16 # Adequate shadow memory

Disk device(s).

disk = [ ‘file:/IMAGES/XEN/domains/smart10/haos_ova-16.3.img,xvda,rw’ ]

Networking

vif = [ ‘mac=00:16:3E:87:D6:6B,bridge=xenbr0’ ]

serial = ‘pty’

Behaviour

sdl=0
serial=‘pty’
vnc=1
vnclisten=“”
vncpasswd=“”

on_poweroff = ‘destroy’
on_reboot = ‘restart’
on_crash = ‘restart’