fork: retry: Resource temporarily unavailable

While I am connecting to my server I get,

-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Resource temporarily unavailable

And I try following commands also, then the result is same.

-bash-4.1$ df -h
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Resource temporarily unavailable
-bash-4.1$ 
-bash-4.1$ ls -lrth
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Interrupted system call
-bash-4.1$ 
-bash-4.1$ ps -aef | grep `pwd`
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Resource temporarily unavailable
-bash-4.1$ 

Why this comming ? And how can I resolve it ?

Asked By: Rakesh KR

||

This could be due to some resource limit, either on the server itself (or) specific to your user account. Limits in your shell could be checked via ulimit -a. Esp check for ulimit -u max user processes, if you have reached max processes, fork is unable to create any new and failing with that error. This could also be due to swap/memory resource issue

Answered By: VenkatC

fork: Resource temporarily unavailable

The error means that the current shell resource is limited (check the limits by ulimit -a). So you can either try in another shell, or increase the resources by using ulimit command which controls over the resources available to the shell and processes it creates on operating system.

To increase the limits, try running:

ulimit -Sn unlimited && ulimit -Sl unlimited

to raise the soft limits to hard one, or:

ulimit -l unlimited
ulimit -n 10240 

to set the maximum size a process to unlimited and the maximum number of open file to 10240.

See: help ulimit for more information.

To make it persistent, add the above settings into your startup rc files (e.g. ~/.bashrc).


You can also use /etc/sysctl.conf (see: man sysctl.conf) to increase the kernel limits, e.g.

kern.maxprocperuid=1000
kern.maxproc=2000
Answered By: kenorb

The problem can also be resolved using following commands:

yum install psmisc
killall -STOP -u user1
killall -KILL -u user1

Here user1 is the user group for which the limit has been exceeded

Answered By: Arun

For me, this error was actually caused by a multiline comment not being properly written… For whatever reason, this error would then occur.

Had to change this:

<<comment
# Comment lines
...
comment

# Code
...

to this (just added the quotes around the first comment):

<<'comment'
# Comment lines
...
comment

# Code
...
Answered By: Akaisteph7

dmesg is your friend. Run this command why a system might have blocked something.

With systemd based systems there are user limits handled there as well.
You check the limits with these commands:

systemctl status user-1000.slice
systemctl cat user-1000.slice

1000 is the PID of the user in charge, respective you try to login.

For further information check following page, there you can see how to change or alter the limits for specific or all users:

https://www.suse.com/support/kb/doc/?id=000019044

Answered By: Thomas
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.