VirtualBox High CPU Usage Problem Solved

A few days ago, I had to install Windows XP as a guest OS on my Ubuntu Hardy machine as I needed to carry out some Visual Studio work. What I noticed was that my CPU usage went through the roof (constantly at 100%) even if the guest was completely idle. Result: My laptop was shutting down within a few minutes because the CPU was heating up and its temperature going beyond 75C. And finally came to know a simple solution from a friend, that immediately worked. The solution was to create a new dummy guest machine in VirtualBox, allocate minimal RAM to it (I gave 4MB) and just run it, don’t even need to add boot disk to it and to my surprise, the CPU usage came down to just 3-4% immediately. I’m not sure why this issue is happening and how the dummy machine solved it but atleast it is working for me now. If you have a similar issue, you can try out the same.


38 comments to VirtualBox High CPU Usage Problem Solved

  • Himanshu

    I tried this on Ubuntu 9.04.
    my cpu usage still remains around 45% (it was the same before also)

  • @Himanshu: Your issue might be something else then. For me, it was continuously around 95-100% before this.

  • loomsen

    Hi shantz.

    Strange issue, I ran into some strange trouble with VirtualBox recently too. Like 3 times within 7 days my XP bluescreened and refused to boot afterwards whatsoever. So I had to backup an image I found on some external hd by chance, just to run into the same bluescreen -> unbotable state again.

    However, I had to suffer from a 2 low threshold setting (as I thought it was) as well. 85° and my Laptop would power off. Very annoying as such high loads usually only occur during builds.

    Finally I stumbled upon linux-phc, a module which enables undervolting.
    And actually, reading my cpu’s msr told me that the default vids were too high, namely 1,375V.
    Compared to what Intel defines as max, 1,175V, fixing this prevented my PC from temperature caused shutdowns ever since, my temperatures don’t exceed 80° anymore ever since, no matter what.

    I’ve been able to set the first 3 steps to the lowest possible voltage (hardcoded), the highest frequency to just one step higher.
    So, if you’re suffering from these shutdowns too, you might want to take a look at.

    http://www.linux-phc.org

    Enjoy

  • wow, thanks loomsen. That’s an interesting piece of info. It is interesting in two regards. First I didn’t know that laptop manufacturers can have such a major oversight and second that I thought undervolting was only possible through BIOS. I’ll definitely try it out. Thanks once again.

  • The problem you described here is actually due to a bug in virtual box that has to do with the CPU affinity. In other words virtual box does not like switching between multiple cores.

    By starting a second virtual box instance you are basically doing the same thing as just setting the CPU affinity for the process. If you are running virtual box from a GNU/Linux host, you can use taskset to set the CPU affinity.

  • Remiz

    Thanks man, I found a lot of posts about the subject but only your fix my problem… Also I’m too lazy and Linux noob to rebuild my kernel. So it’s a quick and dirty fix that works great :)

  • Matt

    Amazing, that fix works!

    I tried setting the processor affinity of the virtualbox processes to one CPU, but it doesn’t make a difference. As soon as I started up a “dummy” guest instance… CPU goes to almost 0%

  • Marton

    I solved the issue by:
    - changing my Windows XP installation to single core (using HALu: http://www.hardware.info/en-US/news/ym2cmZqYwp2a/Problems_updating_to_a_dualcore_CPU_Not_anymore/)
    - shutdown Windows XP
    - change the number of processors in VirtualBox from 2 to 1

  • Ant

    yep, taskset didnt help at all, but a headless 4mb ram guest with no boot disk, in a failed to boot state does. Thanks for the post! This was on centos 5

    VirtualBox-3.1-3.1.4_57640_rhel5-1

    Linux vms01.internal 2.6.18-164.2.1.el5PAE #1 SMP Wed Sep 30 13:32:13 EDT 2009 i686 i686 i386 GNU/Linux

    Intel(R) Xeon(R) CPU E3110 @ 3.00GHz

  • xin44

    You’re a great guy !
    Solved my 100% cpu problem
    seven 64 ultimate host – centos 2.6.18 kernel guest

    thanks a lot !

  • Vasilis

    Hey dude! Nice hack!

    I can’t say it solved my CPU problem completely like for others here, but it def helped a lot! My CPU usage was about 70% and with the dummy guest its now down to 20% which makes life a bit easier.

    Mac OS X 10.6 (Host) – CentOS 5.4 (Guest)

    Thanks!

  • Fani

    Awesome.. This helped tremendously. I went from ~55 – 90% CPU usage and constant load avg of nearly 1 on a dual-core machine to like max 20% cpu usage by virtualbox and load avg of nearly 0 on the linux host OS.

    Amazing. This most likely has to do with a bug in VirtualBox wrt to cpu affinity. I have one cpu enabled out of 2.

  • Jrm

    Hey,

    The following has completely solved the problem for me :

    ————-
    Your CPU will, by default, prompt Windows to load the ACPI-enabled SMP kernel. So when you switch to having Windows virtualized, this kernel remains and uses some ACPI registers that have severe virtualzation penalties (it talks to the BIOS). The solution is to force Windows to stop doing that. You can do this by going to Device Manager (right click on My Computer -> Hardware -> Device Manager), expanding ‘Comptuer’, right-clicking ‘ACPI Multiprocessor PC’, select ‘Update Driver…’, choose manual installation, from a list, and select ‘Standard PC’.

    Then reboot your guest VM.

  • ego

    This solved my problem too. Thanks.

    user@ubuntuVM3:~$ VBoxManage list hostinfo
    Sun VirtualBox Command Line Management Interface Version 3.1.6
    (C) 2005-2010 Sun Microsystems, Inc.
    All rights reserved.

    Host Information:

    Host time: 2010-07-07T20:28:30.014000000Z
    Processor online count: 2
    Processor count: 2
    Processor#0 speed: 3000 MHz
    Processor#0 description: Intel(R) Xeon(TM) CPU 3.00GHz
    Processor#1 speed: 3000 MHz
    Processor#1 description: Intel(R) Xeon(TM) CPU 3.00GHz
    Memory size: 3898 MByte
    Memory available: 3064 MByte
    Operating system: Linux
    Operating system version: 2.6.32-19-server

  • Thanks my friend, It is most practical solution to solve the problem.

  • Mike

    This is pretty much the most ridiculous thing I’ve ever heard of… but it worked… :) Thanks!

  • mc

    Yes this is the only advice here that worked for me, thanks! (although I have a single CPU)

  • mc

    I mean the one by Jrm.

  • Massimiliano Beccaria

    Hi there
    after having changed the driver to “Standard PC” the VM cannot boot anymore…
    Any other hint ?

  • Jim Klimov

    Thanks to the original poster. As others said, this seems crazy but has worked indeed!

    On one site we have a Solaris 10 system, which hosts a Linux VM under VirtualBox 3.0.12 in a local zone. This VM often does nothing inside, but the VM process ate about 80% of a CPU core.

    Note that a copy of this same setup with on our hardware behaves properly.

    We tried to fix this by CPU affinity as some other posts suggested (made a processor pool of one core and dedicated it to this local zone), but this did not help noticeably.

    But adding a DOS VM with the minimal 4Gb RAM, 1Gb Video RAM and no boot devices at all has helped indeed.

    Thanks a lot!
    //Jim Klimov

  • Carlos Dias

    Unfortunately the dummy VM doesn’t work for me.
    I have ubuntu 10.10 64bits. And try to run a Windows Vista image without success.
    The same image in Ubuntu 9.04 32 bits works fine.

    Please help.
    Carlos Dias

  • rue

    This (awfully bizarre) trick really works like a charm.

    Thanks a lot for sharing this, my office got considerably quieter now.

  • Venkat

    VM didn’t boot after setting to Standard PC, restarted VM(XP) in safe mode and changed back to ACPI and it booted normally.

  • Venkat

    Even after creating dummy Guest, the trick didn’t work, Still trying to figure out the fix.

  • rue

    VirtualBox 4 seems to have “fixed” this workaround. Sadly, not the bug for which it is required. Went back straight to 3.2

  • Tony

    The trick worked for me. MacBook Pro, REL 5.3 eating 80% of CPU when idling. Added 4Mb Ubuntu server and jacked with it just enough to get it to fail when starting. CPU dropped to the still outrageous 25% but it’s far better.

  • This is really a work around not quite a solution but thanks for the trick. Now if we can get the Oracle people to work on the issue as this is very annoying.

    We created a video about it so if anybody knows some people at Oracle just send them the link.

    http://ycsoftware.net/virtualbox-high-cpu-problem-illustration/

  • SmL9

    Wow it actually works! My main OS is Windows 7 with VirtualBox version 4.0.0 running CentOS 5.4

  • hayzey

    Works a treat for me. VirtualBox 4.0.8; host OS = Windows 7; guest OS = CentOS 4.5.

    I tried setting process affinity for the CentOS process with no luck. Bringing the dummy VM online (with no OS, halts immediately) lowers CPU from 30% to 2%!

  • user21

    Hi, the high cpu usage is back in 4.1 version.

  • This worked for me: since I have quad core just creating and runnning one “dummy” VM doesn’t work (what it does is trick Vbox into assigning just one core per VM). So what I had to do is go into program files\virtualbox and “pin” every executable within virtualbox to cpu_0
    Then it works.

  • Worked for me also.
    Host: Win7_x64 4GB ram VirtualBox 4.1.1
    Guest: Fedora 15 PAE i686

    CPU usage dropped from ~25% -> ~5%
    I tried many things before, like:
    -divider=10 (kernel)
    -Disable X window
    -set cpu affinity from taskmgr.exe
    -yelling & pulling hair
    -asking help
    ^- and nothing from the above list worked… …like a dummy VM

  • Was running Ubuntu 8.10 client on VirtualBox 4.1.2 on Mac 10.6 host when this started.

    Fixed it by checking the “Enable IO APIC” box in the System processor section.

    Hope this helps somebody!

  • Turner

    Hi. I have got the same problem. But…can somebody tell me, how to create the new dummy guest machine in Virtual Box?

    Thanks a lot!

  • Seny

    - Set 1 CPU
    - Uncheck “Enable IO APIC”
    - Uncheck “Enable Nested Paging”

    That finally worked for me after messing up with the settings for a while. Host Mac OS 10.6.8, guest CentOS 6, VirtualBox 4.1.4.

  • Benny

    This fix is still working. Great job!
    Thanks

  • [...] seems ridiculous to have an idle VM consume 50% of my CPU cycles.  According to this page, the solution is two idle [...]

  • [...] belum menemukan jawaban pasti kenapa bug ini bisa muncul. Seorang user bernama Jent dalam sebuah website mengatakan : The problem you described here is actually due to a bug in virtual box that has to do [...]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

SUBSCRIBE!





Tweet