Home Assistant keeps crashing

Hello,

I have been running Home Assistant OS on a Raspberry Pi 3 B+ for a good 3 years. Everything has actually always worked well. When I installed it back then, the 32-bit version of Home-Assistant OS was recommended. Of course I installed it, so I could install as many addons as possible.

In the meantime, however, the whole thing has changed and now you have some advantages with the 64-bit version. Therefore, I came about 3 months ago on the idea times to switch to the 64-bit version. This has also worked so far. Backup made, Home Assistant OS installed, backup uploaded, backup restored.

The only problem is: Since then Home Assistant Core crashes all the time, as soon as the Raspberry Pi is used a bit more. For example, last week I downloaded the ESPHome add-on and wanted to flash an ESP. During the compilation process Home Assistant suddenly stops and the connection is disconnected. Sometimes the whole thing even hangs up so that the Raspberry Pi does not respond for more than an hour.

I have already tried to reinstall Home Assistant OS again with a new Backup, but this eventually led to the same crashes.

Are there any logs where I can possibly find the cause of the crash (in the Home Assistant Core log everything is ok) or someone who had the same problem?

Thanks a lot
Justin

1 Like

Tried a heavier power supply?

Esphome will crash on that machine, it will run out of ram.

Put this in the configuration of your SSH & Web terminal addon (has to be this addon and not terminal and ssh addon) and disable the protection mode in info

init_commands:
  - >-
    if [ ! -f /backup/_swap.swap ]; then fallocate -l 2G /backup/_swap.swap &&
    mkswap /backup/_swap.swap && chmod 0600 /backup/_swap.swap && swapon
    /backup/_swap.swap ; elif [[ ! $(dmesg|grep _swap.swap) = *swap\ on* ]];
    then swapon /backup/_swap.swap; fi
1 Like

And what would those be?
At the end of the day, you’re wasting resources using a 64bits OS on a device with <= 4GB RAM.

Some day, the 32bits OS will become deprecated, and you will be forced to upgrade, I guess, but in the meantime…

1 Like

Not only advantages. Also disadvantages like higher ram consumption for essentially the same tasks.

If I remember RPI3 only had 1GB versions? That’s really little if you have more than a few devices connected.

Activating swap? Bad idea as it will result in heavy write amplification on the flash and will kill the storage very soon :tm:

This could use 1GB of ram on it’s own. So no change running this on a RPI3 anymore without suffering.

You can instead install it locally on your client and still connect the esphome devices created by it with home asssistant without problems. No need to run the esphome addon on your ha server.

I did assume OP was using an SSD :thinking:, which he may not be. Micro SD card won’t last long. I expect SSD internal algorithms help to reduce wear & tear. I think most pagefile operations are small reads or larger sequential writes, both of which operations the SSDs handle well. If the swaps are not too often like you would expect with esphome it should last.
I don’t know about the swappiness of home assistant.

As @Koying said, so it will be that all hardware will need replacing at some point. I wonder how long the RPI 3 B+ will be able to keep up. I’m using one myself and last year ran into the problem of it crashing when used esphome. All part of the fun of this hobby for me using what you’ve got and dealing with new challenges. This month has been great with 2 major breaking changes that has forced me to learn new things. :grin:

Okay thanks for all the quick responses!
Then I will probably have to replace the Raspberry Pi. I had almost thought that its capacity must be exhausted.

What do you recommend as an alternative to the Raspberry Pi 3B+? Odroid N2+?

First sentence in the wikipedia article about write amplification:

Write amplification (WA) is an undesirable phenomenon associated with flash memory and solid-state drives (SSDs)

That and more. Typical SSDs often have a small amount SLC flash cells that allow a magnitude more writes operations (>100k) than the “ordinary” MLC/TLC NAND cells (only few thousand writes) that typically store the data. The SLC helps significantly to limit the wear on the valuable NAND cells.

I don’t know how haOS handles this but the filesystem (at least in haOS 7.x) was still not “flash ready” and used settings from the hard disk ages that by itself can cause heavy write amplification :frowning: