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?

David
  • 9,799
  • 5
  • 28
  • 32
  • 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 https://www.virtualbox.org/ticket/14137#comment:16 – kirbuchi Feb 02 '16 at 01: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 Feb 10 '16 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. – ssssssssssssssssssss Nov 11 '18 at 15:24

4 Answers4

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

Alf Eaton
  • 5,226
  • 4
  • 45
  • 50
tthayer
  • 513
  • 3
  • 5
17

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.

Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68
EngineerCoder
  • 1,445
  • 15
  • 30
5

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).
Greg Dubicki
  • 5,983
  • 3
  • 55
  • 68
Eyal c
  • 1,573
  • 1
  • 11
  • 8
  • 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 – Kamafeather May 15 '19 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. – Kamafeather May 15 '19 at 14:23
  • [Here an example or solved problem from Virtualbox forum](https://forums.virtualbox.org/viewtopic.php?f=8&t=89896&sid=ce1a6b075ed3d6f06a2bec0dece11411&start=15). By the way, for me it was sufficient to just uncheck the *"Enable Audio Input"*; output can stay enabled in my case. – Kamafeather May 15 '19 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.

brablc
  • 1,621
  • 18
  • 17