I am running Raspbian on a Raspberry Pi which is located in a remote location. I use Putty to connect to it via SSH.
I can connect fine but when I try to run any command I get the following:
-bash: fork: Cannot allocate memory
I've looked at many answers online but they all assume I am physically collocated with the Raspberry, which is not the case for me. I can't simply pull the plug to restart it or use the GUI.
I need to fix this issue to have it operational again. Doing a restart using
sudo reboot would be the most straightforward option but that doesn't work either.
How can I restart the Pi remotely or free up enough memory to do a sudo reboot?
Note that the only command I managed to find that works is
ulimit -a. I've tried
sh but none work.
After about an hour, some memory freed up somehow and I was able to restart it. I pinpointed the memory leak to be caused by a python script set to execute daily that was hanging every time. Moral of the story: always set a timeout on all scripts and kill them after the period has passed to prevent memory leak issues!
I am still looking for a way to do it as waiting is not really a guaranteed solution, nor is it available to everyone.