HA keeps crashing/rebooting

Hello, almost every day I notice that I cannot access the HA GUI. After a couple of hours, GUI is up again and I see these two error messages in logs:

The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly

Ended unfinished session (id=XX from YYYY-MM-DD HH:MM:SS.XXXXXX)

Hardware:

Software:

  • Core 2026.8.2
  • Supervisor 2026.07.5
  • OS 18.2
  • GUI 20260729.7

Some integrations I have:

  • myuplink
  • ESPHome
  • Fronius & Solarman
  • go-eCharger
  • Tailscale
  • Telegram

Additional info:

  • I have tried two SSD’s. Switching the SSD and reinstalling a fresh HA solved the issue for 3-4 months.
  • Reinstalling HA from a backup solved the issue for a week.
  • The P1 reader gives data only 15 minutes or so, but I need data every 10 seconds. I found a quick and dirty solution to this is to enable debugging mode in ESPHome. But this causes the following warnings:

esp-p1reader: [W][component:232]: Component took a long time for an operation (196 ms).
esp-p1reader: [W][component:233]: Components should block for at most 30 ms.

  • I have the following in my configuration.yaml:

recorder:
purge_keep_days: 7
auto_purge: true
commit_interval: 60

  • Upgrading Core/OS can trigger HA crashing, but usually it happens at a completely random time.
  • I do not have power outages that could explain the issue.
  • Sometimes automations run despite the unability to access GUI, sometimes not.
  • When GUI is down, HA is “offline” in Tailscale
  • It’s a remote setup so I can’t check what RPi would show on an external display or via SSH.

I’m afraid you will say that my problems are caused by insufficient SSD power supply or running ESPHome in debugging mode, but one can always hope. I really do not want to reflash the P1 reader or buy additional hardware.

Sorry I don’t see any info how mutch memory you have in you RPI4 ?

Instability is often caused by the power supply. I would try a more beefy one, especially since you have devices that draw power connected to the Pi.

8 GB. 1.2 GB was in use when I checked

It’s possible the pi is crashing due to insufficient power. How do you power the pi and SSD? home-assistant_v2.db was not shutdown cleanly could mean a random reboot of the pi which could be memory or power. Maybe look at the pi log?

What is Raspberry Pi Power Supply Checker reporting ? OK ?
And do you have many items in the USB ports, only SONOFF ??
And this relay card, does the RPI dies when the relay turns on/off.
Or maybe the SD cards get corrupted when the relay card triggers.

Official RPi 15W USB power supply → RPi
RPi → USB-SATA → SSD
RPi → SONOFF

I am not sure what to look for at the logs. I tried checking multiple logs with Gemini, but ended up in a loop of using the same commands without any conclusions.

However, this returns nothing:

➜ ~ dmesg | grep -i “voltage”

What would be the best strategy regarding power supply? Replace the official with a more powerful one, or replace the USB-SATA with one that has external power supply?

Relay card is currently “idling”. I did not install the GPIO software, when I reinstalled HA.

RPI power supply checker shows “OK” last 180 hours (during which I had multiple crashes) and before that no history data.

SONOFF and SSD in USB ports, nothing else

With my RPI setups with lots of USB devices.
I use a cheap BELKIN ACTIVE USB HUB.

Try to add one.

your syslog is at /var/log/syslog

as for power. I would separate the pi power from everything else.

Rpi"s can only supply a limited amount of power over it’s usb ports. Check the numbers with Google and the consumption of the devices connected, and see if it’s likely to be an issue.

Can you be a bit more specific when the error message occurs each time?

Looking for patterns. You may have a hardware issue, software issue, external issue or a combination of these.

My first reaction is that you might want to power your SSD independently from your Pi, where possible. The SATA to USB adapter might not have enough juice to keep SSD running constantly.

Based on the timestamp, those error messages occur the moment when HA goes back up and running. Never else.

Can this occur even if the RPI Power Supply checker state is “OK” and

dmesg | grep -i “voltage”

comes back empty?

Could it? Yes.
Do we know for sure? No

The power supply for Pi can provide power, yes, and most of the time it would seem fine. But still, that power brick is designed for Pi, not necessarily Pi + SSD.
So at the time when the SSD asking for a lot of juice, the chance of Pi power supply not be able to keep up is not 0% … hence the recommendation… at least you could mitigate the risk.

Thanks. I checked what’s available in my area and ordered TP-link UH720 hub and Startech USB-SSD cable. Let’s see if those solve the issues.

I guess it’s best just to swap the hardware first and not touch anything on the software side?

USB hub and Startech cable installed. At least Core update (including a backup) went without problems. Interestingly, a “normal” shutdown (via the GUI) and restart also triggered the “ended unfinished session” and “the system could not validate” errors. Subsequent Core update with the new hardware did not.

I’ll let you know if problems occur.

Maybe the power supply is a distraction? Maybe not if the drive was being thrashed, at peak power draw all the time.

The rest of the surrounding log entries and the actual values of the redacted time stamps particularly could have provided the clues far earlier. Is the time elapsed measured in seconds, minutes, or hours? Does it correspond to when your system seems to be unresponsive, trying to bring itself up by the bootlaces?

Peak, instantaneous, or averaged out over the snapshot period? It ebbs and flows, and that is by design, as long as it doesn’t run out, when tasks will choke and be shut down as page thrash kicks in, using your disk drive as a memory cache overflow, furiously reading and writing - the very thing you are trying to avoid (see below).

Isn’t the default five seconds, and you are buffering all the disk writes in memory for a complete minute? That is an eternity, especially for a busy system like HomeAssistant that likes to record all activity.
No wonder you have database corruption, as the cache in memory will bank up and run out.
Kaboom! Your system gets constipated. Your database ‘dirty bit’ will never close, and the rollback items will be lost as they are still in memory when the system dies, again and again, especially risky if it is attempting to verify and rebuild the database during startup and maintenance activity that may take some time to complete if you have a huge database. Usually the default values are wisely chosen - tweak at your risk.

You ARE NOT doing yourself a favor by trying to save the life of a SSD drive by a few days that is designed to last years. Sure, look at tweaking if you have a cheap SD Card from China, but the modern ones are designed for more frequent reads and writes. Your wallet is usually the safest guide - time fixing things vs money spent on reliable equipment. Advice to reduce writes is usually outdated, based on early models when the industry was maturing, many years ago, and what is good for a SD Card is often not relevant for a SSD drive. You’re not running a data center with five nines uptime on hobbyist equipment.

Try dropping it down to the recommended default of 5 and restarting, and see how much difference it makes. Record the time it takes to do the database verification phase in the system log during startup and compare it with the earlier figures in the older log.

Also: What size is your database? Examine what you are recording too. Maybe some chatty entities are being recorded that are not necessary. Disable them or change the frequency they report. Your next scheduled database purge and rebuild should take care of shrinking that (should the routines actually complete before it crashes) - be extremely careful not to corrupt anything if you are tempted to tweak anything here manually with purging and rebuilding, especially if your system is unstable. Take a 1: full, 2: verified, and 3: offline, backup before playing.

Check your system error log for errors. Some are normal. Constant crashes are not. Even the act of recording them will increase the disk load. Look at how fast your activity log scrolls past on the Activity dashboard. Make sure you have the latest updates for any addon third party apps, not just the ones from HomeAssistant, as sometimes fixes will result in far less errors happening.

Keep us posted on progress.