Installing HAOS in a VM on TrueNAS SCALE

The CPU cooler is what came with CPU in retail and seems adequate. I not sure if the model is related as it seems to be a hybrid (i5-13500). I found the cores were spiking which causes the heat.
I’m still on the BETA because I made the mistake of upgrading the ZFS which not downgradable. It seems to have settled since playing with 2xvCPU, 1xCore, 2xThread, 2Gb. Hoping next update will address problem.

EDIT: Simply remove the port from the NIC and it’ll automatically assign one and get rid of the error.

I’m not sure this tutorial is working for TrueNAS-SCALE-22.12.3.3.

I’ve followed the guide step by step and event tried 2x times in case I had forgotten something the first time.

I’m getting the following error:

> [EFAULT] internal error: process exited while connecting to monitor: 2023-09-11T19:51:36.924944Z qemu-system-x86_64: warning: Spice: reds.c:2655:reds_init_socket: binding socket to 10.0.10.13:5901 failed 2023-09-11T19:51:36.925092Z qemu-system-x86_64: warning: Spice: reds.c:3516:do_spice_init: Failed to open SPICE sockets 2023-09-11T19:51:36.925372Z qemu-system-x86_64: failed to initialize spice server

I tried the fix from this pr and it didn’t worked.

add the following line to /etc/libvirt/qemu.conf:

spice_listen = "::1"

Any help is appreciated.

1 Like

Hi,

Thank you for this tutorial and sources !
I was able to install HAOS without any troubles and restored my backup from a Raspberry Pi.

Everything went well except one thing … suspense … my Conbee II dongle !! haha

I tried to follow other experienced solutions from this thread and from other forums but no luck.

From the VM Devices (TrueNas Scale side) I added a USB Passthrough with these settings :
USB passthrough

On Hassio, under the “all materials” settings (sorry for translation, I have the interface in french), when filtering on “conbee” I have no results.

When trying to use any of the listed serial ports in ZHA to reconfigure it, none of them is accepted (e.g: /dev/ttyS0 ).
Even with the “by-id” path : /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DEXXXXXXXXXX

I also looked for the PCI Passthrough solution, but TrueNas Scale does not offer me any options, the select input is empty.

So by now, I’m stuck. Do you have any solution in mind ?

TrueNAS-SCALE-22.12.3.3
Home Assistant 2023.8.4
Supervisor 2023.08.3
Operating System 10.5
Interface utilisateur : 20230802.1 - latest
Conbee II Firmware : deCONZ_ConBeeII_0x26780700 (updated following official Conbee documentation)

1 Like

Hi @gravelfreeman - Sorry for the delay. Glad you got it sorted!

Hi @XavLal - For the Conbee II, there may be a final option, but it’s not great - basically, you can use a script to start the VM. This will attach the ConBee II before Home Assistant or any add-ons can start.

This can get annoying, but it’s at least something to try if you don’t restart your VM very often. To start the VM automatically when TrueNAS boots, you can set this script to run at start-up.

To see if this works, copy the script to your NAS and make it executable. You only need to edit the name of your VM before running the script. If you have questions about how to run this script, I can try to help, but time is short cause work is crazy right now.

#!/bin/bash

## Set the name of your VM
vm='HomeAssistant'


if [ ${EUID} -ne 0 ]; then
  echo "Please run this script as root or using sudo" ; exit
elif [ -z "${CONBEE:="$(ls /dev/serial/by-id/*ConBee_II*)"}" ]; then
  echo "ConBee II not found" ; exit
fi

## HEREDOC: ConBee_II.xml
read -r -d '' XML << END_XML
<serial type="dev">
  <source path="${CONBEE}"/>
  <target type="usb-serial" port="1">
    <model name="usb-serial"/>
  </target>
  <address type="usb" bus="0" port="4"/>
</serial>
END_XML

# create a temporary file containing the ConBee II HEREDOC
conbee_xml=$(mktemp -t conbee.xml.XXXXX)
echo "${XML}" > "${conbee_xml}"

# get id and use it to start the VM
id=$(/usr/bin/midclt call vm.query | /usr/bin/jq -r '.[] | ( .id|tostring ) + ":" + .name' | /usr/bin/grep "${vm}" | /usr/bin/cut -f1 -d':')
/usr/bin/midclt call vm.start "${id}" &> /dev/null
sleep 1

# get VM name and use it to attach the ConBee_II
name=$(/usr/bin/virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" list --name | /usr/bin/grep "${vm}")
/usr/bin/virsh -c "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" attach-device "${name}" "${conbee_xml}"

# remove the temporary file
rm "${conbee_xml}"

Hi @troy,

Thank you for your quick answer ! I really appreciate it.

Before trying your solution, I dug a little deeper into the issue of PCI Passthrough not offering me any options.

And I found something about IOMMU, in fact this option was not enabled in my BIOS.
As I have an intel processor, the option to enable is VT-D.
This option is the one which allow to pass a pci device to a virtual machine, seems to be a basic information I was missing.

After TrueNas Scale reboot, I checked the PCI Passthrough settings for my VM and this time many options were displayed !!

So I picked the USB controller entry with xhci thing inside and it worked on the first try :smiley:

I get, almost, everything back. Still have issues with HACS and some ZigBee detectors, but I will take time to check that.

Thanks again !

1 Like

Hello lads.
How can I set up Emulated-Hue?
I’ve tried a thousand ways but Alexa doesn’t see the exposed devices.

Has anyone experienced issues with addons? I’ve noticed a lag with the with loading pages such as addons, devices, automations. I run Zigbee2MQTT on a separate pi and also notice a lag when operating devices via HA.

2023-10-04 14:59:44.277 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /addons/core_configurator/stats request
2023-10-04 14:59:44.277 WARNING (MainThread) [homeassistant.components.hassio] Could not fetch stats for core_configurator:
2023-10-04 14:59:44.278 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /addons/core_mosquitto/stats request
2023-10-04 14:59:44.278 WARNING (MainThread) [homeassistant.components.hassio] Could not fetch stats for core_mosquitto:
2023-10-04 14:59:44.278 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /addons/core_mariadb/stats request
2023-10-04 14:59:44.278 WARNING (MainThread) [homeassistant.components.hassio] Could not fetch stats for core_mariadb:

Hello,

I am receiving an error. The TrueNAS console is saying “zsh: command not found: qemu-img” when I try to run the last line of your guide.

Any help would be greatly appreciated.

I wonder if the $PATH variable is set for your user :thinking:

You can try using the full path

/usr/bin/qemu-img convert -O raw haos_ova-10.5.qcow2 /dev/zvol/tank/vm/haos

Also, the command should be run as root or using sudo

Hi i have a question what am i doing wrong can you help me because i tried everything and i cant instal HAOS.
Here is some screenshots.!

Here is my Zvol Details

Maybe this will work? Notice the path to your zvol should start with /dev/zvol

qemu-img convert -O raw haos_ova-10.5.qcow2 /dev/zvol/Proba/home_vm1

Thanks for the help everything went through good, but i have another problem.
I install everything again but still the same problem

I’m a bit confused myself… Please share how you got to this login.

For example, did you click the VM display button?

I’ve never experienced any kind of lag or delay but I only use 5 addons.

I really don’t have any idea. Maybe some things to check might be:
How did you configure the CPU for your VM?
How much RAM did you give the VM?
Does the ZPOOL have enough free space?
Is your ZVOL getting full?

Just making some guesses about things that might affect performance.

Т


his is what happens when i open the display.

and here is my VM settings

And here is my VM settings. I did change them before was like you suggested.
Here is ZVOL settings

OK, thanks for the screenshots. I see a problem - notice how only 588MiB of data is written.
image

It should use more space than this (after it starts the first time). It looks like HAOS has failed to expand correctly. You may need to try again.

I just created a test VM to grab some screenshots. The first screenshot is right after running the qemu-img convert command. Notice that the data written is around 574 MiB - right now, this looks good because I have not started the VM yet.

Next, I’ll start the VM for the first time. I give HAOS a few minutes to start and recheck ZVOL details. Notice the data written has increased to 3 GiB. We want to see this as it indicates successful file system expansion!


I can see here you have tried this a few times.

Let’s delete ALL of those downloads and extracted images, then try again.

rm haos_ova-10.5.*

Your ZVOL size looks good, so we can just overwrite the existing install with a fresh one. You can still use the existing VM as well, just make sure it’s stopped before moving on.

wget https://github.com/home-assistant/operating-system/releases/download/10.5/haos_ova-10.5.qcow2.xz
unxz haos_ova-10.5.qcow2.xz
qemu-img convert -O raw haos_ova-10.5.qcow2 /dev/zvol/Proba/home_vm1

If you have any errors, stop, and please share the output from all the commands you have run to that point. After running qemu-img convert, check your ZVOL details, and you should have around 574 MiB of data written. If that looks good, start the VM and give it an extra minute or two for the initial bootup. Check your ZVOL details a final time and hopefully, you see around 3 GiB of data written.

Good luck!

EDIT: Looking at your VM setting - I also recommend the following changes.

There’s nothing wrong with having loads of CPU HAOS, but unless you know it’s needed, you can also reduce the number of threads to free up resources for TrueNAS.

Thank you so much. It work, so i did it with sudo and change every setting like you suggested.

.

Now is working, but I can’t install Supervisor and HAES