42

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?

3
  • Old question, but still had this issue with latest Vagrant/VBox. Turns out the was a routing loop because I wasn't accesing the guest services via the private IP. See virtualbox.org/ticket/14137#comment:16
    – kirbuchi
    Commented Feb 2, 2016 at 1:52
  • I finally got around to checking this. Nope, i've always been using the private ip and not my local ip. So its something else thats causing this on my end.
    – David
    Commented Feb 10, 2016 at 17:19
  • One days I was watching youtube videos with safari and only one tab open, all my other apps is closed and I just saw the fan speed got higher and in the activity monitor That vboxheadless takes up to !60% cpu. Commented Nov 11, 2018 at 15:24

4 Answers 4

26

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

2
  • 2
    ok so i tried this and still no luck. :( I'm going to try disabling nfs and see if that fixes it.
    – David
    Commented Feb 16, 2015 at 15:32
  • Did it help, @David? Commented Mar 1, 2020 at 12:23
17
+50

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.

2
  • 3
    Where is this config.rb supposed to be?
    – Luke
    Commented Apr 29, 2016 at 5:28
  • 1
    vagrant/plugins/providers/virtualbox/config.rb Commented May 1, 2016 at 16:23
6

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: reduce 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).
3
  • That's unbelievable! All the other answers didn't help, but simply disabling the Audio devices INSTANTLY SOLVED the problem for me!! 🤗 – Why is this happening? Why didn't it happen for the last months (when I actually updated Virtualbox) but just in the last few days? Is it a Virtualbox bug, a loop of any kind? And why disabling the audio solves it? It's crazy to have an issue on a device that my machine is not even relying on 😮 – In any case, thank you, you put an end to hours of trying to figure out what was happening and let me come back to actual productive work 🙏 Commented May 15, 2019 at 14:15
  • Additional question mark: re-enabling Audio Input & Output will not instantly provoke the CPU issue on the running box. Didn't try to reload, tho. Commented May 15, 2019 at 14:23
  • Here an example or solved problem from Virtualbox forum. By the way, for me it was sufficient to just uncheck the "Enable Audio Input"; output can stay enabled in my case. Commented May 15, 2019 at 19:18
0

I have disabled System Integrity Protection in order to be able to use iosnoop to diagnose high ioctl activity, which seems to cause 100% CPU usage.

The problem disappeared. So I believe it has something to do with SIP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.