Bumblebee, Optimus, Hybrid Graphics, and Ubuntu

For the last year or so I have been struggling with my laptop overheating under Ubuntu. Upon upgrading to the latest beta of Ubuntu 12.10 I have managed to completely solve the heating problem and as a result increased my battery life by more than an hour.

Two different problems have caused the heating problem. The first, a power-regression bug on i7 processors was resolved in Ubuntu 12.04 with an updated kernel.

The second is caused by the Nvidia Optimus Hybrid Graphics card in my laptop not being properly controlled by Ubuntu. Problems with Hybrid Graphics under linux are well documented and there are quite a few different “solutions” available, however, I have been unable to get any to work until now.

A few months back I installed the Bumblebee project, and despite the packages successfully installing, the hybrid graphics card never worked and battery life remained terrible.

Upon upgrading to the latest Ubuntu beta I noticed a problem in the logs during the install of one of the bumblebee packages: bbswitch-dkms

The package would “successfully” install, however, the terminal output would show that the kernel module was never built.

The problem lies in missing kernel header packages. While the Ubuntu Wiki pages do not detail any requirement for the installation of kernel headers other sites do, however, these other sites only focus on the kernel headers for the currently installed kernel. And, if you update the kernel without new headers, it is possible that the kernel module will no longer work and the overheating problem will return.

This is how I setup my system so that I would always have the latest official Ubuntu kernel and headers with bumblebee working:

1. Install the linux-headers-generic package:
sudo apt-get install linux-headers-generic

2. Setup the Bumblebee PPA:
sudo add-apt-repository ppa:bumblebee/stable

3. Update the package information:
sudo apt-get update

4. Install the bbswitch-dkms package:
sudo apt-get install bbswitch-dkms

Before moving on make sure that the output from the above command shows that the module was successfully installed.

5. Install the rest of Bumblebee:
sudo apt-get install bumblebee bumblebee-nvidia

6. Restart and then test if Bumblebee is working:
a) glxgears
b) optirun glxgears

The second command runs the opengl test using the Optimus graphics card and the output in terminal of the FPS should be much greater than the previous command. Bumblebee should now be successfully installed and you should notice a large decrease in CPU heat and an increase in battery life.

In my opinion during the install of the bbswitch-dkms package a check should be made for the required kernel headers to build the kernel module, if the packages aren’t found a proper error and suggested solution, such as the installation of the headers package should be suggested. A silent fail that keeps the rest of the installation running only provides the end user that false hope that things are working fine.

Getting ATI Radeon HD Drivers to work in Ubuntu 10.04 Beta 1

These instructions will hopefully help those who are testing the Beta over the next few days to get full hardware acceleration from their graphics cards.

These instructions are based off Ubuntu’s guide here: https://help.ubuntu.com/community/RadeonHD and I can only comment on my set up, I cannot guarantee that they will work for anyone else.

Firstly make sure that you graphics card is not already working properly, in a terminal type:

glxinfo | grep “renderer string”

If you see “software rasterizing” as the output then the drivers are NOT working right, if you see something else then they most likely are.

First prepare your system for installing the new drivers, do this by removing the old drivers and making sure you have the right libraries installed:

sudo sh /usr/share/ati/fglrx-uninstall.sh

If the file cannot be found then it is good, just means the driver was never installed in the first place.

sudo apt-get purge xorg-driver-fglrx fglrx-amdcccle fglrx-kernel-source xorg-driver-fglrx-dev

Package not found errors here are also really good.

sudo apt-get --reinstall install libgl1-mesa-glx xserver-xorg-core

Make sure that the reinstall of these two packages completes properly. (Note: the reinstall flag has two – before it not one, some web browsers render the double dash as a single long dash).

Next you need to install a new Kernel, Ubuntu 10.04 will ship with 2.6.32 but at a minimum (at the moment) you need 2.6.33, this is simple to do though:

cd ~/

mkdir kerneldebs

cd kerneldebs/

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-headers-2.6.33-020633-generic_2.6.33-020633_amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-headers-2.6.33-020633_2.6.33-020633_all.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-image-2.6.33-020633-generic_2.6.33-020633_amd64.deb

sudo dpkg -i linux*

Now reboot and make sure that you boot into the new kernel and not the old one.

Add the following address to your systems software sources:


Reload the sources list when prompted, then go to update manager, check for new updates, install all the new updates that are listed. Once installed reboot your system.

Now try “glxinfo | grep “renderer string” again and hopefully it will no longer display software raster and instead something a lot more promising.

JOGL Rocks!

For the past few weeks I have been thinking seriously about heading back to uni to complete my honours degree.

Currently some of the team in Computer Science at Massey have been playing with JOGL.

I had a look at it the other day but didn’t get very far. Well tonight I decided to really get my hands dirty.

And it rocks! Im currently seeing if I can convert my traffic simulator to JOGL.

Will keep this blog posted on updates.