fork: resource temporarily unavailable ???
If you are getting Linux error message, Resource temporarily unavailable, it’s because your system is limiting the number of files / processes / CPU that your particular user ID can use.
If you use WHM/Cpanel, enabling the “Shell fork bomb protection” can make the “Resource temporarily unavailable” message appear more often. You may get rid of this message by disabling Shell Fork Bomb Protection. However, that is a major security issue. Enabling it is a good thing. After all, do you want any jackass user to be able to write a perl script containing the line “while (fork());” and bring your system to its knees?
Instead, consider raising the limits for individual trusted users using ulimit. (You will need root access to do this.)
Make the following changes in the system shell init files.
These files:
/etc/profile
/etc/bashrc
/etc/profile.d/limits.sh
if [ "$LIMITUSER" = "root" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
elif [ "$LIMITUSER" = "YOUR USER NAME" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
else
ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
fi
Alternate Solution
To fix this, first you have to turn off cPanel’s built in ‘Prevent Shell Fork Bomb Protection’. Then, edit the /etc/security/limits.conf. Increase the limit by by putting/changing the following line:
* soft nproc 20
someone soft nproc 40
root soft nproc unlimited
It will limit to 20 processes for all users except someone and root. User someone and root will enjoy maximum of 40 and unlimited simulteneous processes.
The key is turning off cPanel’s internal protection so your box will use this file.
Related posts:
- cPanel JailShell, Unmount and Clean Virtfs If you’re a sysadmin of Cpanel server, you might be...
- How do I find out Linux Resource utilization to detect system bottlenecks? vmstat command reports information about processes, memory, paging, block IO,...
- License File Expired : Solution Due to several reasons you might have seen the error...
- Secure and Optimize your Virtual Private Server (VPS) These technques can definately help you, but remember, use them...
- Delete some specific files from all subdirectories Useful unix-command trick to quickly remove i.e. Thumbs.db files, WS_FTP.LOG...
Related posts brought to you by Yet Another Related Posts Plugin.









































