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

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://www.home-assistant.io/hassio/installation/), look for VDI (this is how the page currently looks; whenever other files are added to the download section, the page will also change).

and unrar it (gz is an archive file; use 7zip to 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)

18 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)

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.

1 Like

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

2 Likes

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.

I used the Intel NUC .img file and didnā€™t have to convert anything first. Also, I had an issue booting until I selected AHCI when configuring the disk image for the VM.

Iā€™m so new to all of this. Is there a way to ssh? How to update the hass.io?

Thanks,

  • Klang

I think there wasnā€™t a regular img available, I will update the instructions.

So, did it work?

Yes, you need to activate the ssh addon after installation .

There is no difference between a bare metal installation and running it as a VM in regard of updating process.

I got it loaded up and started, but now Iā€™m having network issues. I donā€™t think this would be related to the image I used, but who knows.

If it matters- I have no internet connection in the VM. Iā€™m getting a DHCP reservation on my router, but not getting that same address to show on the vm. Iā€™ve tried both the VirtIO and Intel e82545 options in the FreeNAS VM options.

Iā€™ll keep playing with it and see what I can get.