Sometimes you may find that a guest virtual machine under a Windows based VirtualBox host freezes. When looking at the VirtualBox management UI the VM ist shown as „paused“. Most of the time you will be able to continue the VM and everything seems fine again. Until it happens again. I found this (default) behavior annoying. Here is a solution.
The reason is that VirtualBox by default does not allocate all of the RAM that you have configured for the VM. Instead, RAM is allocated on request of the guest VM when actually required. Then it may happen that the host machine is out of memory, e.g. if you have started lots of other programs on the Windows host. In this case VirtualBox pauses the VM. If you thought it would continue the VM once more memory becomes available, you are wrong. You need to go to the management UI and continue the VM manually.
The solution here is to force VirtualBox to allocate all RAM dedicated to the guest VM at startup. Then the VM will run perfectly or it will not be started at all, if there is not enough memory available at this time. You then could shutdown some programs on the Windows host and try again.
Here is how to configure VirtualBox for allocating all memory to a VM at start-up. There are two ways and you could choose the way you like.
Solution #1
Run the following VirtualBox command line tool:
VBoxManage setextradata <vmname> VBoxInternal/RamPreAlloc 1
This command actually does nothing more than what you could do yourself as described in solution #2 below.
Solution #2 (my favorite)
Find the .vbox file of your virtual machine. It contains all configuration parameters and is formatted as XML. Edit this file using your favorite text editor.
Find the element <ExtraData> and a a new element <ExtraDataItem> with following content:
<ExtraDataItem name="VBoxInternal/RamPreAlloc" value="1"/>
Finally … restart the VM !