178

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
  • a 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.

Any ideas?

Why is it slow? And how can I make it faster?

fossfreedom
  • 172,746
Giorgio
  • 2,171
  • Have you tried messing around with configurations? Have you tried installing guest editions? – usr12390 Oct 28 '12 at 19:36
  • Yes i've installed guest additions, but nothing seem to change... the strange thing is that i've install many virtual machine with ubuntu or other distro but only Ubuntu 12.10 does this... during the installation i've leave all setting by default, as ever; the other 2 virtual machines work fine... – Giorgio Oct 28 '12 at 19:44
  • 2
    Flimm's answer below fixed the slowness issue for me. http://askubuntu.com/a/214968/107015 – JS. Nov 10 '12 at 19:42

7 Answers7

281

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 -p
Not software rendered:    no
Not blacklisted:          yes
GLX fbconfig:             yes
GLX texture from pixmap:  yes
GL npot or rect textures: yes
GL vertex program:        yes
GL fragment program:      yes
GL vertex buffer object:  yes
GL framebuffer object:    yes
GL version is 1.4+:       yes

Unity 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.

  1. Install VirtualBox Oracle VM VirtualBox Extension Pack.
  2. Create a VirtualBox instance and install Ubuntu 12.10 on it.
  3. Install some required packages for the guest additions:

    sudo apt-get install linux-headers-$(uname -r) build-essential
    
  4. Install the guest additions by clicking Devices, Install Guest Additions and running this command from the CD-ROM's directory:

    sudo ./VBoxLinuxAdditions.run
    
  5. Add the vboxvideo driver to the instance by running:

    sudo bash -c 'echo vboxvideo >> /etc/modules'
    
  6. Shutdown the VirtualBox instance.
  7. Open the settings of the Virtualbox instance, navigate to "Display", and tick "Enable 3D acceleration".
  8. Boot your Ubuntu 12.10 guest, and check that 3D acceleration is working by running:

    /usr/lib/nux/unity_support_test -p
    

If windows seem to disppear, install CompizConfig Settings Manager and disable Framebuffer Object (FBO) in the OpenGL section:

  1. Install the CompizConfig Settings Manager:

    sudo apt-get install compizconfig-settings-manager
    
  2. Run the CompizConfig Settings Manager:

    ccsm
    
  3. 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.
Flimm
  • 41,766
  • 28
    This is a great fix, and deserves multiple upvotes. – nanofarad Nov 09 '12 at 12:11
  • Might also want to note that when you run VBoxLinuxAdditions.run it might complain if you've had the packaged driver installed. So "sudo apt-get remove --purge virtualbox-guest-x11" might be useful to include. – popey Nov 12 '12 at 11:18
  • 4
    On my fresh install of Ubuntu 12.10 (using VirtualBox 4.2.4 on Mac OS X 10.6), this definitely sped things up... but there are a lot of bugs with the display. Windows disappear, the launcher doesn't show up unless the dash is open, etc. – Benjamin Oakes Nov 19 '12 at 18:20
  • I's install linux-headers-generic instead to automatically get new versions and dkms as well to auto rebuild on new kernel versions. – beruic Nov 21 '12 at 10:41
  • 12
    "Not software rendered" is a very confusing property name :S – Adam Harte Dec 05 '12 at 20:13
  • 1
    Nice post but after doing all this(and 3d is supported) the machine is still extremely slow... dmn ubuntu! – user568021 Dec 24 '12 at 17:05
  • @user568021 In case it doesn't help/satisfy you, consider switching away from Unity DE and use LXDE/XFCE/KDE instead (e.g. Lubuntu/Xubuntu/Kubuntu). – gertvdijk Dec 30 '12 at 17:27
  • When I followed the instructions in this answer, my virtual machine aborted during the boot process. I can boot the machine without 3D acceleration, making the machine slow. – reprogrammer Jan 11 '13 at 17:49
  • Disabling Framebuffer object did the trick for me. All the rest was done automatically by checking Devices/Install Guest Additions... from VirtualBox. Thanks very much. – Pierre de LESPINAY Jan 30 '13 at 15:32
  • 2
    @reprogrammer: I had the same problem. Try the additional packages from Ubuntu's repo instead of the latest ones that come with VirtualBox.

    Do this by running: sudo apt-get remove virtualbox-guest-additions (this removes the ones you installed) sudo apt-get install virtualbox-guest-additions (this installs the ones from the default repo)

    Next open the additional drivers in settings (or through software sources > additional drivers on the latest releases of Ubuntu) and select the obvious one.

    – labsin Feb 03 '13 at 20:38
  • What if I already have Virtual Machine running Ubuntu and I did not install Extension Pack? – Umair A. Mar 17 '13 at 13:28
  • Very good answer. Most recent versions of VirtualBox prompted me to run the Guest Addition script directly when "inserting" the ISO instead of having to run a sudo-command manually. – Thorbjørn Ravn Andersen Mar 18 '13 at 11:39
  • 1
    I'v done this and unchecked framebuffer...now my screen is flickering like hell :( – Dumbo Apr 23 '13 at 13:38
  • I had a problem where this fix would not work, but then I first made sure to boot into Ubuntu with 3D acceleration unchecked, then again with it checked. You can do that at the end of the instructions. – RyanTM Apr 25 '13 at 19:32
  • Great advise, thanks! I had "Guest Additions" installed early and only missing thing was: sudo bash -c 'echo vboxvideo >> /etc/modules'. After restart i got "Unity 3D supported: yes" and UI become faster. – Grimmo Aug 07 '13 at 13:37
  • Can confirm this works with Ubuntu 13.10 on VirtualBox 4.3.8. It was just about unusable until I performed this fix and now it is running much as I'd expect for a VM. Not experienced any of the windows disappearing. As Thorbjørn Ravn Andersen said, I also found GuestAdditions ran automatically without the need for the sudo command. – Steve Pettifer Mar 02 '14 at 16:45
  • Whenever the guest additions stop working due to some Ubuntu update, I find myself revisiting this specific answer. No question in my mind that this is the one admin-related answer on stackexchange that has been most helpful to me. – G. Bach Mar 11 '14 at 15:43
  • VirtualBox 4.3.10 on Debian, Ubuntu 14.04: be careful concerning Part 4. You need to type the command 4 after part 1-3. Maybe it doesn't work if you use the automatically pop up installation. This time it worked for me, although I got a lot OpenGL Warnings on command 8. – PythoNic May 30 '14 at 14:06
  • 6
    I couldn't get this to work with VirtualBox 4.3.12. The solution for me for VirtualBox 4.3.12 is to get install a newer version of GuestAdditions as referenced here: https://www.virtualbox.org/ticket/12941 Specifically, https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.13-93885.iso – Gordon Glas Jun 10 '14 at 20:26
  • 1
    Gordon's link is a 404 now, but this one still works: http://download.virtualbox.org/virtualbox/4.3.14/VBoxGuestAdditions_4.3.14.iso Installing it fixed 3D rendering for me. – Tor Klingberg Jul 30 '14 at 21:33
  • Doesn't work in virtualbox 4.3 and ubuntu 14.04 – Nate Sep 26 '14 at 12:36
  • 1
    @Nate I got it working by just installing the latest VirtualBox (4.3.16 at the moment), latest Guest Additions and enabling 3D acceleration. I didn't do any other steps from this answer. – Vinicius Braz Pinto Sep 27 '14 at 02:23
  • You're a gentleman and a scholar! – Ezekiel Victor Dec 08 '14 at 01:51
  • 1
    This also worked great on 14.04 – Wjdavis5 Jan 13 '15 at 16:59
  • Works perfectly on 17.04 host and 17.04 guest. Thank you kindly. – Matt Mar 21 '17 at 12:42
37

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 Ubuntu 12.10 unable to use 3D acceleration. Fails to build DRM.

Bret
  • 510
  • I've thinking the same thing, because the only difference between other Virtual PC, is that there is only unity 3D... and I can't use the 3D acceleration because my CPU is an old model without this function... so, I'll take a newone Processor :) – Giorgio Oct 28 '12 at 20:10
  • 1
    I don't think this is accurate -- it's lack of support for X Server 1.13 (by VirtualBox), not Unity that causes the problem. It's an important distinction because it's easy to replace Unity (e.g., with XFCE), but I don't know how to downgrade the default version of the X Server. – Mzzzzzz Oct 30 '12 at 20:13
  • 1
    Why do you say it is an X problem? For me, falling back to gnome fixed it for instance. So it was a problem of replacing Unity, rather then X? – Nanne Nov 09 '12 at 12:21
  • @marcopolo1010, Xubuntu 12.10 has XServer 1.13 and has good performance in VirtualBox (definitely much faster than Ubuntu 12.10). So it must be a Unity issue. – ignis Nov 18 '12 at 19:00
  • Also, if you're on a mac you can try increasing the # of CPU's you give to the guest. This helped me tremendously! Here is where I got the source for this: http://code.dimilow.com/ubuntu-12-10-slow-as-virtualbox-guest-os/ – Matt Wolfe Feb 15 '13 at 08:05
  • I had the exact same problem, and managed to fix this by disabling cinnamon – Pete Oct 01 '13 at 16:59
  • In VirtualBox 4.3.28 + you can enable 3D Acceleration. Settings > Display > Enable 3D Acceleration. – Roman Mik May 19 '15 at 12:54
11

It looks like the VirtualBox software developers are working on a solution, but it's not ready yet - see forum post Discuss the 4.2.4 release.

There is a thread discussing this in fourm post Ubuntu 12.10 "virtually" unusable

Andrew B
  • 286
8

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

Summary:

  • 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.

Good luck.

JohnP
  • 708
  • 2
    The blog post you linked to is for Ubuntu 12.04. Ubuntu 12.10 is significantly different, because it no longer includes Unity 2D, and normal Unity renders over LLVMPipe when it doesn't detect hardware acceleration. – Flimm Feb 22 '13 at 15:35
  • 2
    My Ubuntu Server guest became much faster after I changed the video memory from ~8MB to 128MB. I use it for Rails development. –  Sep 06 '14 at 20:15
5

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

Nanne
  • 8,625
  • 1
    In Ubuntu 16.04 the package name is gnome-session-flashback. This is the only thing that seems to make a difference in ui performance for me. thanks! – Mustafa Oct 23 '17 at 03:53
2

To enable 3D supported, fist you will need to update linux-headers

$ uname -r
$ sudo apt-get install linux-headers-$(uname -r)
$ sudo apt-get autoremove
$ sudo apt-get install build-essential

Now insert vitualbox guest iso from devices and to install manually

$ cd /media
$ ls
$ cd username
$ ls
$ cd VBOX*
$ ls
$ sudo ./VBoxLinuxAdditions.run

Insert vboxvideo to /etc/modules

$ sudo nano /etc/modules

Add “vboxvideo” at the end of the file

loop
lp
vboxvideo

Reboot the machine

$ sudo reboot

Check ”Not software rendered” and “Unity 3D supported” are enabled or not after rebooting

$ /usr/lib/nux/unity_support_test -p

The next thing you want to do is to increase video memory. Look for .vbox file

$ nano /home/username/VirtualBox VMs/ubuntu/ubuntu.vbox

Replace

<Display VRAMSize="128" monitorCount="1" accelerate3D="true" accelerate2DVideo="false"/>

To

<Display VRAMSize="256" monitorCount="1" accelerate3D="true" accelerate2DVideo="false"/>

source: How to fix slow performance ubuntu 13.04 running in virtualbox

0

for me what simply worked was Enabling 3D Acceleration in virtual machine display settings enter image description here

Waqleh
  • 871