30

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 ?

  • 2
    Looks like swap being overloaded (/tmp filesystem possibly full) – Lambert May 22 '15 at 10:58
  • 2
    ulimit -a, maybe you hit some process limit – c4f4t0r May 22 '15 at 13:29
20

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

9

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
  • 1
    When this error occurs, does the "retry" imply that it will attempted repeatedly until resources become available? – DavidB Jul 15 '18 at 4:29
  • @DavidB Or that it did retry, but failed. – Kusalananda Aug 22 at 7:40
  • @Kusalananda Okay thank you. – DavidB Aug 22 at 10:27
0

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

  • Killing every single process belonging te the user seems a bit heave handed. Also, that yum command probably would not be able to fork either. – Kusalananda Aug 22 at 7:47
  • The yum command will be run through root user, assuming that problem has occurred on a different user than root – Arun Aug 22 at 8:57
  • If the shell fails to fork df it would have issues running sudo too. – Kusalananda Aug 22 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.