Some newer laptops nowadays, specifically for nVidia graphic cards, come with what is known as “nVidia Optimus” technology. This technology is an hybrid of nVidia and Intel graphic processing unit (GPU). In primary, there are no two separate GPUs in one machine. This technology is like a switching system between those two. Optimus 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).
An open source project called Bumblebee has emerged and 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.
In this article we will discuss about Bumblebee and installation on Linux, especially Slackware. For this article I use following:
- Slackware64 14.0 with multilib (although any slackware is OK).
- Bumblebee packages.
Bumblebee and Relation to X11 Program
Using Bumblebee is not relating to any use of X11, KDE, Compiz-Gusion, Blender, Adobe Flash Player, etc. 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.
Bumblebee is used to switch between the nVidia GPU and the Intel GPU.
Getting the SlackBuilds
Mostly slackbuilds packages provided hasrequirements for Bumblebee on github. Check which directory we are in first, as they will be downloaded to that directory. If you are ready, then do these:
git clone https://github.com/jgeboski/Bumblebee-SlackBuilds.git cd Bumblebee-SlackBuilds
Another option is download the full tarball containing the SlackBuilds instead:
wget --content-disposition https://github.com/jgeboski/Bumblebee-SlackBuilds/tarball/master tar xf jgeboski-Bumblebee-SlackBuilds-<changing hexadecimal> # Tab completion is helpful. cd jgeboski-Bumblebee-SlackBuilds
Getting the Dependencies
Preparing the Environment
groupadd bumblebee usermod -G bumblebee -a <USERNAME>
Installing the Dependencies
cd libjpeg-turbo # You don't actually need to ''cd'' as root, but who wants to ''su'' all the time? ./libjpeg-turbo.SlackBuild # This does not build with 32-bit compatibility. upgradepkg --install-new libjpeg-turbo-*.tgz
If you do wish to build with 32-bit compatibility, add
COMPAT32=yes before executing the script as so:
Continue the same steps as above for the other programs in the
2. Build and install: VirtualGL (32-bit compatibility available)
cd ../VirtualGL ./VirtualGL.SlackBuild upgradepkg --install-new VirtualGL-*.tgz
I think you’re starting to get the idea now…
COMPAT32=yes ./VirtualGL.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.
1. Build and install: nvidia-bumblebee
cd ../nvidia-bumblebee ./nvidia-bumblebee.SlackBuild upgradepkg --install-new nvidia-bumblebee-*.tgz COMPAT32=yes ./nvidia-bumblebee.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.</pre>
2. Build and install: nvidia-kernel
cd ../nvidia-kernel ./nvidia-kernel.SlackBuild upgradepkg --install-new nvidia-kernel-*.tgz COMPAT32=yes ./nvidia-kernel.SlackBuild # Only for 32-bit compatible binaries and libraries on an x86_64 based system.</pre>
Now that we have those 32-bit compatible and optional packages out of the way, let us build what remains.3. Build and install: bbswitch, libbsd and also bumblebeed in order as you go.
cd../bbswitch ./bbswitch.SlackBuild upgradepkg --install-new bbswitch-*.tgz cd ../libbsd ./libbsd.SlackBuild upgradepkg --install-new libbsd-*.tgz cd ../bumblebeed ./bumblebeed.SlackBuild upgradepkg --install-new bumblebee-*.tgz
chmod +x /etc/rc.d/rc.bumblebeed /etc/rc.d/rc.bumblebeed start
If you used the proprietary nvidia kernel blob, it places itself into
/lib/modules/$( uname -r )/
so if you rebuild the kernel, you will have to reinstall the nvidia-bumblebee package. This also applies to bbswitch which is also kernel-dependent.
If you would like bumblebee to autostart with the system, you can add the following to /etc/rc.d/rc.local:
if [ -x /etc/rc.d/rc.bumblebeed ]; then /etc/rc.d/rc.bumblebeed start fi
You can even go a step further by having bumblebeed 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.
if [ -x /etc/rc.d/rc.bumblebeed ]; then /etc/rc.d/rc.bumblebeed stop fi
Done! Now let’s try it out! Any program we want using the nVidia graphics card can be run with “optirun” like this:
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
# 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
Some report that they can’t run optirun properly. There might be some cause of this. In this section we will discuss about some known case and how to solve it. First run optirun like this:
optirun -vv --debug glxspheres
This command will give us more information.
[ 1143.518414] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf [ 1143.691489] [DEBUG]optirun version 3.0.1 starting... [ 1143.691545] [DEBUG]Active configuration: [ 1143.691579] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf [ 1143.691610] [DEBUG] X display: ebug [ 1143.691628] [DEBUG] LD_LIBRARY_PATH: /usr/lib/nvidia-current:/usr/lib32/nvidia-current [ 1143.691647] [DEBUG] Socket path: /var/run/bumblebee.socket [ 1143.691671] [DEBUG] VGL Compression: proxy [ 1144.104309] [INFO]Response: No - error: <a href="https://github.com/Bumblebee-Project/Bumblebee/issues/EE">XORG</a>NVIDIA(0): Failed to assign any connected display devices to X screen 0 [ 1144.104353] [ERROR]Cannot access secondary GPU - error: <a href="https://github.com/Bumblebee-Project/Bumblebee/issues/EE">XORG</a> NVIDIA(0): Failed to assign any connected display devices to X screen 0 [ 1144.104379] [DEBUG]Socket closed. [ 1144.104404] [ERROR]Aborting because fallback start is disabled. [ 1144.104419] [DEBUG]Killing all remaining processes.</pre> <p style="text-align: justify;">
If you encounter something like that, there are two thing you must look:
- Make sure you have assign driver on /etc/X11/xorg.conf. Replace any occurance of nouveau driver with nvidia
- Check your /var/log/Xorg.8.log and search for CRT or DFP. In many case you will encounter CRT. If so, edit /etc/bumblebee/xorg.conf.nvidia. Found line like this: Option “ConnectedMonitor” “DFP”. Now change “DFP” with “CRT”.