My Rasberry Pi 4 running my Nextcloud Server sometimes just stops responding to everything except pings after a while, force rebooting it (disconnecting and reconnecting the power) temporarily fixes the issue and everything seems fine, but then the issue comes back some days later. This happens every few days or so. The nextcloud server is also down when this happens. The strange thing is is that it still responds to pings, so it doesn't completely crash and clearly still has a network connection. One thing I note is that a few days ago I had a different issue and after rebooting the pi trough sudo reboot, I had this same behavior (had to power cycle before I could ssh in), and I do automatically reboot the Pi every few days, but I'm not sure if that lings up and I did reboot it sucefully many times before, so I'm not sure if that really related or just a coincidence.
The Pi is connected trough ethernet, so far I haven't tried connecting a monitor and keyboard. I'm running Ubuntu 22.04 on the Pi.
I'm not sure what I can try to fix this problem (outside of connecting a keyboard/monitor directly) are there any logs I can look at? One thing I will test is to see if the issues is reproducible by rebooting trough a command, but even if that's the issue what would cause an issue like that on reboot but not on powercyle (Haven't tested yet if it really happens on reboot)?
Edit: It definitely doesn't happen on every reboot, I rebooted multiple times without any issues.