Updated using Hass.io with USB Boot on a Raspberry Pi



Originally posted 2018-08-27 16:37:41.

How to use Hass.io and boot off a USB stick.

This is an update of my previous article here.

In order to not create more confusion I decided to do a new blog post about this here. The whole installation of home assistant can be somewhat confusing for someone who is new and sometimes the documents on the Home Assistant site are confusing or as often happens, 100% clear when you have already worked out what you want to know.

The ‘preferred’ installation method for home assistant promoted on https://www.home-assistant.io/ is to install Hass.io This installation method effectively turns home assistant into an appliance that pretty much looks after itself and is easily updated by the click of a button. There are other installation methods like installing Home Assistant in a virtual environment etc… I can already feel your eyes glazing over!

At the simplest level, and only considering a Raspberry Pi for now, the installation options are like this:

  1. Install Hass.io using the Hass.io image on the Home Assistant Site
  2. Install Hassbian using the Hassbian image on the Home Assistant Site
  3. Installing Raspbian yourself and then installing Home Assistant in a virtual environment. Installing Hassbian is the same for all practical purposes except it does all the heavy lifting for you.

There’s a number of reasons why these options might not suit you. Using Hass.io pretty much locks down your system so nothing else can be run on it except Hass.io. Some people seem to really want to run a whole bunch of other things on their Pi as well as Home Assistant so they might choose option 2 or 3. Usually, fairly quickly, these people will come to the Home Assistant forum and complain about problems they are having that they wouldn’t have had at all if they lashed out another $35 and got a separate Pi to play with and just used their first Pi to only run Hass.io. People will also work out pretty fast that they really do want to run hass.io as it has all these other cool add-ons that are not available with option 2 or 3. (and people choosing option 2 or 3 also come to the forum and complain about not having the hass.io tab in the side panel)

A lot of people for whatever reason also seem to have a lot of problems with SD-Cards failing. This may or may not be due to poor quality cards and rightly or wrongly, some people seem to prefer to use a USB stick or even an SSD instead. Home Assistant is quite heavy on writing to the database which could contribute to failure with cards that don’t have wear leveling for writes on the card. Flash memory eventually fails. Writing data to a SD card physically and permanently damages the chip. Overtime this causes the SD card to fail. There are 2 different kinds of chip used – TLC cards (which are cheapest) can overwrite itself 500 times before experiencing failures, an MLC card (more expensive) can overwrite itself between 1500 to 3000 times before failing.

When I wrote my original article, I showed how to install Hass.io and run it with the RPi booting from USB instead of an SD-Card. This required the OTP (one-time-programmable) bit to be set on a RPi3B. The newer RPi3B+ has this set out-of-the-box. The Home Assistant developers at that time were using a bas operating system for Hass.io on a RPi called ResinOS. For technical reasons they decided to move away from ResinOS and wrote their own new base operating system her Hass.io called HassOS. This was released as stable in July 2018. Unfortunately, the developers also decided that they would not support USB boot for HassOS although my understanding is that they are going to support it in the next release which is great news!

The other issue has been that for some months, the new RPi3B+ was not supported and would not run ResinOS. This meant that new users had to use either option 2 or 3 above and miss out on the nice features of Hass.io. There is also the consideration that security wise, people on ResinOS needed to consider upgrading to a supported environment and thus HassOS.

As HassOS was not available for quite a while, one of the developers Dale3h wrote a script for a RPi3B+ that you could install and run over the top of Raspbian. The script was promoted for the RPi3B+ only however I found it installed and ran perfectly on a RPi3B. It may also run on a lower Pi as well but I would not recommend trying it on anything less than a Pi3B. What the script does is install Docker with all dependencies and then installs Hass.io and any add-ons in it’s own containers.

The script written by Dale3h can be found here. Follow the installation instructions and you will end up with a Raspberry Pi 3B or 3B+ running hass.io in docker but instead of being based on HassOS or ResinOS, based on Raspbian! There are a couple of limitations such as the hass.io ssh addon does not work but there is a community addon as an alternative. It was simple to restore a snapshot and I was up and going again immediately. I did find that the configurator addon and the dropbox addon was not working and I had to install and configure them again. One other thing is that I was getting a lot of database errors so I deleted the database and restarted hass.io server. That’s it!

I made the decision a few weeks ago that I was going to upgrade from a Raspberry Pi to an Intel NUC so before I did that I decided to try Dale’s script on a Pi. I found that Hass.io running on Raspbian was much faster than HassOS and on par with ResinOS.

Latest I heard, the developers of Home Assistant are planning to make a USB installation for Hass.io in the near future. In any case, it was a great learning experience doing this and really helped me to understand Docker that I had never used before. It was a great entree to moving to using a NUC which is the subject of my next article here.



Leave a Reply