Nvidia Optimus with Bumblebee on Ubuntu 14.04

This post is a guide to enable Bumblebee with an external monitor on Ubuntu 14.04 for a ThinkPad-W520. This may work for W-500’s, T-400’s, and other Optimus-enabled machines with outputs wired to the NVIDIA chip

I am tailoring this article for the novice Linux user who may be struggling to enable the external monitor or interested in achieving the power savings that a switchable graphics technology provides in Ubuntu 14.04. More advanced users may opt to configure their setup directly using Bumblebee’s wiki page (I encourage all users to read this page for background on the project).

In short, if you have the following setup:

  • ThinkPad-W520
  • External monitor
  • Ubuntu 14.04

Then this guide is here to help!

First, install the appropriate Bumblebee and Nvidia dependencies Link to heading

(big thanks to Pavak Paul):

sudo apt-get install bumblebee bumblebee-nvidia primus nvidia-331

14.04 offers a great GUI that I recommend as well:

sudo apt-get install python-appindicator

In your ~ directory, do the following:

mkdir git && cd git

Check out and install the repository:

git clone https://github.com/Bumblebee-Project/bumblebee-ui.git
cd bumblebee-ui
sudo ./INSTALL

Go to Startup Applications and add bumblebee-indicator

If you haven’t already, you may need to install the following:

sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update

Now reboot. After reboot, if the indicator is in your startup settings, you should have the following Bumblebee menu (circled in red, second from the left): bumblebee_menu_highlighted

Next, configure Bumblebee Link to heading

(HUGE thanks to Scyth, from which this excerpt is derived):

You’ll need to edit /etc/bumblebee/bumblebee.conf and find and change these params, so they look like:

KeepUnusedXServer=true
Driver=nvidia
KernelDriver=nvidia-331
PMMethod=none (find this one in two locations in the file)

Next, edit /etc/bumblebee/xorg.conf.nvidia and make it look like this:

Section "ServerLayout"
Identifier "Layout0"
EndSection

Section "Device"
Identifier "DiscreteNvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:01:00:0"
Option "ProbeAllGpus" "false"
Option "NoLogo" "true"
EndSection

Next, configure your X11 server Link to heading

(thanks to Bumblebee’s wiki page):

Add the following to /etc/X11/xorg.conf. Note that this may not be necessary for many, but it cannot hurt. For more understanding, read up on the wiki page referenced above.

Section "ServerLayout"
Identifier "Layout0"
EndSection
Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "NoLogo" "true"
Option "ConnectedMonitor" "DFP"
EndSection
#For the configuration with bumblebee installed
#Section that follows come from archlinux adapt it from your distro if necessary.
Section "Files"
ModulePath "/usr/lib/nvidia/xorg/"
ModulePath "/usr/lib/xorg/modules/"
EndSection

Setup the intel-virtual-output driver tool: Link to heading

Download the source here: https://01.org/linuxgraphics/downloads and choose the latest xf86-video-intel. At the time of this post, version was 2.99.910

Extract it:

tar -xvf xf86-video-intel-2.99.910.tar.gz

Then build it (more info here):

cd xf86-video-intel-2.99.910/
./configure
make
sudo make install

This should provide you with the command intel-virtual-output. Double check that this command is available to you in your prompt (via tab-completion):

intel-virtual-output

The moment of truth Link to heading

(again, lots of help from Scythe on this):

modprobe bbswitch
optirun true
intel-virtual-output
# kill the second X server.
# To find the process, run: ps ax | grep Xorg
# You should see something like this
$ ps ax | grep Xorg
3342 ? Ss 68:08 Xorg :8 -config /etc/bumblebee/xorg.conf.nvidia \
-configdir /etc/bumblebee/xorg.conf.d -sharevts -nolisten tcp -noreset \
-verbose 3 -isolateDevice PCI:01:00:0 -modulepath \
/usr/lib/nvidia-331/xorg,/usr/lib/xorg/modules
# now kill the process
$ sudo kill -15 3342
# Now you need to turn off nvidia card completely.
sudo rmmod nvidia
sudo tee /proc/acpi/bbswitch <<<OFF

Automate multi-screen switching on-the-go: Link to heading

To automate this process, I created the following simple scripts in my ~/bin/:

You can add the following aliases as shown here: https://gist.github.com/modulitos/b9e8560b1374592a5286

Here are some inspiring scripts by Krzysztof Suszyski which also automate the graphics switching as well as the installation. I would NOT recommend installing it verbatim since it is tailored for Ubuntu 13.10 and the configuration may different depending on the machine.

Any questions, I will do my best to help out. Thank you!

Here are some helpful sources: Link to heading

This post is designed as a guided walk-through, and I encourage the reader to understand each step along the way. Feel free to contact me directly with any issues or suggestions.