Hassio breaks AGAIN. for no reason

I am getting real sick and tired off HA. It is allways something breaking. Last time it was a bad sd-card, but now I am not sure if it was only the sd-card. I only have a working system for a month or so before something breaks. Now, last time, right before breaking, I noticed I couldnt update from '83 to '84(via hass.io). A couple of hours later the whole thing broke without me touching the configuration.

I connected the pi to my TV and could see that it tried to boot, but stoped at something like ā€œopening kernelā€¦ā€ i think.

What is wrong with my system? It works fine one day and breaks another day for no reason all the time.

Define ā€˜bad sd-cardā€™ - Did you get a new card or are you reusing the old one? What type of card is it?

So try something other than a pi.

1 Like

This often has nothing to do with HA - itā€™s unfortunately the ā€˜faultā€™ of the HW platform that you, me and many others use, i.e. an SBC that runs on an mSD card.

Iā€™ve been lucky so far with the SD cards I used.

To be safer, I switched a little while ago to a high endurance card:

And just over the weekend I replaced it with an SSD that my RPi3 now runs on now - little bit of work, loads of learning opportunities and, hopefully, a more reliable setup:
https://www.amazon.com/gp/product/B00EZ2FRU2

You should consider switching to a SmartThings Hub. When it breaks, you can be absolutely certain itā€™s not the SD card ā€¦

:wink:

If you are using a Raspberry Pi (for any application, not just Home Assistant) without a UPS, you are living on the razorā€™s edge. It does not like power interruptions or voltage fluctuations. By ā€œnot likeā€ I mean nasty things like filesystem corruption or even physical SD card corruption.

I have two Raspberry Piā€™s, one is dedicated to running PiHole and CUPS, the other runs openHAB, MQTT, and Node-red. Both are protected by a UPS and have been running just fine for one year as of this month.

I currently run Home Assistant on an old notebook PC but if I had it on an RPi, I would definitely ensure it was protected by a UPS.

If not a UPS, then perhaps a power bank (in between the power supply and the RPi).

Actually I challenge this. People seem to run Kodi on an RPi with SD card for a much longer time than I see reported here for HA. OK I know that is not scientific, merely anecdotal.

Perhaps the difference is the frequency of disk writing? HA does a LOT of logging as well as frequently updating itā€™s own database. In contrast Kodi usually just logs. It has a database, but that is only updating on adding new media, not constantly.

Itā€™s totally the database writes that kill it I believe.

In my opinion it is soon time to realize that HA has grown out of Raspi. For two reasons. For every day that goes by HA get more complex. The minimal memory in a Rpi becomes a problem. The second reason is ofc the se card. I fully agree with DavidFW1960 that the writing to the db is a big problem

What would you recommend instead of pi? Nuc? And which one? Something for 150-200$ would be enough for that?

There is nucs built on celeron in that price range. Mine in much overkill but because of the cctv I wanted a powerful one.

Have a look at the many long threads about this subject on the openHAB forum. In a nutshell, SD cards have a finite number of write-cycles (and itā€™s far less than SSD). Home automation software typically does a lot of writing (logging) and definitely chews through that finite number. However, if the SD card has lots of free space, wear-leveling spreads the writes around so it is possible to have an SD card last for a long time.

What the SD card really handles badly is being interrupted in mid-write. Owing to the way it does an erase prior to a write, incomplete operations can result in data-corruption. The symptoms are usually bad behavior from software (OS or application) because it ingests corrupted data.

If the card is subjected to frequent writes (like logging by sensors), odds are good that pulling the plug will interrupt a write operation. The consequences depend on what was being written to the card (maybe shuffling around some blocks of a critical application file).

An SD card can also put itself into permanent write-protect. I was using the dd command to make an image of an SD card. Long story short, the cardā€™s internal file-management software deemed it was undergoing a destructive set of write operations so a safeguard kicked in (to protect the contents) and it engaged its permanent write protection (making the card read-only). I didnā€™t even know it was capable of doing this and had to read some nitty-gritty details to learn what just happened. Thereā€™s no way to disable this mode of write protection. It was still under warranty so the manufacturer agreed to replace it. Thereā€™s more than meets the eye with these devices.

I had the exact same problems. My raspberry crashed 4 time, each time after about 3-5 month.
Iā€™ve bought good sd cards and power supplies etc. Didnā€™t help.

Bought a nuc6cayh a year ago (150ā‚¬ incl ssd, ram) and all worries are gone ā€¦ Plus itā€™s a lot faster.

So highly recommend to leave the pi.
Jkw

That is why I have the recorder log to a mysql DB on a server, not the SD card.

Definitely the amount of disk writes. I have run OSMC (uses kodi) for a number of years on the Pi as well as using tvheadend addon for live TV on the same device which has constant disk writes for tuning and recording. what a nightmare. Frequent crashes and failed SD cards.
Moved tvheadend to dedicated box, result. Pi devices have not failed ion over 18 months or more.

When I wrote that I have two RPiā€™s that have been running fine for a year, I shouldā€™ve explained that Iā€™m using log2ram.

Log2ram redirects logging from /var/log to RAM and then periodically writes it out to the SD card. Iā€™m using the default period of one hour. Log2ram minimizes the number of direct writes to the SD card. Upon initiating an orderly shutdown, log2ram writes out its RAM cache to the SD card before the RPi shuts down.

The caveat is that the RPi ought to be protected by UPS because, if power is interrupted, you stand to lose up to an hourā€™s worth of logging. In addition, itā€™s limited to caching log files written to /var/log and not elsewhere.

1 Like

You can solve it on a rPI but to be honest by the time you add all the ā€œfixesā€ to keep it reliable itā€™s probably about the same cost to buy a cheap mini PC (look for used SFF Dell Optiplex or HPā€™s from offices that have been updated - often you can get them for almost free). Or some like the old laptop option; but that one bugs me as keeping a laptop permanently powered typically causes batteries to swell and other not so nice things.

Or buy a low end NUC, Zotac, etc, etc, if you want new.

But ditch the rPI and your HA experience will be much much happier.

1 Like

The challenge here is logs are typically most important right before a system panic or attack/breach to understand what happened. This setup almost ensures you will be missing the logs you require most.

There are also many nuc like computers on aliexpress.

Lenovo Think Centre Tiny is also a nice form factor.

From a technical standpoint, I agree with you. The critical portion of the log will be lost.

From a practical standpoint, the odds of my system experiencing ā€˜a system panic or attack/breachā€™ are very low. Iā€™ll go with the convenience of stability and not having to replace SD cards every 6 months or so.

FWIW, Iā€™ve been running a home automation server since 2006 and, over two generations of hardware, experienced one power-supply failure.

Thank you all for your dediction to this thread.

So, a nuc will maybe be a good solution? Is the installation prosess the same as with a pi?

Maybe I can try with an cheap(read small) UPS + pi first?

It seems like HA is starting to be quite expensive, but I like growing alongside HA instead of buying something more profesional.