The OS has been upgraded to Slackware 14.1 on Fri Aug 21 2015.
Table of Contents
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.
nvidiato refer to the closed source proprietary driver. New sentences that start with nVidia also refer to the company and
Nvidiato 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.
The Automated Way
There is a new, automated way of installing Bumblebee thanks to Slacker: Ryan McQuen.
You can run this as root:
curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | sh
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:
curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | STABLE=yes sh
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.
$ git clone https://github.com/whitewolf1776/Bumblebee-SlackBuilds.git $ cd Bumblebee-SlackBuilds
Or you can download the full tarball containing the SlackBuilds instead:
$ wget --content-disposition https://github.com/whitewolf1776/Bumblebee-SlackBuilds/tarball/master $ tar -xf whitewolf1776-Bumblebee-SlackBuilds-<changing hexadecimal> # Tab completion is helpful. $ cd whitewolf1776-Bumblebee-SlackBuilds
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:
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
2. Build and install: libbsd (required).
# cd ../libbsd # ./libbsd.SlackBuild # upgradepkg --install-new libbsd-*.t?z
3. Build and install: bumblebee (obviously required).
# cd ../bumblebee # ./bumblebee.SlackBuild # upgradepkg --install-new bumblebee-*.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.
Primus, like optirun (instructions below) can be used to run your desired program via bumblebee. Primus also comes with a COMPAT32 option as well.
--enable-shared-glapiinto 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:
# ./mesa-compat32.SlackBuild # Only in the old repository
1. Build and install: primus
# cd ../primus # ./primus.SlackBuild # upgradepkg --install-new primus-*.t?z
# COMPAT32=yes ./primus.SlackBuild
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.
# cd ../libjpeg-turbo # ./libjpeg-turbo.SlackBuild # This does not build with 32-bit compatibility. # upgradepkg --install-new libjpeg-turbo-*.t?z
If you do wish to build with 32-bit compatibility, add
COMPAT32=yes before executing the script as so:
# COMPAT32=yes ./libjpeg-turbo.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.
2. Build and install: VirtualGL (32-bit compatibility available)
# cd ../VirtualGL # ./VirtualGL.SlackBuild # upgradepkg --install-new VirtualGL-*.t?z
I think you're starting to get the idea now…
# COMPAT32=yes ./VirtualGL.SlackBuild
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.
# cd ../libvdpau # ./libvdpau.Slackbuild # upgradepkg --install-new libvdpau-*.t?z
1. Build and install: nvidia-bumblebee
# cd ../nvidia-bumblebee # ./nvidia-bumblebee.SlackBuild # upgradepkg --install-new nvidia-bumblebee-*.t?z
# COMPAT32=yes ./nvidia-bumblebee.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.
2. Build and install: nvidia-kernel
# cd ../nvidia-kernel # ./nvidia-kernel.SlackBuild # upgradepkg --install-new nvidia-kernel-*.t?z
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.
# 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
- Bumblebee Project: http://bumblebee-project.org/
- Bumblebee Project Wiki: https://github.com/Bumblebee-Project/Bumblebee/wiki
- For making this page possible: jgeboski
- Original SlackBuilds: https://github.com/jgeboski/Bumblebee-SlackBuilds
- New SlackBuilds: https://github.com/whitewolf1776/Bumblebee-SlackBuilds
- Originally written by TommyC