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’

Hi MJ,

Sorry for not getting back to you earlier.

I have not tried installing the guest tools, don’t think I need them.

Folks…
I’m very very new to Home Assistant and also new to xcp-ng. After considerable bashing around I have discovered that installing Home Assistant under xcp-ng is trivially easy (but YMMV!) and (perhaps most importantly) after following the procedure below I see that guest tools are available. Here are the steps I followed:

  1. Download the OVA file provided at OVA file for VMware ESXi/vSphere
  2. In Xen Orchestra choose Import in the left-hand pane. Then select the VM tab choosing the appropriate pool and SR.
  3. At this point you should be able to drag and drop the OVA file you downloaded into the provided area on this page (at least in Windows). This should immediately create a VM and take you to the page for that VM. Under the Advanced tab I changed the bios setting to EUFI and saved the setting.
  4. Start the VM using the appropriate button.
  5. Select the Console tab and watch the VM start.
  6. Proceed with the next step in the installation as documented at Onboarding

Hope that helps!

…Chris