Bumblebee / Primus and VMware Workstation (nvidia optimus graphics on Ubuntu)

I have a new Lenovo T430 with Nvidia/Intel hybrid graphics. The Intel card is for power saving, the Nvidia card for performance. The easiest way to handle this setup is to just choose the correct card on bootup, but this is inconvenient. Bumblebee provides a way to use the Intel card most of the time, but use the Nvidia for high-performance tasks such as games, and ONLY for those apps. Once it’s set up, it works pretty well, except for a few apps that require additional tweaking, such as Steam, or Wine.

One of the apps that requires tweaking is VMware Workstation (I’m running WKS 9). cmillersp provided a great write-up on the VMware Communities, which is what I set up on my system. VMware Workstation runs great – I can load OpenGL 3D apps in VMs and everything runs fantastic.

Except that I run VMs all the time, and using the Nvidia card all the time kills the performance benefit of the Intel card twice: once because I’m using the Nvidia card, and once again because BOTH GPUs are running at the same time. So I wanted a way to dynamically choose which card to run VMware under, based on whether I was on AC power or battery power.

The result is the attached script below, which I’ll be submitting to the Bumblebee wiki / project, as well as the VMware forums. This is version 1, which works as follows:

  1. Must be installed by “sudo ~/bin/vmware –install” – it will make the cd /usr/lib/vmware/bin; mv vmware-vmx vmware-vmx.real and then do the script creation at /usr/lib/vmware/bin/vmware-vmx, so that it’s a single portable script.
  2. Takes several options to force using the Nvidia card or not
  3. If no force option is applied, automatically determines AC adapter state or battery charge/discharge state
  4. Based on the above, decides whether to launch /usr/bin/vmware normally, or via the instructions from cmillersp

I’ve done some additional work to make it run via either “primusrun” or “optirun”. Optirun is much slower, but at least functional with fewer installs. I hope this is useful to someone else!

Edit: 2012-12-17 – v1.1 added gksu auto-detection
Edit: 2014-01-08 – Moved to github repo: github.com/docsmooth/vmware-bumblebee

7 Responses to “Bumblebee / Primus and VMware Workstation (nvidia optimus graphics on Ubuntu)”

  1. 2014-01-20 at 12:09

    I have up to date nvidia drivers, bumblebee and vmware installed. I’m new to scripts and was wondering if it was possible to get a little more detail on the install process. I’m still very green with Linux.

  2. 2014-02-25 at 10:33

    Tj: When you download the “vmware” script from github, you’ll save it into a folder like “/home/tj/bin”. Run “chmod +x ~/bin/vmware” to make it an executable program, rather than just text. From there, it has a self-installer: “vmware -i” and it will use sudo to prompt you for the parts it needs elevated privileges for.

  3. 3 Kyle Miller
    2014-03-18 at 20:33

    Thank you for doing this. Should I see optirun or primusrun or some host process when running a VM with Bumblebee? I see vmware-vmx.real is the host. Is this correct?

  4. 2014-04-07 at 09:47

    the process in your process list should be vmware-vmx.real. The difference is that you’ll be able to enable 3D graphics and not get an error message on boot. If you have issues, please post as issues to the github project, so I can track and update it there!

  5. 5 peterwolf
    2014-11-24 at 06:46

    Does this script work for WMWare player ?
    I’m running under ubuntu 14.04 on a Qosmio laptop with Optirun (intel + nvidia GT540M) an Bumblebee installed, and I want to launch an Lubuntu 14.04 with WMWare player 8.
    Is the script functional for this ?

  6. 2014-11-24 at 10:15

    Peterwolf – it should now. Please use the issue tracker in github for any problems with this. I just updated the request for vmware-player support. I’m running with vmware player included with VMware Workstation – I don’t believe the standalone version works differently, but I may be wrong, so let me know how it works.

Leave a Reply

About Us

Complete networking solutions for business.
December 2012
« Oct   May »