Alternative way of running HassOS (full OS) on FreeNAS (without iocage or Docker)

Tags: #<Tag:0x00007f77ffa55d60>

While there is the possibility of installing Home Assistant on FreeNAS in iocage (or as a community plugin) or through Docker, FreeNAS also allows for the use of VMs.

This guide is not about installing Home Assistant in FreeNAS or onto a Linux VM machine running on FreeNAS but burning a HassOS virtual appliance as a VM running on FreeNAS.

Downside of running FreeNAS is that there is no clean, easy way to passing devices (ie. Z-wave/Zigbee) to the VM but otherwise this is a fully blown Hassio install. However, a Raspberry Pi running Hassio addons for Zigbee and Z-wave to MQTT can overcome this.

Requirements: FreeNAS machine, VM software running on the PC (such as Virtual Box), a way of transferring files (approx. 6GB, the size of the HassOS install) from PC to FreeNAS, terminal access to FreeNAS (or use of Shell in FreeNAS GUI).

On PC:
a. Download the virtual machine disk drive (https://github.com/home-assistant/hassos/releases/download/2.12/hassos_ova-2.12.vdi.gz) and unrar it.

b.1. Install Oracle Virtual Box if not already installed
https://www.virtualbox.org/wiki/Downloads

b.2. Convert the virtual machine disk drive (in this case vdi drive for Oracle’s Virtual Box but vmdk should work too) to img by running (if running on Windows open a Command Prompt and change directory to Virtual Box install folder - defaults to c:\Program Files\Oracle\VirtualBox)
(replace source/hassos_vm.vdi and destination/hassos_vm.img with own locations)

VBoxManage clonehd source/hassos_vm.vdi destination/hassos_vm.img --format raw

The size of the img should be around 6 GB (up from 400 MB for the vdi).

c. Copy the hassos_vm.img to FreeNAS

On FreeNAS:
d. Create a new Zvol (the difference between Dataset and Zvol is that Zvol is a chunk of block storage accessible as a raw physical drive while Dataset is file-based storage):

Navigate to Storage -> Pools and click the three dots -> Add Zvol

Set a reasonable size for the Zvol (at least 32 GiB; it should be noted that the space is immediately allocated to Zvol and not accessible for file storage anymore; this is particularly important if already running FreeNAS with free space below 20% of the pool size as it will crash FreeNAS).

The new Zvol will then be accessible at /dev/zvol/pool_name/zvol_name (its path will be needed later).

e. Create a new VM (don’t power it yet)

Step 1: Navigate to Virtual Machines add Virtual Machine (VM)
Step 2: Set Guest OS as Linux and Boot Method as UEFI
Step 3: Add number of Virtual CPUs and Memory size accessible to the VM (this can be modified later)
Step 4: Select Use existing disk image and select the Zvol created above
Step 5: Modify Network Adapter if needed (ie. in order to easily locate the NIC when router leases its IP)
Step 6: Next (don’t add installation image)
Step 7: Submit

f. Burn the hassos_vm.img to the Zvol created above by running the following command:

dd if=/mnt/pool_name/dataset_name/location_of_hassos_vm/hassos_vm.img of=/dev/zvol/pool_name/zvol_name

g. Power on the VM (hassos will then occupy the entire Zvol storage that was set above)

6 Likes

YOU ARE MY HERO!

Okay, since that is out of the way, I want to really thank you for this method. I am using HassOS for a long time now (2-3 years) on an RPI3 and it was time to amp it up a bit (since, for some reason, I could not update anymore). I also made my own NAS system with old hardware and thought, why not install home assistant on it. The only things I found was a scripted or manual install without the Hass.io addon. This addon got me on its grip since it worked flawlessly with everything I needed (duckdns + let’s encrypt), mosquito, smb, ssh.
But I was struggling to install HA in some jails but failed almost always. but when I did, there was the question, now how to install the other needed add-ons.
The only thing that would be convenient is this link to download the VBoxManage program.

This topic you made was so easy, compared with all other stuff. I thank you very much!

Now it is time to port all my configurations to this VM and set up SSL. I’ll let you know how that went.

Cheers,
Koen

You’re welcome!

Added also the link to the VirtualBox downloads page :slight_smile:

Ah I see, great.

I am now entirely done with porting everything from the rpi to the freenas VM. It took some patience, especially when reconfiguring the static IP (since I have mqtt IOT-thingy’s everywhere set at that IP).
But it is done now. Fairly easy and just how I am used to it. I only miss my RF transmitter on the GPIO. Got an alternative like something with an esp being the rf transmitter?

Thanks!
Koen

I suggest OpenMQTTGateway (MQTT connection to HA; in fact, with an Arduino Mega + Ethernet Shield + RF emitter + RF receiver is the most stable smart device I have, running without issues for more than 2 years)

I personally prefer the iocage - virtualenv install on FreeNAS but I still think this is a great post. I gave it try and everything worked great. This was super easy to have Hassio running on FreeNAS!

If I switched to Hassio, I would move it to a different device (like a NUC) but that’s just me.

I think there are a good handful (or more) of people who followed my manual install guide to run HA on FreeNAS because it seemed the only option. You should consider to change the category from “Share your Projects” to “Installation”. I suspect more people will be interested in this. Thanks to @Koen for sharing the original link. (Unfortunate it’s buried in the thread and easy to miss so I will also add a link to the OP of my install guide)

Hi There!,
Great post Patricia, this was so easy to setup and feels easy to keep updated as well. As you write the only downside is a zigbee/zwave USB interface, such as HUSBZB-1, is very hard, to pass through to the VM in the current Freenas (11.2).
However if you like me have an raspberry pi lying around, you could possibly re purpose that as a USB-server or a USB/IP interface. So Raspberry Pi with HUSBZB-1 somewhere else in the house connected to the same network as the VM and then the “USB-over-IP” connection.
I haven’t tried it yet but I’m about to.
Instructions here:
https://derushadigital.com/other%20projects/2019/02/19/RPi-USBIP-ZWave.html

Hi,

I’m using a NUC for the main HA instance (on Ubuntu Server, virtualenv) to which I have connected all the gateway peripherals (Zigbee, Z-wave and RFLink) and a separate install on FreeNAS VM for Hassio (only Hassio instance is exposed to web and to Google Assistant so I don’t share all my devices with Dark Empire; the two instances have some common MQTT topics for devices I wanted to control from GA).

Until recently I had Hassio running on Rpi v3 but SD card corruption is annoying and this second instance of HA was offline just as I needed it the most (not a big issue tough as the automations are only on the main install). After moving it to FreeNAS there haven’t been any issue.

Also, with so many nice addons for Hassio I didn’t need to run another Docker install.

1 Like

Nice guide for FreeNAS! However you are still using docker with this install. The only difference is that it is included in the image of HassOS and is running within your VM. There is no “docker-less” installation of Hassio.

No, there isn’t.

The guide was initially for running Home Assistant in an Ubuntu Server VM with FreeNAS. However, why not run the whole buffet? :slight_smile:

Can you please elaborate on this? Is this a Wifi thing you mean?
I have a Xiaomi Gateway device on the network, over Wifi, will this no longer work/

No; it is an IO issue in regard of USB: different from the more established VMWare or VirtualBox, Bhyve cannot pass (at least not natively supported and free) USB devices so for the case of using RF gateways this is a shortcoming. However, there are some easy alternatives:

  • install HA as a FreeNAS plugin (although it wasn’t difficult to setup before, this is now available in FreeNAS 11.3 RC) and then pass USB devices to this instance;
  • use a secondary device (for example Rpi) as an RF to MQTT hub (ie with Hassio addons for Zigbee2MQTT, Z-Wave to MQTT) that would connect to the main HA installation; this requires a second device to use but would be relatively cheap. Although the entire Hassio can run fine (depending on the number and complexity of the smart home components) on the Rpi, at least for the ones before Rpi v4 there would be the issues with the tear & wear of MicroSD cards; with only these two addons communicating over MQTT is more likely that the MicroSD card failure won’t be a problem.

My install is as following:

  1. Main HA on Ubuntu Server on a NUC (Celeron J4005) running MQTT broker; has Zigbee, Z-wave and 433 Mhz gateways attached to it; not exposed to the internet; vs. a Rpi 3 (haven’t tried with 4) this works way faster (although there haven’t been too many problems with the Rpi, some automations would linger for several seconds which was quite annoying for the lights).
  2. Hassio on FreeNAS as a VM, communicating with main instance over MQTT; exposed to internet with Nginx Hassio addon, also connected to Google Assistant; I use this second HA for two main reasons: i) don’t want to expose to internet or to Google Assistant all my devices; ii) use the nice Hassio addons (obviously could have used a regular Docker installation for the programs I like, but would have required additional maintenance and the Hassio addons are very clean and easy to use).

I’m unsure if the Xiaomi Gateway would be available in this setup but, alongside security and privacy issues of running a cloud component there are some problems with the Gateway loosing connection (I’ve had a fair share of such problems myself):


I would totally recommend switching to a local controlled Zigbee hub (either ConBee, ZHA or Zigbee2MQTT). I use a lot of Xiaomi Zigbee devices connected to Zigbee2MQTT and they work much better than the Xiaomi Gateway.

Sadly this install method didn’t work for me on FreeNas 11.3. I started with a downloaded vdk image file and followed all of the steps. Ultimately, the FreeNas VM starts but doesn’t boot. It gets stuck on the “EFI Interactive Shell V2.1”. With no boot to file options present in this BHYVE Shell I can see no way that I can fix the boot options. Has anyone experienced and managed to overcome this issue?

Hi,

I know FreeNAS 11.3 came out but didn’t yet update (the setup above was done on 11.2). I will update to 11.3 and also try to update the tutorial.

1 Like

@Petrica Thankyou!

I followed all steps and it was only booting in EFI shell.
Then I downloaded hassos_intel-nuc-3.10.img.gz and did the same thing. Now it’s booting up.

Running FreeNAS 11.3 stable release

1 Like

I thought I’d replied to this post but cannot see it listed. I had made an error when first installing, but once corrected I can confirm that this procedure works perfectly on FreeNAS 11.3.