pablohoney Posted April 9 Posted April 9 Setup Home assistant VM a few weeks ago following these instructions: https://developer.isy.io/blog/Home Assistant Did updates yesterday to Home Assistant and am now getting an "Unsupported system - virtualization_image" error. Screen capture below and HA information on this error here: https://www.home-assistant.io/more-info/unsupported/virtualization_image HA state solution is to reinstall Home Assistant OS using an image which supports being run on a virtualized system. Will this be supported on the eisy?
stevesreed Posted April 9 Posted April 9 (edited) I got that initially, but I tried again later and it worked fine. I'm not sure what changed. Maybe it was fixed with 2024.4.2, which came out yesterday, but maybe after my first attempt and before my second? Edited April 9 by stevesreed
pablohoney Posted April 9 Author Posted April 9 I'm running 2024.4.2 and have the error. Did a restart of HA and error remains.
apnar Posted April 10 Posted April 10 The error is legit, but it is just a warning. The script on the blog uses the generic x64 OS image instead of one of the VM tailored images. They don’t have a FreeBSD VM image specifically but when I have some time I’ll see if I can get one of the other VM images running instead. For now it should be reasonably safe to ignore.
pablohoney Posted April 10 Author Posted April 10 Thanks for the insight on the image used in the script. I've done 3-4 updates and the error just now displayed.
apnar Posted May 3 Posted May 3 (edited) I finally had a few cycles to take a look at this. I wrote up a modified script that will use the VM based Home Assistant images instead of the one meant for bare metal. I also added some other tweaks that allow you to choose to enable access to the VM via console, VNC, and SSH during install. Unfortunately there isn't an easy way to "fix" an existing install so you'll need to start from scratch or you can try backing up and restoring your HA config but no guarantees there. To start this will delete your current VM and all related configs. It will completely destroy your existing Home Assistant VM so only run this if you want to start fresh or are sure you have all the backups you need. sudo vm poweroff -f homeassistant sudo vm destroy -f homeassistant sudo vm switch destroy public sudo zfs destroy storage/vms Here is a new create_ha_vm.sh script. Save it and run it with sudo. see updated version below @Michel Kohanim it might be worth updating the blog post with this script so new installs get the proper image. Edited May 9 by apnar removed script as updated posted
tazman Posted May 5 Posted May 5 @apnarI ran your script and it seemed like it ran fine except for an error on line 126 which I think should not affect HA. It shows like homeassistant VM is running but homeassistant.local:88123 does not come online at all and not even showing up in my router with an IP address. If I go to the VNC address it has a shell prompt but if I back out of that it seems like it is the Bhyve loader and I think HA is crashing but can not find any proof of that. I was able to rerun my old script an load the old HA again with no problem.
apnar Posted May 9 Posted May 9 @tazman thanks for giving it a try. Took me a bit but I tracked down the issue. I use a significantly bigger sized virtual disk in my setup but had dropped it down to 16GB when I uploaded it to match what was in the original script. Even though the OVA file from HA is only 800MB they have it configured as a 32GB virtual disk so when it was trying to be copied to the smaller 16GB volume it errored out. Guess that's what I get for thinking a small tweak wouldn't cause any issues. As to the error on line 126, I'm not seeing that but suspect it might be related to posting the shell script on the forum. So I added some extra quoting and I'll upload it as a file here in addition to pasting it. Updated version: #!/bin/sh # Where do we want to storge VM resources (ZFS pool name and mount path) VMFILESET="storage/vms" VMDIR="/storage/vms" # Home Assistant VM name and how much resources to allocate HA_VM_NAME="homeassistant" HA_VM_CPU="2" HA_VM_MEM="1G" HA_VM_DISC="32G" # specify network interface - by default it's Ethernet re0 INTERFACE="re0" if [ $(id -u) != "0" ] then echo "Must be run with sudo" exit fi # Automatically pick the latest release from https://github.com/home-assistant/operating-system/releases/ HA_IMAGE_URL=$(curl -sL https://api.github.com/repos/home-assistant/operating-system/releases/latest | \ grep "browser_download_url.*haos_ova.*qcow2.xz" | sed -e 's/.*: "\(.*\)"/\1/') # Internal variables TMPDIR=`mktemp -d` IMAGE_NAME="${TMPDIR}/haos_ova-x86-64.img" VM_CONF=${VMDIR}/${HA_VM_NAME}/${HA_VM_NAME}.conf # make sure ifconfig_DEFAULT is not set as it causes tap0 interface issues # ensure re0 is set to DHCP sysrc -x ifconfig_DEFAULT sysrc ifconfig_re0="DHCP" echo "Make sure necessary packages are installed" pkg install -y vm-bhyve edk2-bhyve wget qemu-tools echo "Prepare /etc/rc.conf" sysrc vm_enable="YES" sysrc vm_dir="zfs:${VMFILESET}" # this makes Home Assistant VM start up automatically on boot, comment out if this is not desired sysrc vm_list=${HA_VM_NAME} echo "Create ZFS fileset for VMs and prepare templates" zfs create ${VMFILESET} vm init cp /usr/local/share/examples/vm-bhyve/*.conf ${VMDIR}/.templates/ # create VM networking (common for all VMs on the system) vm switch create public vm switch add public ${INTERFACE} echo "Downloading image" wget -O ${IMAGE_NAME}.xz ${HA_IMAGE_URL} echo "Extracting..." unxz ${IMAGE_NAME}.xz echo "Creating a VM" vm create -t linux-zvol -s ${HA_VM_DISC} ${HA_VM_NAME} echo "Image info:" qemu-img info ${IMAGE_NAME} echo echo "Copying image... (may take a bit of time)" qemu-img convert ${IMAGE_NAME} /dev/zvol/${VMFILESET}/${HA_VM_NAME}/disk0 rm -rf ${TMPDIR} GRAPHICS=0 echo -e "\n\nDo you want to enable unauthenticated VNC access to your Home Assistant virtual machine? (y/N)" read answer if [ "$answer" = "Y" ] || [ "$answer" = "y" ] then GRAPHICS=1 sysrc -f ${VM_CONF} graphics="yes" fi ## Initial setup TMPDIR=`mktemp -d` # set zvol to full so partitions are visable zfs set volmode=full ${VMFILESET}/${HA_VM_NAME}/disk0 sleep 2 # set baud rate for serial console mount -t msdosfs /dev/zvol/${VMFILESET}/${HA_VM_NAME}/disk0p1 ${TMPDIR} # add serial console to linux boot command line sed -i '' -e 's/console=ttyS0/console=ttyS0,115200/' ${TMPDIR}/cmdline.txt # umount device umount ${TMPDIR} SSH=0 echo -e "\n\nDo you want to enable SSH access to your Home Assistant virtual machine? (y/N)" read answer if [ "$answer" = "Y" ] || [ "$answer" = "y" ] then SSH=1 ## SSH Access # install ext4 fuse driver and load it pkg install -y fusefs-lkl kldload fusefs # mount vms /root/.ssh directory lklfuse -o type=ext4 /dev/zvol/${VMFILESET}/${HA_VM_NAME}/disk0p7 ${TMPDIR} sleep 5 mkdir -p ${TMPDIR}/root/.ssh chmod 700 ${TMPDIR}/root chmod 755 ${TMPDIR}/root/.ssh # create a new SSH keypair and at it as an authorized key in the VM ssh-keygen -t ed25519 -N "" -C "Access Home Assistant running on eisy on port 22222" -f /home/admin/ha-ssh-key cp /home/admin/ha-ssh-key.pub ${TMPDIR}/root/.ssh/authorized_keys # set perms so admin user can access the ssh keys chown admin:admin /home/admin/ha-ssh-key* umount ${TMPDIR} fi ## Clean up # switch zvol mode back to normal zfs set volmode=dev ${VMFILESET}/${HA_VM_NAME}/disk0 sleep 5 rmdir ${TMPDIR} sysrc -f ${VM_CONF} loader="uefi" sysrc -f ${VM_CONF} cpu=${HA_VM_CPU} sysrc -f ${VM_CONF} memory=${HA_VM_MEM} vm start ${HA_VM_NAME} vm info ${HA_VM_NAME} vm list echo -e "\n\n##########################################################################\n" echo "Please wait about 10 minutes and follow instructions at https://www.home-assistant.io/getting-started/onboarding/ to get your Home Assistant setup" echo "ISY integration: https://www.home-assistant.io/integrations/isy994/" echo -e "\nIf you need console access to the HA VM you can run \"sudo vm console ${HA_VM_NAME}\" then log in is as root. Use \"~~.\" to exit." if [ "$GRAPHICS" -eq "1" ]; then echo -e "\nYou can access your HA VM via VNC on port 5900 at your eisy's IP address." fi if [ "$SSH" -eq "1" ]; then echo -e "\nYou can access your HA VM via SSH using \"ssh -p22222 -i ha-ssh-key root@{HA VM IP}\"" fi md5 of script is 93f64d030f2531578df06c46d35c8056 create_ha_vm.sh
tazman Posted May 10 Posted May 10 @apnar thanks for your work on this! I was giving mine 50G of space so that should not have been a problem for me. I will give it another try over the weekend.
tazman Posted May 11 Posted May 11 @apnarthank you for your work on this! I downloaded the file and everything worked for me and I only change 2 lines HA_VM_MEM="2G" HA_VM_DISC="60G" 1
Recommended Posts