I am running my Pi headless over ssh. It always drop ethernet connection randomly. Sometimes it works for 1-2 hours, sometimes almost a day, but it always drop connection within a day. Than when I restart Pi everything works fine. I can’t imagine what cause this, because I don’t modify anything on Openhabian.
I have already reinstalled Openhabian to different cards, changed cable, etc. but still drops connection. Do you have any idea what can cause similar issues?
To be honest I don’t know if Pi still works when connection breaks. Because I don’t know which log should I check to see if Pi freezes at all or just ethernet connection breaks.
Possibly out of memory… Although 1-2 hours sounds awfully aggressive (FWIW when I ran on a 1GB 3B+ I had to restart openhab daily around mid-night because it would hang due to OOM after 2-3 days)
To confirm, log the memory usage and look at it. If your memory usage is going down and free mem (Including cache) is depleting to 0 you’ll get OOM lockups.
If you have a Hi Endurance SD card (Sandisk white ones - which are the only ones they’ll honour the warrenty with when you use them in a Pi) you could try adding some swap space. Which would just make your system slow when it starts to swap, rather than unresponsive… Or upgrade your Pi to a 2GB or 4GB model (I run on a Pi4-4GB model nowadays and it usually has about 1.5GB free and is stable for a few weeks at a time)
I am running on pi3b (1gb ram) and the memory used is leveling at 55%. Running after the upgrade to 2.5 now for nearly seven days. Before the max memory usage I have seen was 60%!
In other words, the reason for dropping g the connection might NOT be OOM.
For me a Pi 4 is running since the last blackout, 48 days ago really stable.
A fast way could be to determine that only the connection is lost or the whole Pi freezes is, connect a display to the raspberry and have a look at it when it disappears from the network.
If you can’t do this, you can have a look at the syslog after the reboot.
Are you using a known good Ethernet cable? I have had flaky cables cause issues in the past. Perhaps swap cables with a device you know has been working reliably.
Have you checked the system logs for errors?
Probably the first log I would check to see if it’s still running but is just the ethernet is the OH events log, at least if you have something like zwave or zigbee that would continue to run even without a network connection. The general syslog in /var/log/syslog I would think would have stuff in it too to check. If there’s events being logged after it disappears from the network, it’s most likely just the ethernet that needs troubleshooting