I was ready to give up on Home Assistant... until I moved the database!

I wouldn’t say that I lack patience, or that I get enraged quickly, or that I wouldn’t put sufficient effort into understanding and fixing something, but last week I got to a point where I was ready to pull the plug on my HASS-Pi. (I litterally developed Hass - which, funny enough, is the german word for hate).

My setup is small and after a long debate with myself it became obvious, that even though it’s awesome, the little benefit in comfort that HA gives me peronally can not measure up to the investment - both in money, as well as in time and frustration.

As it is widely recommended for getting into HA, I bought a Pi (3B+). I never had one of those before, but it always intrigued me. From what I read, that thing runs HA without a problem. Well, I now believe that this is only correct with some strong limitations, and I wonder why this isn’t stated more clearly in the “How to get started” section.

After a few weeks of setting everything up, getting all my components running, playing around with all the possibilities and soldering up my own sensors, I was quite pleased with myself. But amid a lot of “man-this-is-aswesome-and-I-did-it-all-by-myself”-moments, there were first signs of instability. Random crashes, unresponsive interfaces, lots of restarts. I spent A LOT of time reading up on what could cause this and what I could do to make the system more stable. Now doing this, you will always encounter the same annoying answers:

  • your SD card sucks, get a better one
  • your power supply sucks, get a better one
  • your sd card probably failed, get a new one
  • lighten up your database, keep five days, purge every day
  • your power supply still sucks, get an even better one
  • your sd card probably failed again, get another one
  • lighten up your database some more - keep 1, purge 1
  • your life sucks, get another one… oh, and get another sd card

Now this is enraging enough already. What are SD-cards in this setup? Consumables? Is it a money-making scheme as with printer inks?

Now a couple of weeks ago I had enough. The system was running so unstable that I had to reset the PI once a day. The log gave me nothing. I had sunk lots of money in SD cards and power supplies. I had a database that only kept one day. I was ready to throw it all out.

I made one last effort, because I always wanted to look into outsourcing the database and I felt I like i still owed this option. As annoyed as I was at this point, putting it on a USB stick or an SSD attached to the pi seemed like too much of a hassle, but I came across a couple of mentions of hosting it on AWS. Since this is set up in literally minutes, I decided to give it a try. And what do ya know?! From that second on everything was different! The system became super responsive and for a week now I have not had any crashes. Unbelievable. (To be clear, I do not want to advertise AWS. It costs money after the trial period. It was just the quickest solution to try. I will have to look for something else in the long run.)

Long story short:
From my experience Home Assistant will not run great/at all on a Pi with the database on the SD card. This should be mentioned prominently and an alternative should be given.
Newcomers must be made aware that the Pi is not really a great long term solution as is, and that they will probably want to upgrade sooner than later. I have easily spent more than 130$ on the Pi, SD cards and power supplies. Had I known the inadequacy of this beforehand, I would have opted for a more powerful machine to start with.

Home Assistant is pretty great. The comunity is great. My spirits are up and running again - so is the Pi… Keep up the good work everyone!

33 Likes

Out of curiosity, what is the size of your database? Were you excluding any entities using the recorder component configuration? That’s one thing you didn’t note in the list of things you tried, as even if you reduce the days to keep and purge daily, if you’re logging every state change for every entity it can still be hard on the system.

My Pi 3B, with a good SD card and power supply, five days of data in the database, and daily purges, has been going strong for 5 months thus far (DB size is around 125 MB). So I don’t think it’s a given that the Pi is not a workable platform. I do think it’s a good place to start for most, with a low barrier to entry. And while I think a lot of people end up moving to more powerful hardware down the road (I plan to eventually), I also think the Pi can be enough for a lot of users long-term. I will say, though, that more helpful documentation for new users, as well as more aggressive default settings for keeping the database size and write activity low, would be good things.

So you’re running on a Pi from SD without any problems… I’ve heard of people like you… :wink:

I didn’t mention excluding entities, but that was part of my troubleshooting efforts. My last local database had 113 MB and I never really had the problem of DB’s getting crazily big.

A lot of people run HA happily from a Pi. It is definetely a super easy low barrier entry, which is a great thing for people that aren’t as experienced with the technicalities. But especially for those, there is a huge frustration potential if it then doesn’t run satisfactory. I feel like a lot of popping veins can be prevented by implementing and easy way to write the DB on a USB stick.

4 Likes

I had the same problem. Everything started out fine but after a week or two random reboots, slow response, even unresponsiveness…

I moved my database to my synology nas and I’ve been running smooth for five months now.

Moving my db to the Mariadb addon helped immensely when I was running HA on a Pi 3b. Still on the Pi but it uses a lot more memory for caching.

3 Likes

Definitely agree that I’d like to see this option made available.

This is on my to-do list as well.

3 Likes

Just get one of those and be done: https://www.amazon.de/gp/product/B073W7SVC2/ref=ppx_yo_dt_b_asin_image_o03_s00?ie=UTF8&psc=1

It’s an USB m.2 adapter. The small m.2 cards are a lot more reliable than SD cards.
Cards aren’t expensive either: https://www.amazon.de/gp/product/B01MR18KZC/ref=ppx_yo_dt_b_asin_image_o02_s00?ie=UTF8&psc=1

2 Likes

I already go for SSD. But with previous hass.io we can install all on the SSD. With the new one it seems still not possible

So … it was the SD card.

:wink:

  • your SD card sucks, get a better one
  • your power supply sucks, get a better one
  • your sd card probably failed, get a new one
  • lighten up your database, keep five days, purge every day
  • your power supply still sucks, get an even better one
  • your sd card probably failed again, get another one
5 Likes

That is actually a pretty cool solution, but it doesn’t look as if it’s super easy to set up and configure. Might be though. But if I’d get this now, I would have spent alltogether 200$ on a Pi setup… that doesn’t feel right to me.

Had I known about the benefit/necessity of something like this beforehand, I would have considered it. But I also would have looked at an initial investment of like 100$+. For a Pi setup.

What sells the Pi as a starter-machine for Home Assistant (at least for me) is the proposed affordability. I was easily convinced to spend 50$ on this thing. Would I have known that the cost will add up to 100$+ for a trouble-free Pi system, I would have rather opted for something else from the beginning.

I got lucky it seems with 2 sd cards. What kind were you using? I think mine were 32gb samsung evo’s for like 15$

2 Likes

That’s the one I’m using without issues so far as well.

Yes, kinda… I would rather say it was what the database behaviour did to the SD cards. Three of them.

As I said, it felt like the SD cards were a consumeable in my setup. And funnily enough, I am still running HA on the third SD card (with which the system crashed once a day before). Just by outsourcing the databse, the system has been running for a week now from the same (possibly corrupted) card.

As the question came up, my SDs were:

1 SanDisk Ultra 32GB
2 Toshiba Exceria 32GB
3 Samsung Evo Plus 32GB

Sound exactly what I’m experiencing the last weeks. Today my second SD card died within 5 months.
I will have a look at AWS but hope we will find a way to use a USB drive for the database in hassio.

You could do that with a symlink

Alternatively I just network boot my Pi and mount the filesystem via NFS to my NAS, I would put it on a VM but I like the physical location of the Zwave stick.

Is this possible with hassio? If yes, any link how to?

HassIO is just the docker image, so yes you could, just rsync raspbian to the NFS share and boot from it.

HassOS not sure, I would say you likely could if you were able to get to the shell and rsync it over to your NFS share.

I basically used this:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net_tutorial.md

There are ways of doing this. Simplest is to use the Community SSH Addon in unprotected mode. Not for the inexperienced. You can easily mess your installation up this way.

I was under the impression that ots possible to change sqlite db location, no?

But yes, while Pi is plenty powerful there are a lot of issues related to databases and sd cards. There are even whole systems for pi (DietPi) that are designed to overcome this by keeping all logs in ram only to lessen sd card usage to practically zero.

I think best option would be to look for Pi alternatives and mention some on the intro page, something that has good onboard memory instead of an sd card. There are some options. I also believe that you can buy some x86 mini pc from aliexpress for about the same as Pi+accessories would cost

If it drops you to root of the hypervisor OS that’s what you’d need so you could rsync the data.

Alternatively one could use the loopback filesystem and just mount the image as well then share that via NFS, this might be the easier solution for a network booting HassOS.

I might give this a try myself…