From Fedora Project Wiki

m (Spacing fixes.)
(Updated the installation process to a better one to reduce confusion. Added a few common issues and their fixes.)
(25 intermediate revisions by 8 users not shown)
Line 3: Line 3:
From [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ Bumblebee's FAQ]: Bumblebee is a effort to make Nvidia Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer.
From [https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ Bumblebee's FAQ]: Bumblebee is a effort to make Nvidia Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer.


== Install Dependencies ==
The discrete GPU (NVidia) is turned off when not in use and activated and turned on though ACPI calls when demanding OpenGL applications require the extra power the discrete GPU can give. Demanding OpenGL applications might include such things as 3D games or 3D rendering software but would not include such things as a web browser or a video playback program like mplayer or VLC.
 
== How can you tell if you have an optimus notebook computer? ==
 
If you purchased a notebook with an NVidia sticker on it, you ''might'' have a optimus computer. If you don’t have an optimus technology computer nothing in this documentation is relevant to your PC. (Optimus was slated at one point to go in desktop PCs but the industry ended up rejecting that concept…)
 
To tell, after you have installed the OS, open a terminal window and type:
 
<pre>
$ lspci -vnn | grep '\''[030[02]\]'
</pre>
 
If you see two video cards in the output like:
 
<pre>
<pre>
# yum install -y libbsd-devel libbsd glibc-devel libX11-devel help2man autoconf git tar glib2 glib2-devel kernel-devel kernel-headers automake gcc gtk2-devel
$ lspci -vnn | grep '\''[030[02]\]'
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 520 [8086:1916] (rev 07) (prog-if 00 [VGA controller])
01:00.0 3D controller [0302]: NVIDIA Corporation GM108M [GeForce 930M] [10de:1346] (rev ff) (prog-if ff)
</pre>
</pre>


You also need to install [http://www.virtualgl.org/VirtualGL VirtualGL]. Download the latest version for your arch at [http://www.virtualgl.org/Downloads/VirtualGL the VirtualGL download page] or use yum command
And one is a Intel “Integrated Graphics Controller” and the other is a “NVIDIA Corporation” chip, then you probably have an optimus notebook.
 
To further verify, if you have the two VGA devices with one as Intel Integrated and other as NVIDIA, as root look for the /sys/kernel/debug/vgaswitcheroo/switch file. If it exists, then you have an optimus PC. If its missing, then you might not. (It might be that you have a card that nouveau can’t use yet because it is too new…)
 
== Before you get started ==
 
Most users will want to turn off “Secure boot” in the bios or UEFI screen when you need nvidia drivers or bbswitch-dkms. If you want to make your own public / private keys for kernel module signing you can look [https://docs.fedoraproject.org/en-US/Fedora/22/html/System_Administrators_Guide/sect-signing-kernel-module-with-the-private-key.html here] or [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-signing-kernel-modules-for-secure-boot.html here] for more information on the subject. If you end up doing that and use the closed source NVidia driver, you will need to edit the /etc/bumblebee/bumblebee-nvidia-sign.conf file.
 
Next, do a dnf update before you begin. And just to be safe, reboot your PC so that you are booted into the newest kernel. The reason for this is that you want the kernel-devel package to match the kernel you are running under. If you don’t reboot after a dnf update these versions may differ which will cause compiling problems.
 
== Types of Drivers ==
 
=== Free and Open Source Driver (Nouveau) ===
 
Some users [http://www.kroah.com/log/linux/stable_api_nonsense.html feel strongly] that they should not use closed source kernel modules. This is understandable. In all cases, [http://nouveau.freedesktop.org/wiki/Optimus/ PRIME] will work better then using bumblebee.
 
{{Template:Admon/warning|Note:|'''As of 20<sup>th</sup> May, 2016 you can no longer use Bumblebee with the open source Nouveau drivers.'''<br>If you wish to learn more about this, see [https://github.com/Bumblebee-Project/Bumblebee/issues/773 issue 773]. <br>Users are requested to use '''PRIME''' instead of bumblebee. Since the nouveau driver already handles power saving now, using bumblebee would simply be superfluous.}}
 
=== Proprietary Closed Source Driver (NVIDIA) ===
 
Some users may prefer to use the closed-source proprietary drivers as they offer better performance than the open source ones. In that case, there's two sources from where you can get your drivers: '''http://rpmfusion.org/''' and '''http://negativo17.org/'''. Although both these sources are valid and will work, the negative017 driver is generally recommended over the RPMFusion ones, as the negative017 drivers are generally kept up to date and follow Fedora packaging guidelines better. They have also been known to work with Fedora to improve integration.
 
{{Template:Admon/note|Note:|The Installation process detailed below uses the negative017 repository. If you wish to use the RPMFusion repository instead, please adjust the steps according to your requirement.}}
 
== Installation (NVIDIA Proprietary) ==
 
To Install the NVIDIA drivers, first add the negative017 repo:


<pre># yum install VirtualGL </pre>
<pre>
# sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo
</pre>


If you want to run 32 bit apps on your 64 bit system, then also install:
then, Install the necessary packages:


<pre># yum install VirtualGL.i686 </pre>
<pre>
# sudo dnf install nvidia-driver kernel-devel akmod-nvidia dkms acpi
</pre>


== Install Bumblebee ==
To get '''Bumblebee''', we first need to enable the '''[https://copr.fedorainfracloud.org/coprs/chenxiaolong/bumblebee/ chenxiaolong/bumblebee]'''copr repository:
Install the Bumblebee yum repository


==== Fedora 20 ====
<pre>
<pre>
# yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora20/noarch/bumblebee-release-1.1-1.noarch.rpm
# sudo dnf copr enable chenxiaolong/bumblebee
</pre>
</pre>


==== Fedora 21 ====
Next, install the bbswitch driver, bumblebee and primus:
 
<pre>
<pre>
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora21/noarch/bumblebee-release-1.2-1.noarch.rpm
# sudo dnf install akmod-bbswitch bumblebee primus
</pre>
</pre>


==== Fedora 22 ====
For the "optirun" and "primusrun" commands to work, the current user must be added to the bumblebee group.
 
<pre>
<pre>
# dnf -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora22/noarch/bumblebee-release-1.2-1.noarch.rpm
# sudo gpasswd -a $USER bumblebee
</pre>
</pre>


Enable the bumblebeed service and disable the nvidia-fallback service. The nvidia-fallback service comes from the negativo17 drivers and will attempt to load nouveau if nvidia fails to load. However, when using Bumblebee, neither one should load at boot.


==== Install Bumblebee: ====
<pre>
<pre>
# yum -y install bbswitch bumblebee
# sudo systemctl enable bumblebeed
# sudo systemctl disable nvidia-fallback
</pre>
</pre>


== Bumblebee with the NVIDIA proprietary drivers ==
Finally, reboot and bumblebee should be ready to go.


The previous commands install bumbleblee with the nouveau drivers. If you want to install bumblebee with the NVIDIA proprietary drivers you must also follow these instructions:
== Usage ==
<br />


Install the bumblebee-nonfree repository (the bumblebee-free repository is needed too):
General usage syntax:  


==== Fedora 20 ====
<pre>
<pre>
# yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora20/noarch/bumblebee-nonfree-release-1.1-1.noarch.rpm
$ optirun [options] application [application-parameters]
</pre>
</pre>
A potentially more up-to-date driver may be installed using the bumblebee-nonfree-shortlived repo:
 
For example, start a Windows applications with optimus named application.exe:
 
<pre>
<pre>
# yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree-shortlived/fedora20/noarch/bumblebee-nonfree-shortlived-release-1.1-1.noarch.rpm
$ optirun wine application.exe
</pre>
</pre>


==== Fedora 21 ====
For another example, open NVidia settings panel with optimus:
 
<pre>
<pre>
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora21/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
$ optirun -b none nvidia-settings -c :8
</pre>
</pre>


==== Fedora 22 ====
For another example, open the java based Minecraft with primus bridge:
 
<pre>
<pre>
# dnf -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora22/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
$ optirun -b primus java -jar /PATH/TO/Minecraft.jar
</pre>
</pre>


Now install bumblebee-nvidia
For a list of the options for optirun, view its manual page:


==== Fedora 21 and older ====
<pre>
<pre>
#yum -y install bumblebee-nvidia
$ man optirun
</pre>
</pre>


==== Fedora 22 and later ====
In general, using the primus bridge gives better performance then using the default VirtualGL bridge. In bumblebee 4.0 (coming soon) primus will become the default bridge and VirtuaGL will need to be called explicitly if you still want it. Also beginning with bumblebee 4.0 (coming soon) the VirtuaGL dependency will be replaced with a primus dependency instead. So you might not even have VirtuaGL installed by default in the future.
 
For primus, there is a separate shell script you can use to invoke it called “primusrun.”
 
For a list of the options for primusrun, view its manual page:
 
<pre>
<pre>
# dnf -y install bumblebee-nvidia
$ man primusrun
</pre>
</pre>


"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 compared to the bumblebee package.
<pre>
$ primusrun java -jar /PATH/TO/Minecraft.jar
</pre>


==== Reboot ====
and
Make your bumblebee works.


=== Testing Bumblebee ===
To verify you are now using the NVIDIA driver, run the glxgears demo (from mesa-demos):
<pre>
<pre>
optirun glxgears -info | grep "GL_VENDOR"
$ optirun -b primus java -jar /PATH/TO/Minecraft.jar
</pre>
</pre>
You should see some gears rotating.  In the terminal you should see "GL_VENDOR = NVIDIA Corporation" or something similar.


== Primus ==
are functionally equivalent commands.
For speed imrovements you can use primus. 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. Currently primus requires the NVIDIA proprietary drivers.


Install primus:
It may become tedious to always use the optirun program in a terminal to launch 3D games or other 3D opengl applications. You may wish to create desktop launchers which use the optirun or primusrun commands in order to streamline this process.
<pre>#yum -y install primus </pre>


If you want to run 32 bit apps on your 64 bit system, then also install:
For example, in MATE desktop environment, when you right click on an empty space in the desktop a popup menu is displayed. One option on this menu is “Create launcher..” which allows you to create a graphical launcher icon for your apps which can be left on the desktop or moved into some folder. Other desktop environments also offer this functionality though the methods differ from desktop to desktop.
<pre>#yum -y install primus.i686</pre>


=== Testing primus ===
== Uninstallation ==
Open up a terminal and run:
'''To uninstall bumblebee:'''
<pre>PRIMUS_VERBOSE=2 optirun -b primus glxgears -info</pre>
<pre>
If primus is working properly, you should see "primus: profiling:" messages every so often in the terminal you ran it from.
# sudo dnf remove akmod-bbswitch bumblebee primus
# sudo systemctl preset nvidia-fallback
</pre>


== How to use Bumblebee ==
'''To remove the bumblebee repo:'''
<pre>
# sudo dnf copr remove chenxiaolong/bumblebee
</pre>


General Usage:
'''To uninstall the nvidia drivers:'''
<pre>
<pre>
optirun [options] <application> [application-parameters]
# sudo dnf remove nvidia-driver kernel-devel akmod-nvidia
</pre>
</pre>


If you installed primus, then you can use the following command to take advantage of it:
'''To remove the negative017 repo:'''
<pre>
<pre>
optirun -b primus <application> [application-parameters]
# sudo rm /etc/yum.repos.d/fedora-nvidia.repo
</pre>
</pre>


Start Windows applications:
Reboot.
 
 
 
== Multi monitor setup with closed driver  ==
 
Optimus laptops have two video chips: an integrated Intel and a discrete NVidia one. If the port (DisplayPort / HDMI / VGA) is wired to the Intel chip, you do not need to do anything special to get external monitors to work.
 
When the external port is wired into the NVidia chip, you cannot currently expand the screen over monitors without extra effort. Read on if you fall into this category…
 
Install the <code>intel-gpu-tools package</code>:
 
<pre>
<pre>
optirun wine <windows application>.exe
# dnf install intel-gpu-tools
</pre>
</pre>


with primus:
Running ‘intel-virtual-output’ (from the intel-gpu-tools rpm) without any extra parameters will daemonize itself and detect attached displays in the background. It will then perform all the trickery of virtualizing and cloning so that the newly attached screen can be used via conventional screen management methods, such as cloning/extending with xrandr.
 
For example, if your laptop’s display is called eDP1, and your using a external adapter called HDMI1, and you wanted the display to be 1920×1080 resolution, you could run the following commands:
 
To have your HDMI screen to the right of your desktop, run:
 
<pre>
<pre>
optirun -b primus wine <windows application>.exe
$ xrandr –output eDP1 –mode 1920×1080 –output HDMI1 –mode 1920×1080 –right-of eDP1
</pre>
</pre>


By default, primus renders up to 60 fps. To render more frames per second:
To clone your desktop, run:
 
<pre>
<pre>
vblank_mode=0 optirun -b primus <application> [application-parameters]
$ xrandr –output eDP1 –mode 1920×1080 –output HDMI1 –mode 1920×1080 –same-as eDP1
</pre>
</pre>
In practice this will probably only waste power, as most screens do not display more than 60 frames per second.


You can always run "man optirun" for more information.
 
There are many different possibilities. Type xrandr with no arguments to see what displays you have attached. See [https://github.com/Bumblebee-Project/Bumblebee/wiki/Multi-monitor-setup this web page] for further information on this subject. Read the manual page for xrandr for even more information on the possibilities this command provides.
 
If intel-virtual-output works ok running by hand you could add it to your startup automatically if you desire. One way would be to create a /etc/rc.d/rc.local script and add it into there. Another way might be to create a systemd unit file as Type=oneshot. A third way might be to run it at login using whatever mechanism your desktop environment supports for doing such things. For example, in MATE desktop environment, there is a mate-session-properties program (System -> Preferences -> Personal -> Startup Applications) that you can run programs from when you login. Most desktop environments offer similar functionality though the methods differ from desktop to desktop.


== Troubleshooting ==
== Troubleshooting ==


=== Unable to use optirun with nouveau ===
=== [VGL] ERROR: Could not open display :8 ===
 
There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")
 
This is a known problem with VirtualGL. As of bumblebee 3.1, so long as you have it installed, you can use Primus as your render bridge:


In some cases, users on post Linux 3.4 kernels are unable to use bumblebee with nouveau.
One less then optimal workaround is to not use optirun and instead request that the window
be drawn using the primary or secondary graphics cards/drivers.  This can be achieved
using the following:
<pre>
<pre>
[user1@localhost ~]$ DRI_PRIME=0 glxgears -info | grep "GL_VENDOR"
$ optirun -b primus wine windows program.exe
[user1@localhost ~]$ DRI_PRIME=1 glxgears -info | grep "GL_VENDOR"
</pre>
</pre>
These two commands should produce the demonstration gears and the driver vendor (often Intel and
nouveau) in the terminal.  For more information see (https://bugzilla.redhat.com/show_bug.cgi?id=964012).


=== Unable to load (NVIDIA) GPU driver error with optirun ===
=== Xlib: extension "GLX" missing on display ":0.0" ===
Most of the information presented here was suggested by bumblebee maintainer Gary Gatling.
 
If you tried to install the NVIDIA driver from NVIDIA website, this is not going to work.
Please uninstall the driver and reinstall using one of the above mentioned repos.
 
=== [ERROR]Cannot access secondary GPU: No devices detected ===
 
In some instances, running optirun will return:


The verbose output of optirun provided by appending the switch -vv can give us an idea of the issue at hand.
<pre>
<pre>
[user1@localhost ~]$optirun -vv vlc
[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected.
[   52.410461] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ERROR]Aborting because fallback start is disabled.
[   52.411039] [INFO]Configured driver: nvidia
</pre>
[  52.411659] [DEBUG]optirun version 3.2.1 starting...
 
[  52.411716] [DEBUG]Active configuration:
In this case, you will need to move the file <code>/etc/X11/xorg.conf.d/20-intel.conf</code> to somewhere else, restart the bumblebeed daemon and it should work. If you do need to change some features for the Intel module, a workaround is to merge <code>/etc/X11/xorg.conf.d/20-intel.conf</code> to <code>/etc/X11/xorg.conf</code>.
[  52.411745] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
 
[  52.411765] [DEBUG] X display: :8
It could be also necessary to comment the driver line in <code>/etc/X11/xorg.conf.d/10-monitor.conf</code>.
[  52.411785] [DEBUG] LD_LIBRARY_PATH: /usr/lib64/nvidia-bumblebee:/usr/lib/nvidia-bumblebee:/usr/lib64:/usr/lib
[  52.411805] [DEBUG] Socket path: /var/run/bumblebee.socket
[  52.411826] [DEBUG] Accel/display bridge: auto
[  52.411847] [DEBUG] VGL Compression: proxy
[  52.411868] [DEBUG] VGLrun extra options:
[  52.411886] [DEBUG] Primus LD Path: /usr/lib/primus:/usr/lib64/primus
[  52.411939] [DEBUG]Using auto-detected bridge virtualgl
[  52.434739] [INFO]Response: No - error: Could not load GPU driver


[  52.434758] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
You might need to define the NVIDIA card somewhere (e.g. <code>file /etc/bumblebee/xorg.conf.nvidia</code>), using the correct <code>BusID</code> according to <code>lspci</code> output:  


[  52.434763] [DEBUG]Socket closed.
<pre>
[  52.434781] [ERROR]Aborting because fallback start is disabled.
Section "Device"
[  52.434787] [DEBUG]Killing all remaining processes.
    Identifier "nvidiagpu1"
    Driver "nvidia"
    BusID "PCI:0:1:0"
EndSection
</pre>
</pre>
When you upgrade from one version of nvidia binary to higher version of the module, sometimes the un-install phase is not complete and in that case this following suggestion should help.


1. First unload the nvidia module by logging in as root in a terminal. Terminal output of ''cat /proc/acpi/bbswitch'' should be ''OFF'' after this step.
Observe that the format of <code>lspci</code> output is in HEX, while in xorg it is in decimals. So if the output of <code>lspci</code> is, for example, <code>0a:00.0</code> the <code>BusID</code> should be <code>PCI:10:0:0</code>.  
<pre>systemctl restart bumblebeed </pre>
 
2. Uninstall the nvidia module
=== NVIDIA(0): Failed to assign any connected display devices to X screen 0 ===
<pre>/usr/sbin/bumblebee-nvidia --debug --uninstall
 
If the console output is:
 
<pre>
[ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(0): Failed to assign any connected display devices to X screen 0
[ERROR]Aborting because fallback start is disabled.
</pre>
 
You can change this line in <code>/etc/bumblebee/xorg.conf.nvidia</code>:
 
<pre>
Option "ConnectedMonitor" "DFP"
</pre>
 
to:
 
<pre>
Option "ConnectedMonitor" "CRT"
</pre>
 
=== Failed to initialize the NVIDIA GPU at PCI:1:0:0 (GPU fallen off the bus / RmInitAdapter failed!) ===
 
Add <code>rcutree.rcu_idle_gp_delay=1</code> to your kernel parameters.
 
=== Could not load GPU driver ===
 
If the console output is:
 
<pre>
[ERROR]Cannot access secondary GPU - error: Could not load GPU driver
</pre>
</pre>
3. modinfo nvidia probably gives you an output similar to this
 
<pre>[root@localhost ~]# modinfo nvidia
and if you try to load the nvidia module you get:
filename:      /lib/modules/3.11.8-300.fc20.x86_64/kernel/drivers/video/nvidia.ko
 
modinfo: ERROR: could not get modinfo from 'nvidia': No such file or directory
<pre>
modprobe nvidia
modprobe: ERROR: could not insert 'nvidia': Exec format error
</pre>
</pre>
4. Prepare to compile the nvidia driver at restart for the current kernel and reboot the system
<pre>[root@localhost ~]# touch /etc/sysconfig/nvidia/compile-nvidia-driver
[root@localhost ~]# reboot


This could be because the nvidia driver is out of sync with the Linux kernel, for example if you installed the latest nvidia driver and haven't updated the kernel in a while. A full system update might resolve the issue.
=== /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied ===
This could be worked around by appending following lines in <code>/etc/bumblebee/xorg.conf.nvidia</code>:
<pre>
Section "Screen"
    Identifier "Default Screen"
    Device "DiscreteNvidia"
EndSection
</pre>
</pre>
5. Post reboot should give the modinfo output something similar to this and you should be able to use optirun as intended.
<pre>@localhost ~]$ modinfo nvidia
filename:      /lib/modules/3.11.8-300.fc20.x86_64/kernel/drivers/video/nvidia.ko
alias:          char-major-195-*
version:        331.20
supported:      external
license:        NVIDIA
alias:          pci:v000010DEd00000E00sv*sd*bc04sc80i00*
alias:          pci:v000010DEd00000AA3sv*sd*bc0Bsc40i00*
alias:          pci:v000010DEd*sv*sd*bc03sc02i00*
alias:          pci:v000010DEd*sv*sd*bc03sc00i00*
depends:        drm,i2c-core
vermagic:      3.11.8-300.fc20.x86_64 SMP mod_unload
parm:          NVreg_Mobile:int
parm:          NVreg_ResmanDebugLevel:int
parm:          NVreg_RmLogonRC:int
parm:          NVreg_ModifyDeviceFiles:int
parm:          NVreg_DeviceFileUID:int
parm:          NVreg_DeviceFileGID:int
parm:          NVreg_DeviceFileMode:int
parm:          NVreg_RemapLimit:int
parm:          NVreg_UpdateMemoryTypes:int
parm:          NVreg_InitializeSystemMemoryAllocations:int
parm:          NVreg_RMEdgeIntrCheck:int
parm:          NVreg_UsePageAttributeTable:int
parm:          NVreg_MapRegistersEarly:int
parm:          NVreg_RegisterForACPIEvents:int
parm:          NVreg_CheckPCIConfigSpace:int
parm:          NVreg_EnablePCIeGen3:int
parm:          NVreg_EnableMSI:int
parm:          NVreg_MemoryPoolSize:int
parm:          NVreg_RegistryDwords:charp
parm:          NVreg_RmMsg:charp.
parm:          NVreg_AssignGpus:charp</pre>


Make sure your nvidia module is unloaded when you do this steps. For some repeating the steps a couple of times was necessary.
=== ERROR: ld.so: object 'libdlfaker.so' from LD_PRELOAD cannot be preloaded: ignored ===
 
You're probably trying to start a 32-bit application with bumblebee on a 64-bit system. Please install the 32-bit versions of the packages mentioned above.
 
If the problem persists, please try using the primus bridge that was mentioned above.
 
=== Fatal IO error 11 (Resource temporarily unavailable) on X server ===
 
Change <code>KeepUnusedXServer</code> in <code>/etc/bumblebee/bumblebee.conf</code> from <code>false</code> to <code>true</code>. Your program forks into background and bumblebee doesn't know anything about it.
 
=== Video Tearing ===
 
Video tearing is a somewhat common problem on Bumblebee. To fix it, you need to enable vsync. It should be enabled by default on the Intel card, but verify that from Xorg logs. To check whether or not it is enabled for NVIDIA, make sure <code>nvidia-settings</code> is installed and run:
<pre>
# optirun -b none nvidia-settings -c :8
</pre>
 
<code>X Server XVideo Settings -> Sync to VBlank</code> and <code>OpenGL Settings -> Sync to VBlank</code> should both be enabled.
 
=== Bumblebee cannot connect to socket ===
 
If the console output is:
<pre>
[ 1648.179533] [ERROR]You've no permission to communicate with the Bumblebee daemon. Try adding yourself to the 'bumblebee' group
[ 1648.179628] [ERROR]Could not connect to bumblebee daemon - is it running?
</pre>
 
Verify whether or not you are in the <code>bumblebee</code> group:
<pre>
# groups | grep bumblebee
</pre>
 
Another reason for this error could be that you haven't actually turned on both gpus in your bios, and as a result, the Bumblebee daemon is in fact not running. Check the bios settings carefully and be sure intel graphics (integrated graphics - may be abbreviated in bios as something like igfx) has been enabled or set to auto, and that it's the primary gpu. Your display should be connected to the onboard integrated graphics, not the discrete graphics card.
 
If you mistakenly had the display connected to the discrete graphics card and intel graphics was disabled, you probably installed Bumblebee after first trying to run Nvidia alone. In this case, be sure to remove the /etc/X11/xorg.conf or .../20-nvidia... configuration files. If Xorg is instructed to use Nvidia in a conf file, X will fail.
 
=== Primusrun mouse delay (disable VSYNC) ===
 
For <code>primusrun</code>, <code>VSYNC</code> is enabled by default and as a result, it could make mouse input delay lag or even slightly decrease performance. Test <code>primusrun</code> with <code>VSYNC</code> disabled:
<pre>
# vblank_mode=0 primusrun <command>
</pre>
If you are satisfied with the above setting, create an alias (e.g. <code>alias primusrun="vblank_mode=0 primusrun"</code>).
 
=== Primus issues under compositing window managers ===
 
Since compositing hurts performance, invoking primus when a compositing WM is active is not recommended. If you need to use primus with compositing and see flickering or bad performance, synchronizing primus' display thread with the application's rendering thread may help:
<pre>
# PRIMUS_SYNC=1 primusrun <command>
</pre>
This makes primus display the previously rendered frame.
 
=== Compatibility with recent laptops that have American Megatrend BIOSes ===
 
Some recent laptop models featuring AMI bioses have some compatibility issues with bbswitch and Optimus, making them unable to load into graphics mode and crashing every time it is attempted, as discussed in further details in this post on the Bumblebee's github: https://github.com/Bumblebee-Project/Bumblebee/issues/764#issuecomment-234494238 .
 
If you are trying to use Linux on a recent Optimus laptop and it crashes every time you try to enter a graphics environment, please try adding the following parameters to your boot loader (Fedora users usually have GRUB installed):
 
<pre>
acpi_osi=! acpi_osi='Windows 2009'
</pre>
 
This seems to work on most laptop models facing this issue, but bear in mind that this workaround has not been tested in every laptop model ever made – so your mileage may vary. If the problems persist, you could try updating your BIOS or look for more info in the Bumblebee documentation and their community.
 
=== Broken power management with kernel 4.8 ===
 
If you have a newer laptop (BIOS date 2015 or newer), then Linux 4.8 might break bbswitch since bbswitch does not support the newer, recommended power management method. As a result, the dGPU may fail to power on, fail to power off or worse.
 
See [https://github.com/Bumblebee-Project/bbswitch/issues/140 Issue 140] for further information about this problem.
 
As a workaround, add <code>pcie_port_pm=off</code> to your kernel parameters.
 
Alternatively, if you are only interested in power saving (and perhaps use of external monitors), remove bumblebee / bbswitch and rely on Nouveau runtime power-management (which supports the new method).


== Useful links ==
== Useful links ==
* http://techies.ncsu.edu/wiki/bumblebee
 
* http://bumblebee-project.org/
* http://bumblebee-project.org/
* https://github.com/Bumblebee-Project/Bumblebee/wiki
* https://github.com/Bumblebee-Project/Bumblebee/wiki
* https://github.com/Bumblebee-Project/Bumblebee/
* https://github.com/Bumblebee-Project/bbswitch
* https://github.com/amonakov/primus
* https://www.linux.ncsu.edu/bumblebee/
* https://copr.fedorainfracloud.org/coprs/chenxiaolong/bumblebee/
[http://www.thelinuxrain.com/articles/the-state-of-nvidia-optimus-on-linux The State of NVIDIA Optimus on Linux]

Revision as of 21:59, 4 January 2018

Description

Nvidia Optimus is an optimization technology created by Nvidia which, depending on the resource load generated by client software applications, will transparently and seamlessly switch between two graphics adapters within a computer system in order to provide either maximum performance or minimum power draw from the system's graphics rendering hardware. From Bumblebee's FAQ: Bumblebee is a effort to make Nvidia Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer.

The discrete GPU (NVidia) is turned off when not in use and activated and turned on though ACPI calls when demanding OpenGL applications require the extra power the discrete GPU can give. Demanding OpenGL applications might include such things as 3D games or 3D rendering software but would not include such things as a web browser or a video playback program like mplayer or VLC.

How can you tell if you have an optimus notebook computer?

If you purchased a notebook with an NVidia sticker on it, you might have a optimus computer. If you don’t have an optimus technology computer nothing in this documentation is relevant to your PC. (Optimus was slated at one point to go in desktop PCs but the industry ended up rejecting that concept…)

To tell, after you have installed the OS, open a terminal window and type:

$ lspci -vnn | grep '\''[030[02]\]'

If you see two video cards in the output like:

$ lspci -vnn | grep '\''[030[02]\]'
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 520 [8086:1916] (rev 07) (prog-if 00 [VGA controller])
01:00.0 3D controller [0302]: NVIDIA Corporation GM108M [GeForce 930M] [10de:1346] (rev ff) (prog-if ff)

And one is a Intel “Integrated Graphics Controller” and the other is a “NVIDIA Corporation” chip, then you probably have an optimus notebook.

To further verify, if you have the two VGA devices with one as Intel Integrated and other as NVIDIA, as root look for the /sys/kernel/debug/vgaswitcheroo/switch file. If it exists, then you have an optimus PC. If its missing, then you might not. (It might be that you have a card that nouveau can’t use yet because it is too new…)

Before you get started

Most users will want to turn off “Secure boot” in the bios or UEFI screen when you need nvidia drivers or bbswitch-dkms. If you want to make your own public / private keys for kernel module signing you can look here or here for more information on the subject. If you end up doing that and use the closed source NVidia driver, you will need to edit the /etc/bumblebee/bumblebee-nvidia-sign.conf file.

Next, do a dnf update before you begin. And just to be safe, reboot your PC so that you are booted into the newest kernel. The reason for this is that you want the kernel-devel package to match the kernel you are running under. If you don’t reboot after a dnf update these versions may differ which will cause compiling problems.

Types of Drivers

Free and Open Source Driver (Nouveau)

Some users feel strongly that they should not use closed source kernel modules. This is understandable. In all cases, PRIME will work better then using bumblebee.

Warning.png
Note:
As of 20th May, 2016 you can no longer use Bumblebee with the open source Nouveau drivers.
If you wish to learn more about this, see issue 773.
Users are requested to use PRIME instead of bumblebee. Since the nouveau driver already handles power saving now, using bumblebee would simply be superfluous.

Proprietary Closed Source Driver (NVIDIA)

Some users may prefer to use the closed-source proprietary drivers as they offer better performance than the open source ones. In that case, there's two sources from where you can get your drivers: http://rpmfusion.org/ and http://negativo17.org/. Although both these sources are valid and will work, the negative017 driver is generally recommended over the RPMFusion ones, as the negative017 drivers are generally kept up to date and follow Fedora packaging guidelines better. They have also been known to work with Fedora to improve integration.

Note.png
Note:
The Installation process detailed below uses the negative017 repository. If you wish to use the RPMFusion repository instead, please adjust the steps according to your requirement.

Installation (NVIDIA Proprietary)

To Install the NVIDIA drivers, first add the negative017 repo:

# sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo

then, Install the necessary packages:

# sudo dnf install nvidia-driver kernel-devel akmod-nvidia dkms acpi

To get Bumblebee, we first need to enable the chenxiaolong/bumblebeecopr repository:

# sudo dnf copr enable chenxiaolong/bumblebee

Next, install the bbswitch driver, bumblebee and primus:

# sudo dnf install akmod-bbswitch bumblebee primus

For the "optirun" and "primusrun" commands to work, the current user must be added to the bumblebee group.

# sudo gpasswd -a $USER bumblebee

Enable the bumblebeed service and disable the nvidia-fallback service. The nvidia-fallback service comes from the negativo17 drivers and will attempt to load nouveau if nvidia fails to load. However, when using Bumblebee, neither one should load at boot.

# sudo systemctl enable bumblebeed
# sudo systemctl disable nvidia-fallback

Finally, reboot and bumblebee should be ready to go.

Usage


General usage syntax:

$ optirun [options] application [application-parameters]

For example, start a Windows applications with optimus named application.exe:

$ optirun wine application.exe

For another example, open NVidia settings panel with optimus:

$ optirun -b none nvidia-settings -c :8

For another example, open the java based Minecraft with primus bridge:

$ optirun -b primus java -jar /PATH/TO/Minecraft.jar

For a list of the options for optirun, view its manual page:

$ man optirun

In general, using the primus bridge gives better performance then using the default VirtualGL bridge. In bumblebee 4.0 (coming soon) primus will become the default bridge and VirtuaGL will need to be called explicitly if you still want it. Also beginning with bumblebee 4.0 (coming soon) the VirtuaGL dependency will be replaced with a primus dependency instead. So you might not even have VirtuaGL installed by default in the future.

For primus, there is a separate shell script you can use to invoke it called “primusrun.”

For a list of the options for primusrun, view its manual page:

$ man primusrun
$ primusrun java -jar /PATH/TO/Minecraft.jar

and

$ optirun -b primus java -jar /PATH/TO/Minecraft.jar

are functionally equivalent commands.

It may become tedious to always use the optirun program in a terminal to launch 3D games or other 3D opengl applications. You may wish to create desktop launchers which use the optirun or primusrun commands in order to streamline this process.

For example, in MATE desktop environment, when you right click on an empty space in the desktop a popup menu is displayed. One option on this menu is “Create launcher..” which allows you to create a graphical launcher icon for your apps which can be left on the desktop or moved into some folder. Other desktop environments also offer this functionality though the methods differ from desktop to desktop.

Uninstallation

To uninstall bumblebee:

# sudo dnf remove akmod-bbswitch bumblebee primus
# sudo systemctl preset nvidia-fallback

To remove the bumblebee repo:

# sudo dnf copr remove chenxiaolong/bumblebee

To uninstall the nvidia drivers:

# sudo dnf remove nvidia-driver kernel-devel akmod-nvidia

To remove the negative017 repo:

# sudo rm /etc/yum.repos.d/fedora-nvidia.repo

Reboot.


Multi monitor setup with closed driver

Optimus laptops have two video chips: an integrated Intel and a discrete NVidia one. If the port (DisplayPort / HDMI / VGA) is wired to the Intel chip, you do not need to do anything special to get external monitors to work.

When the external port is wired into the NVidia chip, you cannot currently expand the screen over monitors without extra effort. Read on if you fall into this category…

Install the intel-gpu-tools package:

# dnf install intel-gpu-tools

Running ‘intel-virtual-output’ (from the intel-gpu-tools rpm) without any extra parameters will daemonize itself and detect attached displays in the background. It will then perform all the trickery of virtualizing and cloning so that the newly attached screen can be used via conventional screen management methods, such as cloning/extending with xrandr.

For example, if your laptop’s display is called eDP1, and your using a external adapter called HDMI1, and you wanted the display to be 1920×1080 resolution, you could run the following commands:

To have your HDMI screen to the right of your desktop, run:

$ xrandr –output eDP1 –mode 1920×1080 –output HDMI1 –mode 1920×1080 –right-of eDP1

To clone your desktop, run:

$ xrandr –output eDP1 –mode 1920×1080 –output HDMI1 –mode 1920×1080 –same-as eDP1


There are many different possibilities. Type xrandr with no arguments to see what displays you have attached. See this web page for further information on this subject. Read the manual page for xrandr for even more information on the possibilities this command provides.

If intel-virtual-output works ok running by hand you could add it to your startup automatically if you desire. One way would be to create a /etc/rc.d/rc.local script and add it into there. Another way might be to create a systemd unit file as Type=oneshot. A third way might be to run it at login using whatever mechanism your desktop environment supports for doing such things. For example, in MATE desktop environment, there is a mate-session-properties program (System -> Preferences -> Personal -> Startup Applications) that you can run programs from when you login. Most desktop environments offer similar functionality though the methods differ from desktop to desktop.

Troubleshooting

[VGL] ERROR: Could not open display :8

There is a known problem with some wine applications that fork and kill the parent process without keeping track of it (for example the free to play online game "Runes of Magic")

This is a known problem with VirtualGL. As of bumblebee 3.1, so long as you have it installed, you can use Primus as your render bridge:

$ optirun -b primus wine windows program.exe

Xlib: extension "GLX" missing on display ":0.0"

If you tried to install the NVIDIA driver from NVIDIA website, this is not going to work. Please uninstall the driver and reinstall using one of the above mentioned repos.

[ERROR]Cannot access secondary GPU: No devices detected

In some instances, running optirun will return:

[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devices detected.
[ERROR]Aborting because fallback start is disabled.

In this case, you will need to move the file /etc/X11/xorg.conf.d/20-intel.conf to somewhere else, restart the bumblebeed daemon and it should work. If you do need to change some features for the Intel module, a workaround is to merge /etc/X11/xorg.conf.d/20-intel.conf to /etc/X11/xorg.conf.

It could be also necessary to comment the driver line in /etc/X11/xorg.conf.d/10-monitor.conf.

You might need to define the NVIDIA card somewhere (e.g. file /etc/bumblebee/xorg.conf.nvidia), using the correct BusID according to lspci output:

Section "Device"
    Identifier "nvidiagpu1"
    Driver "nvidia"
    BusID "PCI:0:1:0"
EndSection

Observe that the format of lspci output is in HEX, while in xorg it is in decimals. So if the output of lspci is, for example, 0a:00.0 the BusID should be PCI:10:0:0.

NVIDIA(0): Failed to assign any connected display devices to X screen 0

If the console output is:

[ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(0): Failed to assign any connected display devices to X screen 0
[ERROR]Aborting because fallback start is disabled.

You can change this line in /etc/bumblebee/xorg.conf.nvidia:

Option "ConnectedMonitor" "DFP"

to:

Option "ConnectedMonitor" "CRT"

Failed to initialize the NVIDIA GPU at PCI:1:0:0 (GPU fallen off the bus / RmInitAdapter failed!)

Add rcutree.rcu_idle_gp_delay=1 to your kernel parameters.

Could not load GPU driver

If the console output is:

[ERROR]Cannot access secondary GPU - error: Could not load GPU driver

and if you try to load the nvidia module you get:

modprobe nvidia
modprobe: ERROR: could not insert 'nvidia': Exec format error

This could be because the nvidia driver is out of sync with the Linux kernel, for example if you installed the latest nvidia driver and haven't updated the kernel in a while. A full system update might resolve the issue.

/dev/dri/card0: failed to set DRM interface version 1.4: Permission denied

This could be worked around by appending following lines in /etc/bumblebee/xorg.conf.nvidia:

Section "Screen"
    Identifier "Default Screen"
    Device "DiscreteNvidia"
EndSection

ERROR: ld.so: object 'libdlfaker.so' from LD_PRELOAD cannot be preloaded: ignored

You're probably trying to start a 32-bit application with bumblebee on a 64-bit system. Please install the 32-bit versions of the packages mentioned above.

If the problem persists, please try using the primus bridge that was mentioned above.

Fatal IO error 11 (Resource temporarily unavailable) on X server

Change KeepUnusedXServer in /etc/bumblebee/bumblebee.conf from false to true. Your program forks into background and bumblebee doesn't know anything about it.

Video Tearing

Video tearing is a somewhat common problem on Bumblebee. To fix it, you need to enable vsync. It should be enabled by default on the Intel card, but verify that from Xorg logs. To check whether or not it is enabled for NVIDIA, make sure nvidia-settings is installed and run:

# optirun -b none nvidia-settings -c :8

X Server XVideo Settings -> Sync to VBlank and OpenGL Settings -> Sync to VBlank should both be enabled.

Bumblebee cannot connect to socket

If the console output is:

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

Verify whether or not you are in the bumblebee group:

# groups | grep bumblebee

Another reason for this error could be that you haven't actually turned on both gpus in your bios, and as a result, the Bumblebee daemon is in fact not running. Check the bios settings carefully and be sure intel graphics (integrated graphics - may be abbreviated in bios as something like igfx) has been enabled or set to auto, and that it's the primary gpu. Your display should be connected to the onboard integrated graphics, not the discrete graphics card.

If you mistakenly had the display connected to the discrete graphics card and intel graphics was disabled, you probably installed Bumblebee after first trying to run Nvidia alone. In this case, be sure to remove the /etc/X11/xorg.conf or .../20-nvidia... configuration files. If Xorg is instructed to use Nvidia in a conf file, X will fail.

Primusrun mouse delay (disable VSYNC)

For primusrun, VSYNC is enabled by default and as a result, it could make mouse input delay lag or even slightly decrease performance. Test primusrun with VSYNC disabled:

# vblank_mode=0 primusrun <command>

If you are satisfied with the above setting, create an alias (e.g. alias primusrun="vblank_mode=0 primusrun").

Primus issues under compositing window managers

Since compositing hurts performance, invoking primus when a compositing WM is active is not recommended. If you need to use primus with compositing and see flickering or bad performance, synchronizing primus' display thread with the application's rendering thread may help:

# PRIMUS_SYNC=1 primusrun <command>

This makes primus display the previously rendered frame.

Compatibility with recent laptops that have American Megatrend BIOSes

Some recent laptop models featuring AMI bioses have some compatibility issues with bbswitch and Optimus, making them unable to load into graphics mode and crashing every time it is attempted, as discussed in further details in this post on the Bumblebee's github: https://github.com/Bumblebee-Project/Bumblebee/issues/764#issuecomment-234494238 .

If you are trying to use Linux on a recent Optimus laptop and it crashes every time you try to enter a graphics environment, please try adding the following parameters to your boot loader (Fedora users usually have GRUB installed):

acpi_osi=! acpi_osi='Windows 2009'

This seems to work on most laptop models facing this issue, but bear in mind that this workaround has not been tested in every laptop model ever made – so your mileage may vary. If the problems persist, you could try updating your BIOS or look for more info in the Bumblebee documentation and their community.

Broken power management with kernel 4.8

If you have a newer laptop (BIOS date 2015 or newer), then Linux 4.8 might break bbswitch since bbswitch does not support the newer, recommended power management method. As a result, the dGPU may fail to power on, fail to power off or worse.

See Issue 140 for further information about this problem.

As a workaround, add pcie_port_pm=off to your kernel parameters.

Alternatively, if you are only interested in power saving (and perhaps use of external monitors), remove bumblebee / bbswitch and rely on Nouveau runtime power-management (which supports the new method).

Useful links

The State of NVIDIA Optimus on Linux