bash fork error (Resource temporarily unavailable) does not stop, and keeps showing up every time I try to kill/reboot
Given that you can login, you may want to try using exec
to execute all your commands. After executing exec
you will have to log in again, since exec
will kill your shell (by replacing it with the command you run).
exec
won't take up an extra process slot because it will replaces the running shell with the program to run. Thus, it should be able to bypass the ulimit
restriction.
I had the same issue recently. In my case the reason was there was code that was executing under my ownership and consumed almost all the resources leaving nothing for my commands. Here's what I did, "exec top" to identify the PID thats consuming maximum resources "exec kill -9 " killing the PID identified by above command.
After killing the PID, everything came back to normal and I was able to login back.