Skip to content

Plugin Upgrade From FreeNAS to TrueNAS Core

Troy Prelog edited this page Dec 8, 2020 · 13 revisions

Plugin Version 5 is now available on TrueNAS Core

A fresh install is required in order to upgrade.

  • Please review No More HASS for breaking changes and a suggested upgrade path

From FreeNAS to TrueNAS Core - Attempting to Upgrade

If you'd rather not re-install at this time, I've started this wiki page to help get your existing plugin working again on TrueNAS Core. Following these steps, you will remain on plugin version 4. A fresh install will still be required to upgrade your plugin to version 5. It's my opinion, your time will be better spent if you just install version 5 now.

After upgrading your server to TrueNAS Core, plugins can be updated to current release using the TrueNAS console.

iocage upgrade $_JAIL_NAME

After the jail has been upgraded, these remaining steps should be taken to complete the entire upgrade process.

Z-Wave and Zigbee users - Click here

The devfs_ruleset used for USB pass through is now created from the plugin manifest. Using a custom ruleset is no longer required. You should set your jail back to the default devfs_ruleset=4 and then restart it.

iocage set devfs_ruleset=4 $_JAIL_NAME
iocage restart $_JAIL_NAME
HomeKit users - Click here

OpenSSL-1.1.1 is now included by default. If you previously installed or updated openssl following openssl and HomeKit, you should undo those changes now.

  • if present, remove /home/${homeassistant_user}/.profile
  • uninstall openssl and reset the homeassistant_openssl variable
iocage console $_JAIL_NAME
# Press 0 to exit the menu

mv /home/${homeassistant_user}/.profile /home/${homeassistant_user}/.profile.old
package delete openssl
sysrc -X homeassistant_openssl

To complete this process, you will need to rebuild the Home Assistant virtualenv.

Python has been updated and the virtualenv location has changed

You will need to rebuild the virtualenv (reinstall Home Assistant) with the updated Python version.

Enter the jails console and exit the menu.

iocage console $_JAIL_NAME
# Press 0 to exit the menu

If you have recently installed this plugin, Home Assistant may already be using the updated defaults. Use the following to list the rcvars that are currently set.

sysrc -a | grep ^homeassistant
  • Example from the previous settings.
homeassistant_python: /usr/local/bin/python3.7
homeassistant_venv: /srv/homeassistant
  • Example from the updated settings.
homeassistant_python: /usr/local/bin/python3.8
homeassistant_venv: /usr/local/share/homeassistant

If your plugin is using the previous settings, they should be changed.

Stop the homeassistant service and remove the old virtualenv and cache directory.

service homeassistant stop
rm -r /srv/homeassistant
rm -r /home/hass/.cache

Set the updated virtualenv location and Python version to use.

sysrc homeassistant_venv=/usr/local/share/homeassistant
sysrc homeassistant_python=/usr/local/bin/python3.8

Install Home Assistant and run the check_config script. (Running a config check at this point will cause Home Assistant to finish installing any additional Python packages it may require. This will help speed-up the initial startup.)

service homeassistant install homeassistant
service homeassistant check_config

Start Home Assistant.

service homeassistant start

If your plugin is using the updated setting, you can use the reinstall command to rebuild the virtualenv.

service homeassistant stop
service homeassistant reinstall
# When asked, type `YES` to clear the cache

Running a config check at this point will cause Home Assistant to finish installing any additional Python packages it may require. This will help speed-up the initial startup.

service homeassistant check_config

Start Home Assistant.

service homeassistant start

Trouble in paradise

A few users have reported errors (issues that started on 11.3-RELEASE) after upgrading to TrueNAS Core and upgrading the jail to the current release. In these cases, the following two commands were used inside the jail, after which the virtualenv was able to be successfully rebuilt and Home Assistant was saved!

pkg-static update -f
pkg-static upgrade -f

If anything has gone wrong, please remember, your configuration is stored separately in the /home/${homeassistant_user} directory. Even if it becomes impossible to recover Home Assistant, as long as you do not destroy the jail, you configuration can still be saved.