nVidia OPTIMUS M11X R2 on Ubuntu 11.04

Here’s a quick guide on how to install Bumblebee/acpi_call onto Ubuntu 11.04 for nVidia Optimus GPU configurations, like those found on the m11x (and probably works for others as well). Firstly, like any good clinician, I’ll define the problem for you, and then tell you how to install something that fixes it.

Optimus setups have two GPUs. One is the Intel GPU, the other is the nVidia GPU. The idea of the system is that the low power Intel GPU is active for most of the time, while the nVidia GPU kicks in with 3D hardware acceleration is needed (or as defined by the user). Optimus does this automatically using a nVidia driver under Windows. Under Ubuntu (or Linux in general) this doesn’t work at all, and both GPUs will be active at the same time. This causes a significant problem for users of these laptops because the nVidia GPU will be chewing battery power like a hungry fat kid whether it needs to or not. Fortunately there’s a fix.

The fix I describe here applies to Ubuntu 11.04 primarily, but the actual concept behind it will work for some other Linux distros. I don’t use anything except Ubuntu though, so you’re going to have to look here for more instructions: https://launchpad.net/~hybrid-graphics-linux

This method also works for some other hybrid GPU systems, but my main focus is on the m11x R2, because unlike the R1 there’s no other method to stop the nVidia GPU from powering up. Note that if you’re going to use Ubuntu on your m11x R2 you pretty much NEED this fix to use it on battery power; battery life with the nVidia GU is about 3 hours, on the Intel one it’s closer to 5. Also the GPU’s fan will spin up and make the entire thing noiser. The main thing is to gain back battery life though.

There are two methods that you can use. One is the brute-force acpi_call method, which isn’t automated in the least, but does work. I won’t go into it here because there’s no need to anymore; the much better method using Bumblebee incorporates acpi_call. acpi_call used to be required simply because it actually toggles the GPU on and off, whereas earlier releases of Bumblebee would not actually power down the nVidia GPU when it wasn’t being used, making it fairly useless. There’s a bit of confusion in readmes and so on which makes it seem like Bumblebee doesn’t do this automatically, but it does. acpi_call is now included as part of Bumblebee, so there’s no manual setup required.

Firstly, log into your Ubuntu install. If you’re not getting Unity because of “unsupported hardware” one trick is to simply remove the nVidia proprietry driver and reboot; this will fix the problem. There are updated drivers but last I heard Ubuntu’s defaults are better at the moment. Once logged in you’ll need to open up a bash terminal. If you’re new to Linux and don’t know how to do this, click the Ubuntu icon at the top (or the Applications menu) and search for Terminal. This will open up the terminal window.

Type in “sudo apt-get install git” unless you have git already (and if it’s a clean install, you probably don’t). You’ll be asked for your password. This installs a new app that we’ll use in the next step.

Type: “git clone https://github.com/MrMEEE/bumblebee.git

This will create a new folder called bumblebee and copy a bunch of files into it from that website.

Type: “cd bumblebee” to move into that directory.

Finally: type “sudo ./install.sh

This runs the installer for Bumblebee. Most of it is automated except the end which asks for a few options, but it should be simple enough for you to follow on your own. Reboot the system (sudo reboot). After rebooting, unless something went wrong, the nVidia GPU will be disabled and the Intel one will be enabled. Battery life should jump by maybe an hour or so initially.

To verify that the card is off, type: “lspci -vnnn | grep VGA“. This will list the GPUs. The first one will be the Intel one and will have [VGA Controller] at the end. The second one will be the nVidia GPU, which will lack the [VGA Controller] identifier. If both of them have this, then something has gone wrong, and the nVidia GPU is still active.

Now that it’s installed, the most important part to remember is that the nVidia GPU will only activate if you launch an application using “optirun [program]”. Optirun is a simple script used to enable the nVidia GPU while the app is running, and then disables it afterwards. To test this, we can use glxgears. Default Ubuntu installations don’t have glxgears but it’ll tell you how to fetch the package (it’s tiny) if you try to run it and it isn’t installed.

Firstly run glxgears normally by simply typing it into the terminal. You should get an FPS around 50 to 60. After that, type in “optirun glxgears” which will display a terminal message saying that Bumblebee is starting and that the nVidia GPU is enabled, before glxgears starts. The FPS this time will be much higher; several hundred FPS. After closing the app you’ll see that the nVidia card is disabled (NVOP and _PS3 lines in terminal). And that’s it! While glxgears is running on the nVidia GPU the remaining battery life indicator will also drop by a large amount.

Is it an elegant solution? Nope. It’s nowhere near as good as it is on Windows, but it does work, and unless nVidia decide to support Optimus under Linux, it’s not going to change. The key thing to remember is that any apps that need the GPU will need to be launched using optirun.

Bumblebee can also be downloaded as an archive file if you’d rather use that instead of git, but this method is probably slightly easier because it’s just a few simple commands.


One thought on “nVidia OPTIMUS M11X R2 on Ubuntu 11.04

Comments are closed.