Since I updated the Raspberry Pi we have in our Living Room to Home Assistant 2024.2, there have been a lot of system freezes occurring. At first I thought it was a custom component causing the issue, since the crashing would stop when booting into safe mode. However that was not the case, as when doing intensive tasks it seems to cause the same system freeze as would be happening randomly. I tried out 2024.3 for a bit, but that unfortunately did not improve the issue. I’ve reverted back to version 2024.1 for now, which seems to at least prevent the random system freezes, so I suspect the migration to Python 3.12 may be partially the cause. However when making a backup, the system still freezes, and upon closer inspection the CPU load spikes to 100%. Before updating to 2024.2 I was able to make a backup without issues of the 2024.1 version (it’s still in the backup overview, and I always make a backup before updating), but that is not the case anymore.
Generally, this seems to be the main entry in the logs that occurs each time:
Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: 15:12:01 (4 occurrences)
Last logged: 17:50:15
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 715, in ping
await self._send_frame(message, WSMsgType.PING)
File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 682, in _send_frame
self._write(header + message)
File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 702, in _write
raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport
However, that may simply be the webpage losing connection.
The instance is running Home Assistant Container on a Raspberry Pi 3B with 1GB of RAM. Aside from home assistant there is one more Docker container running Castsponsorskip as well as a website with PHP and an SQL database.
When being “idle” i.e. not making a backup, the RAM usage is around 0.55GB. I couldn’t point to a single component causing the random freezes, however.
My question is, is it the hardware reaching the limits of what it can run, or could it be that the micro SD of the pi is wearing out?
Thanks for the link! I dug a bit further, trying to run fcsk on boot, which aside from the pi not connecting to the internet did not immediately show any problems. I did dig around in the "/var/log/syslog" file, which led me to the following error:
blk_update_request: I/O error, dev mmcblk0, sector 14865099 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
mmc0: timeout waiting for hardware interrupt.
There’s a chance this is indicative of a failing disk. I’ll hopefully have time tomorrow to perform a backup of the sd card and then inspect it a bit closer. I’ll come back to that.
Okay I have gone through quite a few hoops, but am currently trying to make a “backup file” using ddrescue. A few read errors popup, so there is at least something faulty on the sd card. In fact, I ended up trying ddrescue because on win32diskimager on my windows pc wouldn’t do it. And trying to make a backup image using dd on a orange pi zero I had lying around (I’m pushing that tiny thing to its limits like this I suspect) also ran into an error around the same size as win32diskimager. The biggest problem right now is trying to copy the partition of the 64GB sd card to a 64GB usb stick, since I had nothing bigger lying around. And the writeable part of the usb stick is just ever so slightly smaller
The command I ended up running is ddrescue -f -s52GiB /dev/sdb2 /dev/sda1 mapfile, with the -s flag being there to limit the maximum output size (I believe). There’s only 32GB of actual data on there, so hopefully not too much gets lost/corrupted, although I should have a new card arriving tomorrow.
Posting this mainly in case someone is running into similar problems. The backup is just in case the sd card does fully corrupt before tomorrow. For the new SD card I’ll be going with a clean install of raspbian, since mounting the partition of the current one on a (different) linux machine also gives access to the base linux file system.
Yes, that’s indeed plan! I’ve done that once before when migrating from a core installation to a container one.
However, the other website has for example an sql database that is partially integrated into the Home Assistant server as well. I didn’t set that one up, however, so I’d rather have as much of the SD card backed up at the moment, just in case.
Forgot to reply here, but I’m done with migrating everything, more or less. Setting up the website and php server and stuff wasn’t too difficult whilst following tutorials. I remember I had some trouble with extracting the Home Assistant backup from the backup file though. The command didn’t quite work and required some fiddling compared to the one mentioned in the docs. I’ll see if I can still find which command eventually worked.
EDIT: Should’ve been this command: sudo tar -xOf "core_2024_3_3.tar" "homeassistant.tar.gz" | tar --strip-components=1 -zxf - -C "/home/USER/homeassistant/"
The error for me was in ./homeassistant.tar.gz that’s in the documentation. Removing the ./ fixed it.
Just to say, I would highly recommend upgrading to an SSD on the USB, they are not too costly these days, it will not only speed up your system, it will make it much more stable/robust.
Yeah, I did go with a similar SD card like Max linked in his post: Samsung PRO Endurance
In case of reliability it is not as good as an SSD which I am aware of, but considering this is in my student house, it’s not as easy to make big expenses like this. The pi4 I have running in my own room uses the same SD card, which I opted for after researching which would be best suited for reliability. But at some point I will switch to a better setup for myself at least.