I’m using Ubuntu 14.04. Recently, when I login via SSH with my user with sudo privileges, every command I run results in a “Cannot allocate memory” error. Here are a few I tried at my console
myuser@mymachine:~$ whoami
-bash: fork: Cannot allocate memory
myuser@mymachine:~$ uname -a
-bash: fork: Cannot allocate memory
Even if I try sudo reboot now
I get the above error, so I don’t know what else I can try to unlock my instance. The host is DigitalOcean if that matters.
Edit: Per the answer/suggestion given here is the output of "free"
myuser@mymachine:~$ free
-bash: fork: Cannot allocate memory
sudo sysctl -w vm.oom_kill_allocating_task=1
or permanently on/etc/sysctl.conf
. – Pablo Bianchi Feb 27 '19 at 16:09sudo reboot
before running this. Thanks! – boulder_ruby Jun 13 '19 at 21:14sudo
orsysctl
. Butecho
is built into bash, so this could work without needing to fork. – Jeff Learman Jan 26 '24 at 15:33