-bash: fork: retry: Resource temporarily unavailable

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 *

 

 


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.

 

转载于:https://www.cnblogs.com/sanquanfeng/p/5092934.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值