From NCSUTechstaffDocs

Jump to: navigation, search


Many recent notebooks with a discrete nvidia card and a i3/i5/i7 processor use nvidia optimus technology to improve battery life. Unfortunately, this software solution is only available in Windows 7 and later.

The Bumblebee Project, along with bbswitch and primus, is a set of tools developed by people aiming to provide Optimus support under Linux while waiting for the Linux kernel and drivers to support these notebooks officially via PRIME.


Installing bumblebee software on a recent fedora or RHEL 6*

*By RHEL 6, I mean RHEL 6, CentOS 6, Scientific Linux 6, PUIAS, etc. Basically any RHEL 6 clone distro.

The bumblebee / bbswitch / primus packages are all a part of a collection of software that aims to get hybrid graphics laptops to work 100% under Linux. Currently bumblebee, bbswitch and primus only work with an intel / nvidia hybrid setup but hopefully in the future intel/AMD and AMD/AMD users with hybrid graphics laptops (PowerXpress) will have more Linux solutions available via PRIME. Currently primus requires the closed source nvidia module unless you edit the primusrun script yourself. Primus has not been well tested with nouveau, and the author prefers it be tinkered with only by power users willing to take the risk of bugs.

So, The very first thing we need to do is make sure our fedora / rhel 6 system is up to date. This is important if you don't have a "development" workstation. We want the kernel-devel packages to be in sync with whatever kernel you have installed! So run this command as root:

yum -y update

If your kernel is one of the packages that got updated, go ahead and reboot before moving to the next instructions.

So the first thing we need to do is to set up the bumblebee yum repository I created.

On RHEL 6, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/rhel6/noarch/bumblebee-release-1.0-1.noarch.rpm

Please note: If you are using RHEL 6, you also need to add the EPEL repository.

yum -y --nogpgcheck install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

On fedora 18, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora18/noarch/bumblebee-release-1.1-1.noarch.rpm

On fedora 19, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora19/noarch/bumblebee-release-1.1-1.noarch.rpm

On fedora 20, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora20/noarch/bumblebee-release-1.1-1.noarch.rpm

Next, we need to install the packages. This is the same for all red hat type distros:

yum -y install bbswitch bumblebee

You can install bumblebee without bbswitch but I do not recommend it. Without bbswitch "optirun" may not work after a hibernate or suspend operation. And if you are like me you suspend/hibernate your laptop all the time. See this page for more information.

If you "yum install" while you are in an X session you need to log out and log back in after the yum commands finish. RHEL 6 and clone users must reboot at this point while fedora users just need to log out and log back in again so the "session" can have been run by a user in the correct UNIX group. If you are the only user on your laptop, and you chose GNOME as your desktop, there won't be a "logout" in the menu in fedora 18 so just select "Power Off" then click on "Restart" in the po up dialog if you don't see a logout option.

Whichever distro you are using, after a reboot (rhel 6) or a logout followed by a login (fedora) you can test bumblebee by typing into a terminal window:

optirun -b virtualgl glxgears

If everything worked, you should see a window with spinning gears in it. Unfortunately, the nouveau drivers do not work on fedora 18 at this time. It is opened as issue #298. Sorry about that. Any help working on that would be greatly appreciated! So for now, you need to use the nvidia drivers. Or... just give up. Keep reading for more info on how to install the nvidia drivers with bumblebee / primus...


If you installed "bumblebee" in a kickstart or before firstboot, if your $HOME directory is not under "/home", or if you add additional users to your system after you have installed the bumblebee package you will need to add the additional users to the bumblebee group by hand. You can do this by running the following command as root:

 /usr/sbin/usermod -a -G bumblebee USERNAME

Where, USERNAME is the name of the account to add to the bumblebee group. Users MUST be in the bumblebee group for optirun to work for them.

WHAT ABOUT NVIDIA DRIVERS??? The nouveau driver does not meet my needs! It doesn't work on fedora 18, only RHEL 6 and fedora 17...

Nvidia drivers


The nvidia binary driver must be installed in a way that won't break LibGL from mesa on the integrated (Intel) driver. 3D support must work properly on the integrated display if VirtualGL or primus is to work. VirtualGL or primus must work for "optirun" or "primusrun" to work. By default, the nvidia packages at rpmfusion.org, or elrepo.org, do not work correctly for our purposes. Thus, I created my own solution called bumblebee-nvidia. It is not GPLed. But I do have a package / shell script to deal with the closed source NVidia drivers. To keep things less controversial, due to the license, I've placed bumblebee-nvidia in a different repository I will call bumblebee-nonfree. I place the shell script into the public domain...

So the next thing we need to do is to set up the bumblebee-nonfree yum repository...

On RHEL 6, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/rhel6/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm

On fedora 17, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora17/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm

On fedora 18, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora18/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm

On fedora 19, type this command as root:

yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora19/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm

Next, we need to install the single package. This is the same for all red hat type distros:

yum -y install bumblebee-nvidia

"bumblebee-nvidia" is both a rpm package and a shell script. The "bumblebee-nvidia" package contains the shell "wrapper" script, init scripts to run it at bootup, and a SELinux security policy, and lastly a copy of the NVidia Linux binary driver "blob" downloaded from NVidia's UNIX drivers page. This is why the packages are so large comparred to for example the bumblebee rpm.

After installing the package most users will want to reboot. bumblebee-nvidia is designed to do its thing on bootup. Basically, bumblebee-nvidia should not be run if you are logged in on a X session on one of the virtual consoles. This is because bumblebee-nvidia moves some underlying librararies around as it runs and this can cause your X session to crash. It does not appear to crash gdm or plymouth. But it can crash you regular user X session if you are logged in that way.

So for most users, reboot. As the system comes back up, the nvidia driver will be built for the current running kernel. If you are running RHEL 6 then the login screen, gdm won't start until after the nvidia drivers have been built.

If you are running a recent fedora its more complicated. By the time the login screen comes up the NVidia drivers are likely still compiling due to the systemd init system. I suggest you wait a moment before logging in. If you forget your X session may crash which is usually harmless. If this happens just log in again. After the hard drive activity light calms down optirun should work normally.

If for some reason you do not wish to reboot, press CTRL-ALT-F(2-6) to get to a virtual console and log in as root. You can do this compiling drivers process manually by typing:


The shell script bumblebee-nvidia will only build the NVidia driver on kernels it has not been built on before without the --force switch. Also bumblebee-nvidia must be run on kernels it is intended for. So if later on, you have downloaded and installed a new kernel package via yum update you have no choice but to reboot to build the drivers for the new kernel. bumblebee-nvidia works kind of like DELL's dkms package in this respect. As a side note, dkms is used by the bbswitch package. If you didn't install bbswitch earlier it will be installed with bumblebee-nvidia as an rpm dependency. The bumblebee-nvidia script acts kind of like dkms but it does not actually use dkms in any way. Its just a solution I made up to solve this bumblebee driver problem until someone more knowledgeable than me can create some kind of proper kmod type package that doesn't break mesa.

So... after the bumblebee-nvidia script finishes you can press CTRL-ALT-F1 or CTRL-ALT-F7 to get back to X and then login normally and use optirun like you would after a reboot. Rebooting at this point will not cause the driver to be rebuilt until a newer kernel gets installed and the script detects that its running under the new kernel.

If you ran optirun even once with the nouveau driver it will "taint" your system until you reboot again. The NVidia installer will not work if you have loaded nouveau to the point where a fake X screen was created. (via optirun)

If you decide not to reboot and to compile by hand then you will likely see this warning message on RHEL 6:

[VGL] WARNING: The OpenGL rendering context obtained on X display
[VGL]    :8.0 is indirect, which may cause performance to suffer.
[VGL]    If :8.0 is a local X display, then the framebuffer device
[VGL]    permissions may be set incorrectly.

A reboot seems to always fix this under RHEL. So because of these kind of problems I suggest rebooting to compile bumblebee-nvidia rather than compiling on the console by hand. If the script fails on bootup you can then try passing a "--debug" argument to bumblebee-nvidia by hand like this:

/usr/sbin/bumblebee-nvidia --debug

If you pass a --debug argument in while logged into a VT console or ssh'ed into your notebook you are more likely to see some error messages which might give clues as to what has gone wrong with the NVIDIA-Linux-*.run installer on a given kernel...


/usr/sbin/bumblebee-nvidia --check

for information about whether the bbswitch and nvidia modules compiled correctly. If you run into trouble this is usually the first command you should try.


/usr/sbin/bumblebee-nvidia --help

for a full list of options the shell script accepts.

If anyone has a better way of doing this, lets do it and get it into elrepo / rpmfusion somehow... Email me and we can try to figure it out. Or just even do it on your own! I'm willing to work with people on this problem. But its kind of a weird one and the nvidia-x11-drv package probbaly needs to be altered somehow. And then submitted as a review request. So for now there is this package.


Primus is a shared library that provides OpenGL and GLX APIs and implements low-overhead local-only client-side OpenGL offloading via GLX forking, similar to VirtualGL. It intercepts GLX calls and redirects GL rendering to a secondary X display, presumably driven by a faster GPU. On swapping buffers, rendered contents are read back using a PBO and copied onto the drawable it was supposed to be rendered on in the first place.

So, "optirun" is a part of the bumblebee package. And it uses VirtualGL. VirtualGL is great. But it isn't really made for playing games on hybrid graphics systems. So, since you already installed the nvidia drivers if you got this far, then go ahead and install primus as well. If you need to run 32 bit apps, you need to install the 32 bit versions...

Only care about 64 bit apps? run:

yum install primus

Need 32 bit app support?

yum install primus.x86_64 primus.i686 VirtualGL.i686

Now you can run apps with "primusrun" or with "optirun -b primus" or "optirun --bridge primus"

Check out the man pages for "optirun" and "primusrun" for further information about arguments the 2 programs accept.

To test if primusrun is working type:

PRIMUS_VERBOSE=2 optirun -b primus glxgears -info

If primus is working properly, you should see "primus: profiling:" messages every so often in the terminal you ran it from.

Primus is preffered over "optirun -b virtualgl" now. When setting up a new game, try optirun -b primus first and only fallback to optirun -b virtualgl if "-b primus" fails to work.

Version 4.0 of bumblebee will use primus as the default solution for displaying 3d graphics on your screen.

If you are using RHEL 6, you need to update to version 6.4 to use primus. It requires a newer mesa library than what is in 6.3 and earlier.

Lets recap all the various packages you need now

Only care about 64 bit apps?

yum -y install bumblebee bbswitch bumblebee-nvidia primus

Care about running both 32 and 64 bit apps on your dGPU?

yum -y install bumblebee bbswitch bumblebee-nvidia primus.x86_64 primus.i686 VirtualGL.x86_64 VirtualGL.i686

That should about cover installing all the software. Which brings us next to using it.

How to use bumblebee

General Usage:

primusrun [application-parameters]
optirun [options]  [application-parameters]

Some Examples:

Start Firefox accelerated with Optimus:

[somebody@localhost ~]$ optirun -b primus firefox


[somebody@localhost ~]$ optirun -b virtualgl firefox

Start Minecraft with Optimus:

[somebody@localhost ~]$ optirun -b primus java -Xmx1024M -Xms1024M -cp minecraft.jar net.minecraft.LauncherFrame &


[somebody@localhost ~]$ optirun -b virtualgl java -Xmx1024M -Xms1024M -cp minecraft.jar net.minecraft.LauncherFrame &

Use Nvidia Settings with Optimus: (primus doesn't work with this program)

[somebody@localhost ~]$ optirun -b none nvidia-settings -c :8

Hopefully these instructions and packages will help some other Optimus laptop fedora and RHEL 6 users out. I mainly created these for my own use but I wanted to share them in case other people found them helpful in any way. If anyone would like to adopt these packages for other repos / distros / whatever permission is granted by me for you to do that. These are some of the first packages I have built that are perhaps useful to other Red Hat folks so I'm still trying to figure out how to submit them to some other repos... Which brings us to the known issues section.

Known Issues

Secure Boot

Most likely you will need to disable "secure boot" in your BIOS or UEFI. (If your notebook has that) This is because the "nvidia" and "bbswitch" kernel modules are not signed.

You can run:

/usr/sbin/bumblebee-nvidia --check

To see if there were problems compiling your bbswitch or nvidia modules. If you are having problems this is probably the first command you should try. You don't need to be root to run the --check mode of this script unlike the normal usage when you compile a new nvidia driver.

Some error messages you might see:

[ERROR]Cannot access secondary GPU - error: [XORG] (EE) [drm] failed to open device

I've seen this error on RHEL 6 when I failed to reboot after running the "yum install" commands.

[ERROR]You've no permission to communicate with the Bumblebee daemon. Try adding yourself to the 'bumblebee' group
[ERROR]Could not connect to bumblebee daemon - is it running?

Some things to try.

Is bumblebeed running? Did you log out and log back in?

Did you add a user after installing bumblebee rpm?

Is your $HOME directory somewhere other than /home/ ?

Try running:

/usr/sbin/usermod -a -G bumblebee USERNAME

Where, USERNAME is your account name to add to the bumblebee group. You MUST be in the bumblebee group for primusrun or optirun to work.

Unable to rmmod nvidia

Because of having to upgrade the nvida driver for kernel 3.11, the nvidia kernel module is unable to be unloaded from the running kernel. There is an issue for this that has been created on github. It is here

The issue has also been brought up with the nvidia kernel module developers here

If anyone has any ideas for a fix it would be much appreciated. If you post in the devtalk forum please be polite and professional. We aren't really sure what they even make of the bumblebee project so we don't want to make them unwilling to help with this problem. Also, this bug affects fedora 18 and 19. It does not affect RHEL 6 / CentOS 6.

32 bit OS issues:

Running a 32 bit OS on 64 bit system and seeing this in the logs when optirun / primusrun fails?

localhost kernel: vmap allocation for size XXXXXXXX failed: use vmalloc= to increase size

You can add a vmalloc= argument to the kernel argumenst via grub. The amount after the equal sign depnds on how much RAM your notebook has. Check out the nvidia README file. Or a better way to work around this problem is to use a 64 bit OS and use multilib to run any 32 bit apps you need to. If you aren't too familiar with multilib, what this means is that if you try to run a game, and its missing some library, find out what package the library belongs to and if its already installed in a 64 bit directory, like /usr/lib64/*. If the library is in /usr/lib64/, but the game complains about /usr/lib/, then install the 32 bit version of that. If you have the 64 bit version of package libfoo you might need to install libfoo.i686 to get a given game to work. So your 64 bit OS is perfectly capable of running 32 bit binaries.

Primus is slower than optirun. Why?

Its not. VirtualGL is wrong.

It's not possible to make a good comparison against VirtualGL at high fps values, especially when you're passing `-fps 60`, because VirtualGL does not really display all frames the applications renders. E.g. with `VGL_FPS=1 optirun glxspheres` glxspheres will still report 100+ fps. So... please test with workloads where performance really matters, i.e. at 30-60 fps (and double check with your eyes). Also, keep in mind that compositing hurts performance.

nouveau drivers do not work on fedora 18 at this time. See #298 for further information. You must use nvidia for now.

To test if primusrun is working type:

PRIMUS_VERBOSE=2 optirun -b primus glxgears

If primus is working properly, you should see "primus: profiling:" messages every so often in the terminal you ran it from.

Problems with bumblebee-3.2.1-2

You may notice error messages like this:

Transaction test succeeded
Running transaction
  Updating   : bumblebee-3.2.1-4.fc19.x86_64                                1/2 
/var/tmp/rpm-tmp.XTcYCa: line 3: syntax error near unexpected token `fi'
/var/tmp/rpm-tmp.XTcYCa: line 3: `fi'
error: %preun(bumblebee-3.2.1-2.fc19.x86_64) scriptlet failed, exit status 2
Error in PREUN scriptlet in rpm package bumblebee-3.2.1-2.fc19.x86_64
  Verifying  : bumblebee-3.2.1-4.fc19.x86_64                                1/2 
  Verifying  : bumblebee-3.2.1-2.fc19.x86_64                                2/2 

  bumblebee.x86_64 0:3.2.1-4.fc19                                               

  bumblebee.x86_64 0:3.2.1-2.fc19              


type on fedora 19:

rpm -e --noscripts bumblebee-3.2.1-2.fc19

or on fedora 18:

rpm -e --noscripts bumblebee-3.2.1-2.fc18

Then type on either version:

rpm -e --nodeps bumblebee

And finally:

yum install bumblebee

to clear out and replace the bad version.

Any new installs of fedora should not get the broken package. This bug does not affect RHEL 6, only fedora.

If you are still having problems and can't figure out what is wrong, run:


with root permissions and follow the instructions the program gives you for reporting problems.

bumblebee in fedora

I am trying to get the various bumblebee packages into fedora and EPEL in an official capacity. That way one would not need to add my repository before running the yum install commands. Its rather difficult to get packages into fedora however... Packages must meet certain criteria before acceptence. So far only VirtualGL has been accepted into fedora by one of the developers. (My fedora packaging sponsor)

Since bumblebee depends on VirtualGL it had to be submitted for review in fedora and EPEL just like bumblebee is under review. Currently VirtualGL has been pushed out into fedora so it has been removed from this fedora repo. I am working on getting it into EPEL with Red Hat bugzilla bug 854670. Hopefully It won't take too long to get a turbojpeg and turbojpeg-devel created for EPEL? If you would like to look over the review request for bumblebee it is in bugzilla as bug 827167. The review request for VirtualGL was in bugzilla as bug 834127. Any help from other fedora developers or packagers appriciated with any of this bumblebee packaging. (I'm very new at this) Just email me if you'd like to work with me on trying to get any of this into fedora / rpmfusion / elrepo. gsgatlin "at" ncsu "dot" edu is my email address.

bbswitch kernel module

Please note bbswitch is an out-of-tree kernel module and needs to be built with dkms due to the way the module is currently packaged. Yum will take care of this for you automatically however.

Fedora's policy is to ban out of tree kernel modules in the distro. So for now I will keep this in the repo here at install.linux.ncsu.edu since I need a bbswitch package to work with my personal install procedures for my notebook.

Over the long term bbswitch might be more acceptable to the fedora community if were to be packaged in a third party repository as a kmod V2 type rpm. (Candidates might include rpmfusion repository? Or elrepo repository for RHEL 6 systems?) I can try to look at what would be involved when I have more time. If anyone else would like to try, any help is welcome. What we have with a dkms type rpm seems to work for now. The downside, I guess, is that you pull down a c compiler, linker, etc.

How will the "official" PRIME solution work when its ready?

We are told that official support for Optimus Hybrid graphics in Linux will be supported in this manner.

When it arrives in fedora, assuming that you are happy with the nouveau driver, or assuming that the nvidia closed source kernel module can take advantage of all of the PRIME infrastucture at some point...

glxgears - should display the program running on integrated intel GPU
DRI_PRIME=1 glxgears - should display the program running on descrete nvidia (or theoretically AMD) GPU.

Dave Airlie also plans some GNOME shell extension to make using PRIME easier with a launcher of some kind. We are not sure when Optimus will be "officially" supported within Linux. But I did want to put this info here so people know where we are headed in the future.

RHEL 6 Lenovo ideapad Y470 / Y480 / Y570 / Y580 / Lenovo G580 / G780 / Toshiba Satellite P870 further info

If you wish to use bumblebee software with a Lenovo Ideapad on the list above or a Toshiba Satellite P870 on RHEL 6 there is a bug in the kernel which prevents it from working.

I made a bugzilla for RHEL 6 here which you probably can't read. (Its marked as a private bug for some odd reason...) If you own one of these affected models, It will probably be fixed in RHEL 6.5 I would guess.

If you can't wait until they fix it, there is a out-of-tree kernel module dating from a time when this bug was less well understood called acpi-handle-hack that you can use as a workaround. When 6.5 comes out you will probably need to remember to uninstall this acpi-handle-hack package.

RHEL 6 only with affected notebook:

yum -y install acpi-handle-hack

Important bumblebee links




Primus bug tracker:


My efforts at creating RPM packages:


Personal tools