-bash: fork: retry: Resource temporarily unavailable

Issues related to configuring your network
CentUser_US
Posts: 11
Joined: 2012/02/01 09:01:23

-bash: fork: retry: Resource temporarily unavailable

Postby CentUser_US » 2012/04/13 04:05:40

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!

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

-bash: fork: retry: Resource temporarily unavailable

Postby pschaff » 2012/04/13 17:32:55

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? ...

hawkmage
Posts: 162
Joined: 2011/12/17 00:00:11

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

Postby hawkmage » 2012/04/13 19:45:30

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: Select all

sysctl fs.file-nr

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: Select all

sudo su - UID
ulimit -Hn

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: Select all

sudo lsof -u UID 2>/dev/null | wc -l


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: Select all

fs.file-max = 204708


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: Select all

UID soft nofile 4096
UID hard nofile 10240

Once again you will have to replace UID with the user ID of the account with the issue.

aga-cn
Posts: 17
Joined: 2012/04/13 06:47:21

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

Postby aga-cn » 2012/04/18 03:28:31

Hello,

Many thanks for your help!

aga-cn

Gary_Petersen
Posts: 1
Joined: 2015/05/26 18:50:16

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

Postby Gary_Petersen » 2015/05/26 18:55:17

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 *

lbleicher
Posts: 12
Joined: 2015/04/06 20:11:21

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

Postby lbleicher » 2016/03/16 14:08:32

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

aks
Posts: 2495
Joined: 2014/09/20 11:22:14

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

Postby aks » 2016/03/16 16:50:35

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)

lbleicher
Posts: 12
Joined: 2015/04/06 20:11:21

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

Postby lbleicher » 2016/03/16 17:15:33

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.