Issue Description
While trying to access an OpenVZ container using the following command:
vzctl enter 10524 you may encounter this error:
Unable to fork: Cannot allocate memory Here, 10524 refers to the container ID.
Step 1: Check Node Memory Availability
First, verify whether the host node is running out of memory:
free -m If the system shows sufficient free memory, the issue is likely not at the node level.
Step 2: Check Resource Limits (privvmpages)
If memory is not the issue, the problem is usually related to OpenVZ memory limits, especially privvmpages.
Check current resource usage:
cat /proc/user_beancounters This file contains resource usage and limits for all containers.
Step 3: Identify the Problem Container
Locate the entry for container 10524 and check the privvmpages values:
- If failcnt is high or non-zero
- And memory is marked as exhausted
Then the container has hit its memory limit.
Step 4: Increase privvmpages Limit
Edit the container configuration file:
vim /etc/sysconfig/vz-scripts/10524.conf Find the privvmpages parameter and increase its value.
Example:
PRIVVMPAGES="unlimited:unlimited" or set a higher limit based on server capacity.
Step 5: Restart the Container
Apply the changes by restarting the container:
vzctl restart 10524 Conclusion
The “Unable to fork: Cannot allocate memory” error in OpenVZ is typically caused by exhausted privvmpages limits, not always system-wide memory issues. Increasing the container’s memory allocation resolves the issue in most cases.
If you require help, contact SupportPRO Server Admin

