Tuesday, December 11, 2012

Nvidia Optimus under Ubuntu 12.04 using Nvidia Experimental 310 Drivers

Nvidia Optimus under Ubuntu 12.04 using Nvidia Experimental 310 Drivers

Build System - Alienware M11xR2

Please be sure to double check my spelling. Yet again this was a rushed set of instructions copied from my notes.  Let me know if you have any problems.

This install method is not standard.  It is merely taking a minimal install to a point that the Native Steam Client will run.

Big picture mode reports "X Error of failed request: GLXUnsupportedPrivateRequest"
Looking into that.

Backwards cursor once Steam starts.  This is a default cursor issue handle that later. 

UPDATE:  TF2 is reporting that OpenGL is at version 1.4.0.  Common issue but the work arounds seem to fail from this install.  I'm going to reload the system and dual boot a Standard Desktop and a Minimal Install.  See if I can track down the missing component.  ldd isn't very helpful for tracking it down.  :-(

After being accepted into the Steam Linux Client Testing I figured it would be a good time to see how much I could push the BumbleBee project.  After much reading on LaunchPad about various bugs and errors, I set out to find a workable solution for running the Nvidia Experimental 310 inside BumbleBee.  This is the solution that worked for me from a mini.iso (netboot) Ubuntu 12.04 install.  I planed to do this from a debootstrap but I had no time to do so.  An install from mini.iso with no packages other than the base is basically/kinda what you get from debootstrap.


Ubuntu 12.04 64bit netboot: 
Ubuntu 12.04 32bit netboot (with PAE):
Ubuntu 12.04 32bit netboot (without PAE):

(PAE stands for Physical Address Extension.  This allows software addressing of memory increasing the the CAP from 3.2 GiB  upto 64 GiB if your mother board supports the physical capacity.  Generally your BIOS will reserve 800 MiB for Hardware Addressing leaving you short of the 4 GiB max that most 32bit boards support.  The majority of my 32bit boards only allow 3.2 GiB usable, my Dell Dual Xenon board is the only exception.)

USB Boot

I used the 64bit install CD.  I have no CD-ROM drive so I copied this to a USB Drive in a Linux Install.  I recommend using UNetbootin for this as it runs under Windows, Linux, Mac, and Other Unix Platforms.
Debian/Ubuntu: aptitude install unetbootin syslinux extlinux mbr
Fedora Based: yum install unetbootin syslinux syslinux-extlinux


I selected an Expert Install, but you should be able to install from a NON-expert command line install with no issues.  The options I chose are as follows, if you want to copy my answers.
  • Kernel: Linux Generic
  • Drivers: Generic (All) 
  • No Root Login
  • Encrypted LVM Storage Volumes
    • This causes a blank screen at time on boot due to some package I installed, or /etc/default/ that I changed.  I have not tracked it down yet.  If you type in your password for the storage crypto and press enter it will boot normally.
  • (Targeted should work fine, but I wanted to keep this close to standard for this test)
  • Non-free Repository: Yes
  • (For the Broadcom WiFi)
  • Universe Repository: Yes
  • Multiverse Repository: No
  • (Default install includes this, but I hardly ever use packages from it)
  • Backport Repository: Yes
  • Security Updates: Yes
  • Partner Archive: No
  • Extras Archive: No
  • Install Security Updates: Automatically
  • Selected No Additional Packages


After the install completes the system will reboot.  Now we can make some system configuration changes to keep our system minimal.
vim.tiny /etc/default/console-setup
  • ACTIVE_CONSOLES="/dev/tty[1-3]"
    • Just and old-school habit of mine
  • Personal Preference (I like Large Text)
    • FONTFACE="Terminus"
    • FONTSIZE="32x16"
vim.tiny /etc/default/grub
    • I like to see the Grub Menu.
  • I like to see the kernel boot, so we remove the automatic options for silent boot.
vim.tiny /etc/apt/apt.conf.d/00aptitude
  • Control the Packages Installed and Removed.
    • Aptitude::Install-Recommends "false";
  • Aptitude::Install-Suggests "false";
    • Aptitude::Keep-Recommends "false";
    • Aptitude::Keep-Suggests "false";
    • APT::Install-Recommends "false";
    • APT::Install-Suggests "false";
    • APT::Keep-Recommends "false";
    • APT::Keep-Suggests "false";
  • I do this to fine tune the package needed for an install.  Old-school security build habit.
vim.tiny /boot/grub/grub.cfg
  • In line: "linux   /vmlinuz-#.#.#-#-generic root=/dev/... ro splash quiet $vt_handoff"
  • Remove "splash quite" to see the kernel boot.

IPv6 - Optional

I have been involved with converting systems to IPv6.  In that process I have seen many holes and gotchas.  For my home network I prefer to just turn IPv6 off.  Google has spent 5 years trying to perfect IPv6 with Vendors and is still doing so.  You can read that in a Google publication, but I have misplaced the link.

vim.tiny /etc/default/ufw
  • IPV6=no
Typically I uninstall ufw and just use regular iptables.

vim.tiny /etc/sysctl.conf
  • Add to Bottom
    • # Turn off IPv6
    • net.ipv6.conf.all.disable_ipv6 = 1
    • net.ipv6.conf.default.disable_ipv6 = 1
    • net.ipv6.conf.lo.disable_ipv6 = 1
To apply new Settings run this command as root:  
sysctl -p

Begin Install

My preference is Aptitude but Apt can be used as well.  To get a base X System for BumbleBee testing I installed the following:
  • xserver-xorg xfce4-terminal xfonts-100dpi xfonts-scalable libgl1-mesa-dri xfont-base xauth xinit
    • You can choose your favorite terminal
  • openbox menu ttf-dejavu obconf openbox-themes hicolor-icon-theme
    • I prefer OpenBox as a window manager.
  • fonts-liberation fonts-droid ttf-freefonts ttf-ubuntu-font-family fonts-opensymbol xfonts-mathml ttf-lyx font-stix
    • Some additional fonts that help visibility.
Once install completed I tested this from my USER account (not root) by running:
If you get the OpenBox desktop (right click for Menu Options), you can exit and install some additional packages as root.
  • firefox 
  • jockey-common jockey-kde qt4-qtconfig pulseaudio alsa-utils gstreamer0.10-pulseaudio enchant
    • I use Jockey to manage my Broadcom Drivers.  It has a command line interface, but many prefer a gui.  So I added jockey-kde for the gui.  And now I like the gui, LOL
    • I prefer Qt over GTK, feel free to use jockey-gtk if that is your preference.
  • python-software-properties
    • This installs the command: add-apt-repository
  • mesa-utils
    • For glxgears testing
Run the commands:
  • aptitude update
  • aptitude upgrade
    • (If any are available install them, it is unlikely there are any if this is a fresh install)
  • shutdown -r now
  • Once reboot completes continue below.

BumbleBee Install

As root run the following commands and installs.
  • add-apt-repository ppa:ubuntu-x-swat/x-update
  • aptitude update
  • aptitude upgrade
  • add-apt-repository ppa:bumblebee/stable
  • aptitude update
  • aptitude install bumblebee bumblebee-nvidia nvidia-settings virtualgl-libs virtualgl

Run the command
shutdown -r now
Once reboot completes we can test Sable BumbleBee as a USER.
  • startx
  • Right Click Desktop, Select Terminal emulator
  • glxgears
    • This runs on the Intel Graphics Card.  
    • Once you see the statistics you can close the Gears window.
  • optirun glxgears
    • This runs on the Nvidia Card (For the M11xR2 this is the GT335).
    • Once you see the statistics you can close the Gears window.
You should see an increase in framerate if BumbleBee is functioning properly.

Nvidia Experimental Driver 310

Doing the following, I was able to get the Nvidia Experimental Driver 310 functioning in Ubuntu 12.04 on the 11th of December 2012.
I started from a reboot, and as root I performed the following commands.
  • aptitude install linux-source linux-headers-generic nvidia-experimental-310 nvidia-settings-experimental-310
  • vim.tiny /etc/bumblebee/bumblebee.conf
    • Driver=nvidia
    • KernelDriver=nvidia-experimental-310
    • LibraryPath=
      • Change "-current" to "-experimental-310"
    • XorgModulePath=
      • Change "-current" to "-experimental-310"
  • Just because I wanted to see it build with no errors I ran to following.
    • dpkg-reconfigure nvidia-experimental-310
As root restart the system.  After the system reboots and you login as the USER account test the following.
  • startx
  • Right Click Desktop, Select Terminal emulator
  • glxgears
    • Once you see the statistics you can close the Gears window.
  • optirun glxgears
    • Once you see the statistics you can close the Gears window.
If there are no errors you are now running Nvidia Experimental 310 under BumbleBee.
Have Fun and good luck.


Download the Steam.deb package from the link in your official e-mail.
As root:
  • dkpg --force-depends --install steam.deb
  • aptitude update
  • aptitude
  • IGNORE the Error Message in Red.
  • /steam
    • / brings up the search dialog.
  • Highlight steam:i386, Press Enter
    • If your Ubuntu install was 32bit you will not need the ":i386" in the following commands.
  • With steam:i386 highlighted press Shift and =
    • The + key says add package and all dependencies.
  • Press g, Press g
  • After install press q and Exit Aptitude.
  • aptitude gnutils-bin tcpd libsound2-plugins:i386 librsvg2-common:i386 libtxc-dxtn-s2tc0:i386 libsasl2-modules:i386 libgpm2:i386 gpm librsvg2bin librsvg2bin:i386 rng-tools
    • Not sure which are absolute needs.  But this should help with headsets, encryption and image display.  
  • shutdown -r now
As the account that will be running Steam do the following in a Terminal.
  • export LD_LIBRARY_PATH=/usr/lib32:/usr/lib/i386-linux-gnu/mesa:$LD_LIBRARY_PATH/usr/bin/steam:
  • optirun steam
After uppdates apply you should beable to run Steam via optirun.  I get Intel driver errors when trying to run with Intel Graphics.

I am downloading TF2, we will see how it plays.


Thank you: 
  • BumbleBee Wiki
  • Superunamused @ askubuntu - for highlighting the dependancy issues.
  • webupd8.org for the BumbleBee config explination.


  1. I can't get past login, steam will always crash with segmentation fault if using optirun.
    Also a clean install is not an option, at least not for now...

    1. You have BumbleBee, VitualGL, and an Nvidia Driver installed correct?

      You can try this from a terminal and see if Optirun handels it:
      optirun --debug --display ":8" glxgears

      You have to open Steam once outside of optirun to get it installed properly. After that you can try:
      optirun --debug --display ":8" steam

      I sometimes run a terminal in optirun so the commands from it are inside optirun
      optirun --display ":8" terminal
      (My terminal would be xfce4-terminal)

      If you get more information than a seg fault let me know. Also join this Steam group:
      You can get help from many resources. :-D

      My current problem is:
      I can't get TF2 to run due to OpenGL versions reported by VirtualGL. So trying to figure out where that went wrong.