Did you have any other OS installed on there before that was running stabily? How long ago was that? This sounds like a bad drive or cable. The OS continues to run because it’s loaded to RAM, but any command you execute in the shell gets read from disk.
You could try to run btop and iotop while doing normal work. These two together track pretty much all your resources and you can try to see if there’s anything suspicious happening like swap filling up quickly, I/O activity dropping or peaking, stuff like that.
The OS is installed on an M.2 in an M.2 USB Adapter, so there might be that it goes to sleep, maybe, but I can’t verify anything, cause there are so few commands available when it happens.
It happened right now and I can’t even issue a dmesg command.
If I reboot, then everything is ok. I don’t even have to wiggle the cables, so it’s not a loose cable issue;)
EDIT: I can’t even use “systemctl reboot”; it only gives access denied. I have to hold down the physical power button.
When I rebooted with that command, it got stuck in BIOS, saying no boot drive was available. I had to physically hold down the power button to turn it off and when I turned it on again, everything worked fine.
So, this strengthens the idea that it might be going to sleep?