Page 1 of 1

-bash: fork: retry: Resource temporarily unavailable

Posted: 2012/04/13 04:05:40
by CentUser_US
Hello CentOS,

I got a lot of errors like in below:


-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

Then I could do nothing, and the shell behave also very abnormal


-bash-4.1$ pwd
-bash-4.1$ pwd
-bash-4.1$ who
-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: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: retry: Resource temporarily unavailable
^C-bash: fork: retry: Resource temporarily unavailable

Does any one knew what is going with mon cheri??

many thanks!

-bash: fork: retry: Resource temporarily unavailable

Posted: 2012/04/13 17:32:55
by pschaff
No idea and you have provided very little information that would stimulate one.

Did the problem just suddenly start or has it been that way since installation? Are you in a GUI or a text-mode terminal? Have you tried a different user? Rebooted? Checked dmesg or /var/log/messages? ...

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

Posted: 2012/04/13 19:45:30
by hawkmage
This is commonly caused by running out of file descriptors.

There are different file descriptor limits.

There is the systems total file descriptor limit, what do you get from the command:
[code]sysctl fs.file-nr[/code]
From this command you will get 3 numbers. First is the number of used file descriptor the second is the number of allocated but not used file descriptor and the last is the system max file descriptor. If either of the first two numbers are new otr at the third you need to increase the number of file descriptors for the system of find out what is consuming them.

If the total of the used system file descriptors is not near the max it may be a user limit.

To find out what a users file descriptor limit is run the commands:
[code]sudo su - UID
ulimit -Hn[/code]
Replace UID with the user ID is the user you want to check, or if you are already logged in as that user just run the ulimit command.

To find out how many file descripters are in use by a user run the command:
[code]sudo lsof -u UID 2>/dev/null | wc -l[/code]

So now if you are having a system file descriptor limit issue you will need to edit your /etc/sysctl.conf file and add, or modify it it already exists, a line with fs.file-max and set it to a value large enough to deal with the number of file descriptors you need and reboot.

The line would look somehting like:
[code]fs.file-max = 204708[/code]

If it is a individual users file descriptor limit then you will have to update the users limits in the /etc/security/limits.conf file with an entry like:
[code]UID soft nofile 4096
UID hard nofile 10240[/code]
Once again you will have to replace UID with the user ID of the account with the issue.

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

Posted: 2012/04/18 03:28:31
by aga-cn
Hello,

Many thanks for your help!

aga-cn

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

Posted: 2015/05/26 18:55:17
by Gary_Petersen
For me, I got the same error message but had a different solution.
Cron failed with : (CRON) ERROR (setreuid failed): Resource temporarily unavailable
Bash logins failed as described in the main topic (no disk access was allowed, but built in bash functions could be used like pwd or echo).

The fix was to edit /etc/security/limits.conf
My process was "apache" so I added
apache soft nproc 2000

If you want it for all users, change apache to *

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

Posted: 2016/03/16 14:08:32
by lbleicher
I'm facing exactly the same problem, but it gets worse: it basically made my terminal (I use bash) completely unusable, as I can't even run any of the commands listed above: it returns just a series of five errors messages like this and then returns to the terminal - but without running the command I typed. Is there any other way to solve the problem without using the terminal? KDE is running just fine, but I simply can't do anything on the terminal.

This is what I would get if I try to run any command in the terminal
sudo su - UID
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

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

Posted: 2016/03/16 16:50:35
by aks
Probably a ulimit problem. What's the ulimit for he user you're working as (or su'ing as), what resources does that user currently have, clearly you have to add more (you're supposed to use /etc/security/limits.d/*.conf)

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

Posted: 2016/03/16 17:15:33
by lbleicher
It seems it is now ok now. Since I was unable to do anything on the terminal (or using alt-f2 to run specific problems), and there was no way to edit limits.conf on KDE as well, the solution was to go to one of the text-only terminals (CTRL-ALT-F2), log as root (logging with my user wouldn't work), and then add "* soft nproc 2000" to the limits.conf file.