I’m using currently Ubuntu 12.04 LTS as a host machine, and I’ve virtualized three machines:
- a Xubuntu 12.04 guest
- a Windows 7 guest
- an Ubuntu 12.10 guest
All the guests have the same VirtualBox default settings, but Ubuntu 12.10 is slower!
The installation took 1h 40 min! (Normally, it takes 40 minutes.) Now it is impossible to use it, and all operations are very, very slow.
I’m using VirtualBox version 4.2.4.
Why is it slow? And how can I make it faster?
I have heard it has something to do with the fact they removed unity 2D, or somehow the switch to 3D Unity only slows down the VM performance due to the heavy reliance on the CPU handling more that it used to have to. The linux outlaws podcast talked about it a bit, but I forget the episode.
Update: The problem is with Virtualbox Guest Additions not providing 3D acceleration in 12.10 see: https://www.virtualbox.org/ticket/11107
Ubuntu 12.10 no longer includes Unity 2D, which was implemented for platforms that can’t provide 3D acceleration. Instead, Ubuntu 12.10 has Unity run under LLVM, making code intended for the GPU run on the CPU. It is much slower than using the GPU.
To check if your Ubuntu 12.10 guest is using 3D acceleration, run this command:
$ /usr/lib/nux/unity_support_test -pNot software rendered: noNot blacklisted: yesGLX fbconfig: yesGLX texture from pixmap: yesGL npot or rect textures: yesGL vertex program: yesGL fragment program: yesGL vertex buffer object: yesGL framebuffer object: yesGL version is 1.4+: yesUnity 3D supported: no
As you can see, “Not software rendered” and “Unity 3D supported” both return “no” in this example, which means Unity is using slow LLVMpipe.
How to enable 3D acceleration (VirtualBox 4.2.x only)
These instructions are intended for VirtualBox 4.2.4 or 4.2.6, installed from VirtualBox’s website, not from Ubuntu’s repo. Future versions of VirtualBox may fix this problem automatically, or may need a different workaround.
- Install VirtualBox Oracle VM VirtualBox Extension Pack.
- Create a VirtualBox instance and install Ubuntu 12.10 on it.
Install some required packages for the guest additions:
sudo apt-get install linux-headers-$(uname -r) build-essential
Install the guest additions by clicking Devices, Install Guest Additions and running this command from the CD-ROM’s directory:
vboxvideodriver to the instance by running:
sudo bash -c 'echo vboxvideo >> /etc/modules'
- Shutdown the VirtualBox instance.
- Open the settings of the Virtualbox instance, navigate to “Display”, and tick “Enable 3D acceleration”.
Boot your Ubuntu 12.10 guest, and check that 3D acceleration is working by running:
If windows seem to disppear, install CompizConfig Settings Manager and disable Framebuffer Object (FBO) in the OpenGL section:
Install the CompizConfig Settings Manager:
sudo apt-get install compizconfig-settings-manager
Run the CompizConfig Settings Manager:
- Select the OpenGL section and then untick the Framebuffer Object option. If this fixes the issue it should be immediately visible. No reboot is required.
It looks like the virtualbox devs are working on a solution but it’s not ready yet:
There is a thread discussing this here:
I don’t know about the GUI settings needed to make Unity usable inside a VM, but I do know how to tune VMs under virtualbox, KVM, and others. I’ve never had any luck making Unity work well in any virtual environment. Never tried too hard, preferring to use either pure WM or an LXDE-based DE.
More detailed settings are here: http://blog.jdpfu.com/2012/09/14/solution-for-slow-ubuntu-in-virtualbox
- Vbox defaults are not good for Ubuntu releases that like a real GPU.
- On spinning HDDs, pre-allocate the entire virtual disk. On SSDs, it doesn’t matter.
- Allocate only the storage you need. Keep large files elsewhere, outside the vStorage.
- Never allocate more CPUs or RAM than you should. 1 vCPU is probably enough.
- Leave 1GB of RAM for the HostOS. Do not over commit RAM.
- Use the VirtIO drivers for Storage and Networking. Modern Linux guests support this.
- For Windows guests, use the SATA (storage) and Intel PRO/1000 (network) drivers. It is possible to use virtio drivers under Windows, it is just a little harder.
- Enable ACPI and AHCI for all guests from 2003, WinXP and later.
- Desktop VMs should get all 128MB of display vRAM
- Server VMs should stay with 9MB of vRAM; don’t waste it.
- Avoid 2D and 3D accel settings, until you have everything else working the way you like. Ubuntu/Unity does bad things when this is enabled. It can bring a Core i7 to the ground.
There are lots of GUI performance tips in the other answers. Those are probably valid too.
These same tips apply to KVM, VM-Player, and other virtual-hypervisors. These work for servers too.
I had good results by moving back from Unity to the fallback GNOME. You can do this by just installing GNOME-session-fallback from the software center, and then choosing it on the log-in screen.
see: http://www.psychocats.net/ubuntu/classicgnome for a random detailed howto