Table of Contents

Nvidia Optimus

Some newer laptops nowadays come with what is known as “nVidia Optimus” technology. This is an nVidia and Intel hybrid graphical processing unit (GPU); it is NOT two separate GPUs in one laptop. It uses nVidia graphics for performance and Intel graphics for power saving during basic usage. Unfortunately the closed source proprietary drivers do not offer a means for adjusting or switching between the two, unlike those from Advanced Micro Devices Inc. (AMD).

Despite this disappointment, there is an open source project called Bumblebee that aims to fix this problem. However, Bumblebee isn't alone. nVidia developers do assist the Bumblebee project by fixing bugs in the closed source proprietary drivers that Bumblebee developers cannot touch.

To avoid confusion, from here on we will be using nVidia to refer to the company and nvidia to refer to the closed source proprietary driver. New sentences that start with nVidia also refer to the company and Nvidia to the driver.

You should also note the terminal commands used on this page. The code lines that begin with $ refers to commands to be run by a regular user, and # refers to commands to be run as root or a user with sufficient privileges.

Also please note the differences between Bumblebee and bumblebee. bumblebee is the daemon for bumblebee.

X11 and Other Programs without Bumblebee

You do NOT need to use Bumblebee in order to use X11, KDE, Compiz-Fusion, Blender, Adobe Flash Player and even some games such as Guild Wars or Warcraft III. The Intel graphics provides enough 3-D acceleration (and sometimes has better performance) for those programs to work smoothly without having to use the nVidia GPU. In addition to the programs working efficiently and smoothly, you're saving power.

If you still wish to use Bumblebee to switch between the nVidia GPU and the Intel GPU, read on. We just wanted to clarify that Intel's 3-D acceleration has progressed quite far and that not all programs need to use the nVidia GPU in order to work.

Installing Bumblebee

The Automated Way

There is a new, automated way of installing Bumblebee thanks to Slacker: Ryan McQuen.

USE AT YOUR OWN RISK!
If you have modified the SlackBuilds in any way, this script may not be for you.

Alternatively you can download the script and run it as root on your system directly.

This script detects multilib, creates the necessary group, adds users and applies the necessary /etc/rc.d/rc.local entries and also comes with a stable option which can be used by passing this instead:

It also uses upgradepkg's --reinstall --install-new features for use after kernel upgrades.

The Manual Way

Getting the SlackBuilds

A fellow Slacker, jgeboski, originally provided SlackBuilds that mostly follow the SlackBuilds.org requirements for Bumblebee. Now, another Slacker has taken over where he has left off on his own github repo. Remember to check which directory you're in first, as they will be downloaded to that directory. Assuming you're ready, the SlackBuilds can simply be git cloned as such. Then we're going to change into the new directory and begin the build process.

There is a README file, but you probably won't be reading it as you're reading this instead, so we're basically going to post it here.

Getting the Source Files

The source files, as with all SlackBuilds, must be downloaded manually and placed into their respective directories. Amongst the repos are a SLACKBUILDS.TXT file that does give links for the source files as well as their MD5SUMs to make sure the files were not corrupt. You can use the provided script to download them and check them against their MD5SUM for corruption, like this:

./download.sh

Preparing the Environment

There are a few things you need to do before we begin. First off, we need to have a specific group of users who are going to be allowed access to Bumblebee technology. For the sake of simplicity, we'll call this group “bumblebee”. In addition to the new group, we need to add the users that are allowed to access bumblebee technology:

# groupadd bumblebee
# usermod -G bumblebee -a <USERNAME>

where <USERNAME> is the name of the user or users you would like to add.

Building and Installing Bumblebee's Core

1. Build and install: bbswitch (optional but highly recommended).

# cd bbswitch # You don't actually need to ''cd'' as root, but who wants to ''su'' all the time?
# ./bbswitch.SlackBuild
# upgradepkg --install-new bbswitch-*.t?z

Building and Installing Other Dependencies

Some SlackBuilds also offer a COMPAT32 option if you're running a multilib system. In the following examples, we build it with and without 32-bit compatibility. Use the one you desire.
Keep these in mind when building the specified package.

Bumblebee can use either primusrun (requires a mesa rebuild in Slackware 14.0 and below) or bumblebee's own optirun. Take your pick which one you would like to use (or you can install both). Each one has their own advantages and disadvantages.

Primus

Primus, like optirun (instructions below) can be used to run your desired program via bumblebee. Primus also comes with a COMPAT32 option as well.

If you are using Slackware 14.0 or older you need to rebuild mesa. The new github repository does not offer a SlackBuild for mesa to support Slackware 14.0 or older. Therefore you must use Slackware 14.1 or newer, or rebuild mesa manually with a different script. One can choose to use the old repository and simply update the SlackBuild script appropriately, or add --enable-shared-glapi into a mesa.SlackBuild from the source of a newer Slackware version.

# # For the old repository, one would have done:
# cd ../mesa
# ./mesa.SlackBuild

mesa does not have a COMPAT32 option because it is an official Slackware package, but you can easily create the compat32 package after creating the original package by using:

VirtualGL

VirtualGL provides support for optirun that also allows one to run programs via bumblebee. However, it is recommended that one uses primusrun for a few reasons.

Although VirtualGL (and its dependency libjpeg-turbo) are still supported by the Bumblebee project and maintained by their developers, the new github repo does not include SlackBuild scripts for these packages. This section is for the old github repository that was once maintained by jgeboski. If you would like to use VirtualGL (e.g. you're in one of the rare cases where VirtualGL provides better performance than primus) then you can use your own personal SlackBuilds or the old ones (although the old SlackBuilds will be out-of-date).

The nvidia Proprietary Driver

If you want to use the nVidia proprietary drivers, you must not use nouveau, as the drivers interfere with each other. This can be prevented by removing nouveau, installing xf86-video-nouveau-blacklist from /extra, or blacklisting nouveau manually.

This part is entirely optional. Slackware 13.37 and above comes with xf86-video-nouveau, the open source nVidia graphics card drivers. If you are using this, you do not need the closed source proprietary nVidia drivers. However, if you wish to use the closed source drivers, then install the packages listed in this section before going on.

Some nvidia driver versions are incompatible with certain kernel versions and vice versa (some kernel versions are incompatible with some nvidia driver versions) for various reasons. A specific kernel configuration, a specific nvidia driver against a specific kernel version amongst other possibilities. Generally it is best to use the nvidia driver package provided along with the kernel packages provided by your Slackware version. You can also follow the SlackBuilds.org guideline for manually updating a version of some software yourself.

If you are using Slackware 14.1 or older, you will need to install libvdpau. Newer Slackware versions now ship libvdpau.

Post-Installation

Excellent. Now we're ready to do some post-installation setup. The bumblebee package provided us with an rc.bumblebee script in /etc/rc.d where the other startup scripts are also located. Remember to make this script executable and, if you so desire, start it!

# chmod +x /etc/rc.d/rc.bumblebeed
# /etc/rc.d/rc.bumblebeed start

If you would like bumblebee to autostart with the system, you can add the following to /etc/rc.d/rc.local:

[ -x /etc/rc.d/rc.bumblebeed ] && /etc/rc.d/rc.bumblebeed start

You can even go a step further by having bumblebee stop with your system by adding the following lines to /etc/rc.d/rc.local_shutdown. You can create this file if it does not exist.

[ -x /etc/rc.d/rc.bumblebeed ] && /etc/rc.d/rc.bumblebeed stop

Done! Any program we want using the nVidia graphics card can be run with “optirun” or “primusrun” like this:

$ optirun glxspheres
$ primusrun glxspheres

Pretty easy, right? Well not for all I suppose. If you chose to use VirtualGL (optirun), some programs will not work directly like this. Some require optirun to run bash first like this:

$ optirun bash

Now we can execute the program directly without adding “optirun” at the beginning:

$ wine ~/.wine/drive_c/Program_Files/Starcraft\ 2/Starcraft\ 2.exe

Editing the Configuration Files

A few general /etc/bumblee/bumblebee.conf configuration edits (likely suited for all):

# If you added your user account to a different user group than "bumblebee" at the start, make sure to change the "ServerGroup=" line accordingly.
# Here we set it to "ImAllergicToBees":
ServerGroup=ImAllergicToBees
# Perhaps you don't like using Display :8 for X11. We can change that too, in this example we set it to 3:
VirtualDisplay=:3
# I want to specify my driver that bumblebee will use by default. Here we show nouveau, but you can easily replace it with "nvidia".
# For the rest of this small section, we'll be using nouveau for simplification.
Driver=nouveau
# Don't forget to add their respective lines as well.
KernelDriver=nouveau
Module=nouveau

FAQ That Google Might not Answer

1. Q: I upgraded or downgraded my kernel and now I get “Fatal: module bbswitch not found” and bumblebee doesn't work! What do I do?

A: bbswitch and nvidia-kernel are kernel modules that place themselves in /lib/modules/<SOME KERNEL VERSION> so if you upgraded your kernel, just rebuild your nvidia-kernel and bbswitch packages so that the new package will place itself into the newer /lib/modules/<KERNEL VERSION>.

2. Q: If I upgrade nvidia-kernel, will I have to upgrade nvidia-bumblebee (or vice versa) too?

A: No. Although they both use the same source files, they install very different things. The nvidia-kernel is just the kernel-module, and nvidia-bumblebee is the rest of the application.

3. Q: (Extension to #2) What if it's a new version of the nvidia proprietary driver?

A: Then in that case, then you should probably upgrade both nvidia-bumblebee and nvidia-kernel.

4. Q: What is this multilib/compat32 stuff and do I need it?

A: This isn't bumblebee-specific and depends on what you want. Read the multilib page for more details and if you will need/want it or not.

Specific Laptop Models and nVidia GPU's

Bumblebee has mixed results depending on the nVidia graphics card and driver. Some are better than others. I hope that in this section, if you have a configuration suggestion, post it in the discussion section to help those with the same graphics cards on their nVidia optimus setups (and the configuration will later be added to the article). Some of these settings may work for all laptops, some may not. We're taking precautions just in case. Because we don't know what little differences there might be between video cards, don't forget to mention your laptop model and the driver xorg.conf you're using.

This one change is suitable for those running a multilib system.

/etc/bumblebee/bumblebee.conf

# This is on a multilib system, so that is why /usr/lib64 AND /usr/lib are being used in LibraryPath:
LibraryPath=/usr/lib64/nvidia-bumblebee:/usr/lib/nvidia-bumblebee:/usr/lib64:/usr/lib
XorgModulePath=/usr/lib64/nvidia-bumblebee/xorg,/usr/lib64/xorg/modules