Installing Home Assistant on a RPi 4b 8GB with SSD boot

Tags: #<Tag:0x00007f739ac235e8> #<Tag:0x00007f739ac23480>

[UPDATE 2020-10-14 by @Jpsy ]:
Added instructions to update HA OS through CLI.

[UPDATE 2020-10-18 by @Jpsy ]:
More details added on installing and using Raspberry OS to update the EEPROM firmware.

[UPDATE 2020-10-20 by @Jpsy ]:
Infos added on using Raspberry OS “headless” through SSH (no monitor or keyboard attached).
Thanks to @LondonBenji for these details.

[UPDATE 2020-10-22 by @Jpsy ]:
Infos added on working (and non-working) SATA to USB3 adaptors.
Some infos about Sabrent adaptor removed (don’t use it!).
Thanks to @Noobz for these details.


RPi 3 for HA is dead!

I finally found that the lags and hangs of HA on my RPi 3b were the result of too many add-ons that quickly filled up the 1 GB of memory. I considered switching to a NUC or an AMD 4500U based system. But I love the low power consumption of the Pis and their small carbon footprint. So I decided to try the current upper end of the Pi spectrum:

Long live HA on Raspberry Pi 4b

…with (up to) 8GB of memory and booting directly from SSD !

On the way to that solution I faced two major problems:

  1. The 8GB version is not yet officially supported by HA.
  2. The full SSD boot of HA is also not yet officially available for the Pi 4.

Fortunately both problems can be solved and the resulting system works flawlessly and is extremely fast and (so far) very stable! The 8GB memory provides HA with enough space to run many add-ons without starting to swap. And there is always plenty of in memory buffer and cache available that make DB accesses really fast.

The following instructions will work for the 4 GB version of Pi 4b too. You may even have more options with that version (like using the 32bit version of HA). But I still recommend the 8 GB version as it will surely keep you happy for a longer time to come.

So let’s go – step by step:

Use the right SATA to USB3 adaptor

This is propably the one most important step for your success. Not all available SATA adaptors are working on the RPi 4. This is not a HA problem but a generic RPi issue. In the discussions below @Noobz has shared this very helpful link. It contains lists of working and non-working adaptors. I started myself with a Sabrent adapter based on a JMicron JMS583 bridge chip which gave me quite some trouble. I.e. it only worked reliably when connected to one of the USB2 ports – not on USB3. Now I have switched to an ELUTENG Adapter that works like a charm and is cheap too. (That is an Amazon partner link that will provide me a small percentage if you buy, but this adaptor is really my recommendation.)

Use Raspberry OS to update the EEPROM firmware

RPi 4 has a boot EEPROM (which RPi 3 did not!). You have to update that EEPROM to the latest firmware (2020-09-03) which enables USB boot. To update the EEPROM you have to temporarily install Raspberry OS. I used an SD card for this.

(If you want to learn more you can read the Raspberry Pi docs but we go through all the steps here in detail.)

First download Raspberry OS and burn it onto an SD card. You do that using Raspberry Pi Imager. Versions for Windows, Mac and Ubuntu are available here.

A) If you have a keyboard, mouse and monitor attached to the Pi

This is my recommendation but you will need a micro-HDMI adaptor cable for that, which you might not have. If you do, simply start your Pi with that SD card and monitor/keyboard/mouse attached. Go through the initial setup process.

When all is done open a terminal window.

B) If you have NO monitor attached to the Pi:

Prepare to access Pi’s shell through SSH. To do so you simply add an empty file called “ssh” (no file extension) to the root of the boot partition on the SD card. You should have two partitions. The first (and smaller) one is the boot partition. Place the file there.

Now start your Pi with that SD card and access the Pi’s shell through SSH from another device on the network.

The ssh-file on the boot partition is deleted on first boot, so you will loose SSH access when you reboot. To keep SSH access launch raspi-config now from the command line:

sudo raspi-config

then go to “Interfacing Options” --> SSH --> Yes --> Ok --> Finish

Update the boot EEPROM firmware

This is done by telling the OS to use the latest stable version for all updates and then simply rebooting:

Edit the rpi-eeprom-update file and change the FIRMWARE_RELEASE_STATUS from “critical” to “stable”:

sudo nano /etc/default/rpi-eeprom-update

Change the file, save and exit nano. Then…

sudo apt update
sudo apt full-upgrade
sudo reboot

Let the system reboot. The EEPROM should be updated automatically during the boot process.

Check the EEPROM version

sudo rpi-eeprom-update

This should now report at least firmware 2020-09-03.

Use raspi-config to set boot config to SSD boot

sudo raspi-config

…then Boot options --> Boot Rom Version --> latest -> Ok -->
when the system asks to “Reset boot ROM to defaults” select No (!!!) to use the latest boot ROM.
–> Boot Order --> USB Boot --> Ok --> Finish --> Reboot --> Shut down


We are now done in Raspberry Pi OS. I recommend that you keep that SD card with RPi OS! You can always use it later for more EEPROM updates. It is also very helpful to access your HA SSD and salvage your config and data in case HA should refuse to start some day!

Flash Home Assistant to SSD

Now download the latest Home Assistant 5.x OS from here:


Look for the latest “Development 5 build X” (5.3 at the time of this writing).
Open the “Assets” panel under the list of changes to see the downloads.
Find the image hassos_rpi4-64-5.X.img.gz - make sure it is rpi4 (not rpi3) and 64 bit.
AFAIK the 8 GB Pi won’t run with the 32 bit version.

Use Balena etcher or a similar tool to flash the image onto your SSD.
(Yes Balena can flash to SSD, not only SD!)

Start Home Assistant

Plug the SSD into the Pi, take out any remaining SD card and boot.
Check http://homeassistant:8123 on your network or use Port 8123 with the IP that your router’s DHCP has assigned.

It helps to follow the boot process on a monitor that is directly attached to the Pi. You will need a micro-HDMI adapter cable for that.

Boot meditation?

At this point you may experience extremely long boot times (>30 min).
If this happens to you you have multiple options:

  1. Check the section “Use the right SATA to USB3 adaptor” above. Chances are that you are using a non-compatible SATA to USB3 adaptor or casing. Try the ELUTENG that I recommended above.
  2. Try to connect your SSD through a USB 2 port (black) instead of a USB 3.0 port (blue). I know it sounds strange, but please really do! If this works for you, it may be your best option. Although USB 2 is much slower than USB 3.0 you will get a very fast system. But if option 2. works for you you should also reconsider option 1. It is very likely that your adaptor or casing is the culprit.
  3. Check if your SSD casing or your SATA to USB adapter is based on a JMicron JMS583 bridge chip. There is a firmware update for this chip that solves the problem. For Sabrent devices the update for all affected devices can be found here. But I also remind you that my own Sabrent adaptor never really worked for me. Read 1. again!

The good news after that final trouble is:
You are done! Enjoy your new HA installation.

Update the dev version of Home Assistant OS

If a new 5.x dev version of HA OS becomes available you may find that the Supervisor menu in the HA frontend only offers you an “update” to version 4.x. But you can update your OS at any time using the command line interface (CLI) of HA. To do that you need SSH shell access to HA. There are multiple add-ons to expose SSH (my recommendation: Frenck’s great “SSH & Web Terminal”).
In the shell you can use the following command to update your OS to a defined version:

ha os update --version 5.3

Try this command before and after the update to get some system info:

ha os info
17 Likes

Thanks for this detailed article. By follow it I was able to put together
a RPI 4B 4Gb, a Samsung 860 EVO 260Gb SATA memory block, and an Eluteng
SATA-to-USBb 3 adapter, with the 64-bit version of HA 5.2 flashed on.
After about 10 minutes the normal opening screen cam up, and a current
snapshot from the running system was read in. To my pleasant surprise,
the system came up with everything in place and running properly.

Again, thanks so much for the effort put into researching and publishing this
blog/article.

CTFrank

BTW: an initial attempt using a WD Blue 500 SN500 NVMe SSD with a Plugable
SSD-to-USB 3 housing/adapter failed to boot; haven’t yet figured out why…

What are the chances! I just decided about an hour ago that I wanted to tinker with HA. Found your post. Took about 15 minutes to get my RPI 4B 4Gb up and running (Adata SU635 240Gb with Startech USB adapter). Thanks for making this so easy! So nice to see HA picking up on all my devices. :slight_smile:

1 Like

First post, first time ever installing and using HA and using and your guide got me there! Thank you @Jpsy !

Now to start playing around with HA and working things out!

1 Like

Why did I never consider if my Sabrent SSD adapters could be firmware upgraded :tired_face:
Just updated 3 of them, so thanks for that.

1 Like

@Jpsy what combination of SSD and eSata to USB adapter are you using.

@ConcordGE I am using a 120 GB Crucial BX500 connected to a Sabrent EC-SSHD adapter. Not sure wether this is the best solution, as I still have reduced performance when I connect this combination to the USB 3 port of the Pi. I really flies on USB 2, but maybe with another adapter you might be fast on USB 3 too (or even faster).

I would be very interested to hear from other users with other equipment whether they also experience longer boot times and slower response (i.e. when opening the history) on USB 3 compared to USB 2.

1 Like

Hi Jpsy
I did a test while troubleshooting my JMicron adapter, I did a read/write test on the usb 2 and 3. I had about 1/2 the read/write speed on the usb2.
Real world difference my wary.
This link may help: https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/

1 Like

Hi @Noobz, very interesting indeed!
I have immediately ordered the ELUTENG adapter after reading that guide. It is even cheaper than the Sabrent and has good reviews. Will report back here as soon as I have tested it with HA.

Unless I could achieve a notable performance increase on an SSD via USB3 on the Raspberry Pi 4 I wouldn’t be interested going that route. The bottleneck via USB2 would be unacceptable.

I just can’t see enough examples of the hardware combination required to achieve this.

But what is your alternative, @ConcordGE? An SD card? The SSD on USB 2 still outperforms any SD card by a magnitude. And SD cards can never be a permanent solution for HA because they wear quickly under the steady stream of database writes. I killed 3 of them with my HA installation before I came to recognize that. :smiley:

I’ll hold back till a credible usb 3 solution appears.

Not wanting to get into the failed SD card debate but I’ve only experienced that once and unfortunately the card in question was from a dubious source. So many fakes doing the rounds these days.

Interesting piece on the subject here. Worth a read. https://www.raspberrypi.org/forums/viewtopic.php?t=199414

Do youv know how to check chipset of USB to SSD adapter? I mean using windows or linux?

Also sellers (even manufacturers) often don’t include this information on their webpages. Is there some database of adapters with needed information?

thank you in advance

If you use linux, all you need to do is type lsusb with and without the usb adapter connected.
I dont know how to do it in windows.

I am on absolute newbie here.
I am on hold here

### Raspberry Pi Imager

The easiest way to to update the bootloader to the latest version with default settings is to use the [Raspberry Pi Imager](https://www.raspberrypi.org/downloads/) to install a boot recovery image onto a spare SD card.

Select "Choose OS -> Misc utility images -> Raspberry Pi 4 EEPROM boot recovery"

Raspberry Pi OS also keeps the EEPROM up-to-date: new EEPROM images are applied when the Raspberry Pi 4 next boots.

on this , I have flashed the EEPROM onto SD card. But I couldn’t find a way to remote ssh from my laptop.

can someone help me on this pls? I do not have a monitor/Keyboard.

Sorry, but for that step a monitor and keyboard connected directly to the Pi are needed.

There seems to be an option in Raspberry OS to enable SSH by adding an empty file named ssh to the Pi’s boot partition. With that step it could be possible to execute all needed steps from the command line through SSH. But I did not test that option.

This is exactly what I did and how I set it up @uniquecool , no keyboard/mouse/display connected to my new RPi4. Just place an empty file called ‘ssh’ no file extension, nothing, just put that file on the boot microSD and the Pi checks for it on boot and if it finds it, the SSH server is automatically started and then the file is deleted, so make sure you go into raspi-config to enable SSH still otherwise if you reboot it for whatever reason you won’t have SSH access anymore.

1 Like

Hi @LondonBenji, thanks for the confirmation. I have added your info to the guide!

1 Like

@Noobz I received the ELUTENG adapter today.
It boots HA from my SSD on USB 3 within 1.5 minutes!
GREAT!!! Thanks for that info.
I will update the guide accordingly tomorrow.

2 Likes

@Jpsy
I’m glad I could be of help.
Waiting for my own shipment ELUTENG adapter.

1 Like