Are you facing SolusVM: Cannot Allocate Memory Error ? This guide will help resolve it.
A few days ago, one of our customers came across a "cannot allocate memory" error. This generally happens while we boot KVM VPS in SolusVM.
In this context, we shall look into methods to resolve this SolusVM error.
Nature of SolusVM: Cannot Allocate Memory Error ?
It is quite common that users experience that they are unable to boot KVM VPS in SolusVM.
In such situations, we often notice that the KVM VPS does not start in SolusVM – VPS stays offline.
In addition, we come across either of the below errors, if we press the Reboot (Debug) button on the page, SolusVM > Virtual Servers > the affected VPS:
qemu-kvm: cannot set up guest memory 'pc.ram': Cannot allocate memory
Domain kvm101 has been undefined
Domain kvm101 defined from /home/kvm/kvm101/kvm101.xml
Domain kvm101 marked as autostarted
error: Failed to create domain from /home/kvm/kvm101/kvm101.xml
error: internal error: qemu unexpectedly closed the monitor: ioctl(KVM_CREATE_VM) failed: 12 Cannot allocate memory
2021-03-23T08:56:18.128294Z qemu-kvm: failed to initialize KVM: Cannot allocate memory
These errors mean we do not have enough memory on the node. This can be due to cache.
Often, it is quite possible that there is a lot of cached memory on the KVM Slave.
How to fix SolusVM: Cannot Allocate Memory Error ?
The best solution here is to clear up the cached memory.
To do so, follow the steps outlined below:
1. Start by connecting to the node via SSH.
2. Then we free up the cached memory by running the below command:
# sync; echo 3 > /proc/sys/vm/drop_caches
Finally, if the above method does not help, then we add RAM to the node.