Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does virtual box vboxheadless process using Vagrant use 100% of my cpu?

So I'm using a couple vagrant boxes and when i have them up, "sometimes/randomly" it starts to take up 100% cpu on my OS X machine and i have no idea whats causing it. I can ssh into the vmachine and check the load and it's at 0 sot its not something thats running in the box.

The only way I can fix this is if i suspend it and resume it, then it goes away until randomly it starts to happen again. Sometimes hours later, sometimes days later.

The only thing I can think of is it might be because i'm using nfs mounts within my virtual machine to access my projects, but i'm not sure yet. Any ideas?

like image 554
David Avatar asked Feb 03 '15 07:02

David


People also ask

How do I make VirtualBox use less CPU?

The CPU usage caused by audiodg.exe process on Windows host when running VirtualBox is higher than the load of iddle guest itself. It can be easily decreased or completely dropped out by disabling Audio checkbox in Virtualbox guest settings on the Audio tab. (Can be disabled only on closed virt.

Is VirtualBox CPU intensive?

On recent versions of VirtualBox, it is possible to set a cap on the amount of CPU usage. This solution is amazing! I had around 25% CPU usage for VirtualBox Headless Frontend for a long time, even though htop reported all four CPUs inside the VM at or near zero usage.

Is Vagrant the same as VirtualBox?

VirtualBox is basically inception for your computer. You can use VirtualBox to run entire sandboxed operating systems within your own computer. Vagrant is software that is used to manage a development environment.

Do you need VirtualBox to run vagrant?

Vagrant comes with support out of the box for VirtualBox, a free, cross-platform consumer virtualization product. The VirtualBox provider is compatible with VirtualBox versions 4.0.


3 Answers

EngineerCoder's answer only applies if you're using CoreOS.

I've run into problems if the VirtualBox Extensions pack version differs from the version of VirtualBox. Also, install the Vagrant VirtualBox guest plugin:

vagrant plugin install vagrant-vbguest

And make sure to update the plugin when you update Virtualbox and the extension pack:

vagrant plugin update vagrant-vbguest

like image 163
tthayer Avatar answered Oct 23 '22 16:10

tthayer


For Vagrant with CoreOS only please do the following:

  • Set $enable_serial_logging=false in config.rb
  • vagrant destroy
  • vagrant up
  • Observe three VBoxHeadless processes under 3% CPU

This PR is a working source of this info.


For Vagrang with any vm you can also try disabling nested paging.

See "Fix High Guest CPU Utilization in VirtualBox by disabling Nested Paging" article for more info.

like image 16
EngineerCoder Avatar answered Oct 23 '22 16:10

EngineerCoder


Step 1: keep guest additions up to date

Make sure you have vbguest plugin that will keep your guest additions up to date:

vagrant plugin update vagrant-vbguest

If it wasn't installed already, you can install it with:

vagrant plugin install vagrant-vbguest

Step 2: disable sound

In VirtualBox window:

  • Click on the machine you are using
  • Click settings
  • Go to: Audio Tab
  • Uncheck both "Enable Audio Output" and "Enable Audio Input"

Step 3: recude general CPU consumption

(Optional) Note: this step will decrease your vm maximum performance!

You may reduce the general CPU consumption:

  • Click on the Machine --> Settings --> System --> Processor
  • Reduce the Execution Cap. This limits the % of the host CPU, that the guest CPU can use. (Default, is 100% - no limit).
like image 5
Eyal c Avatar answered Oct 23 '22 17:10

Eyal c