Installing and Configuring Bumblebee on Optimus-designed laptops (XPS 15 9530)
Newer, high-end laptops have a hybrid techology composed of a high-performance HD display adapter and a 3D-accelerated adapter. For nVidia chipsets, this is called Optimus. It is designed so that the 3D acceleration is only used when needed, optimizing power consumption. This is done automatically in Windows systems through the nVidia driver. However, in Linux systems, implementing this feature and actually making use of the 3D capabilities is more complex, because as of 2017/12/13 17:34, there is no nVidia-native Optimus support in the Linux driver.
This guide only applies to Ubuntu 14.04 Trusty Tahr 64-bit (under Linux Mint 17 Qiana), using the nvidia-331 driver from xorg-edgers.
In order to overcome this issue, a solution exists, called Bumblebee. This runtime allows for the interaction of the operating system with the 3D-capabilities of the card, allowing the use of the nVidia driver for gaming or applications as needed.
It is recommended that you perform a full update of all packages in system before attempting to install the Bumblebee packages / nVidia drivers. Also if you have nvidia-current or other version of the nvidia-drivers, you are advised to purge them with
sudo purge nvidia*
(Do not forget to reboot). nVidia ppa's other than xorg-edgers need to be disabled or removed for the sake of this particular example.
Adding the PPAs
In order to install Bumblebee, we need to make sure we have 2 important repositories added, as follows.
sudo add-apt-repository ppa:xorg-edgers/ppa sudo add-apt-repository ppa:bumblebee/stable
After adding the repositories, perform a sources update, and then proceed to install the packages. This example uses the nVidia 331 drivers from the edgers repository. This is bound to change as newer versions of the driver are released through the xorg-edgers PPA.
sudo apt-get update sudo apt-get install nvidia-331 nvidia-settings-331 bumblebee bumblebee-nvidia primus primus-libs primus-libs-ia32 virtualgl virtualgl-libs virtualgl-libs-ia32 linux-headers-generic
After installing the packages, reboot the system. There will be a couple more restarts through the whole process.
Configuring Bumblebee
After restarting, the settings for Bumblebee/nVidia need to be configured. The following files will need to be edited to match the currently installed hardware/packages:
- /etc/bumblebee/bumblebee.conf
- /etc/bumblebee/xorg.conf.nouveau
- /etc/bumblebee/xorg.conf.nvidia
Editing /etc/bumblebee/bumblebee.conf
Open the file with sudo as follows:
sudo gedit /etc/bumblebee/bumblebee.confAnd change the contents of the file to match the following.
# Configuration file for Bumblebee. Values should **not** be put between quotes ## Server options. Any change made in this section will need a server restart # to take effect. [bumblebeed] # The secondary Xorg server DISPLAY number VirtualDisplay=:8 # Should the unused Xorg server be kept running? Set this to true if waiting # for X to be ready is too long and don't need power management at all. KeepUnusedXServer=false # The name of the Bumbleblee server group name (GID name) ServerGroup=bumblebee # Card power state at exit. Set to false if the card shoud be ON when Bumblebee # server exits. TurnCardOffAtExit=false # The default behavior of '-f' option on optirun. If set to "true", '-f' will # be ignored. NoEcoModeOverride=false # The Driver used by Bumblebee server. If this value is not set (or empty), # auto-detection is performed. The available drivers are nvidia and nouveau # (See also the driver-specific sections below) Driver=nvidia # Directory with a dummy config file to pass as a -configdir to secondary X XorgConfDir=/etc/bumblebee/xorg.conf.d ## Client options. Will take effect on the next optirun executed. [optirun] # Acceleration/ rendering bridge, possible values are auto, virtualgl and # primus. Bridge=auto # The method used for VirtualGL to transport frames between X servers. # Possible values are proxy, jpeg, rgb, xv and yuv. VGLTransport=proxy # List of paths which are searched for the primus libGL.so.1 when using # the primus bridge PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/primus:/usr/lib32/primus # Should the program run under optirun even if Bumblebee server or nvidia card # is not available? AllowFallbackToIGC=false # Driver-specific settings are grouped under [driver-NAME]. The sections are # parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto- # detection resolves to NAME). # PMMethod: method to use for saving power by disabling the nvidia card, valid # values are: auto - automatically detect which PM method to use # bbswitch - new in BB 3, recommended if available # switcheroo - vga_switcheroo method, use at your own risk # none - disable PM completely # https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods ## Section with nvidia driver specific options, only parsed if Driver=nvidia [driver-nvidia] # Module name to load, defaults to Driver if empty or unset KernelDriver=nvidia PMMethod=auto # colon-separated path to the nvidia libraries LibraryPath=/usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/i386-linux-gnu/nvidia:/usr/lib/nvidia:/usr/lib/nvidia-331 # comma-separated path of the directory containing nvidia_drv.so and the # default Xorg modules path XorgModulePath=/usr/lib/nvidia-331,/usr/lib/xorg/modules XorgConfFile=/etc/bumblebee/xorg.conf.nvidia ## Section with nouveau driver specific options, only parsed if Driver=nouveau [driver-nouveau] KernelDriver=nouveau PMMethod=auto XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
The important changes to check for here are the path to the nvidia driver libraries. In this case we are using nvidia-331, therefore all paths will have to be changed from nvidia-current to nvidia-331. Make sure the driver set in [bumblebeed] section is set to nvidia. The driver selection should be automatic, but since we have an nVidia chipset and driver that we want to use, specifying nvidia is OK.
Editing /etc/bumblebee/xorg.conf.nouveau
Open the file with sudo as follows:
$ sudo gedit /etc/bumblebee/xorg.conf.nouveauAnd change the contents of the file to match the following.
Section "ServerLayout" Identifier "Layout0" Option "AutoAddDevices" "false" Option "AutoAddGPU" "false" EndSection Section "Device" Identifier "DiscreteNvidia" Driver "nouveau" # If the X server does not automatically detect your VGA device, # you can manually set it here. # To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data # as you see in the commented example. # This Setting is needed on Ubuntu 13.04. BusID "PCI:2:0:0" EndSection
Editing /etc/bumblebee/xorg.conf.nvidia
Open the file with sudo as follows:
$ sudo gedit /etc/bumblebee/xorg.conf.nvidiaAnd change the contents of the file to match the following.
Section "ServerLayout" Identifier "Layout0" Option "AutoAddDevices" "false" Option "AutoAddGPU" "false" EndSection Section "Device" Identifier "DiscreteNvidia" Driver "nvidia" VendorName "NVIDIA Corporation" # If the X server does not automatically detect your VGA device, # you can manually set it here. # To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data # as you see in the commented example. # This Setting may be needed in some platforms with more than one # nvidia card, which may confuse the proprietary driver (e.g., # trying to take ownership of the wrong device). Also needed on Ubuntu 13.04. BusID "PCI:2:0:0" # Setting ProbeAllGpus to false prevents the new proprietary driver # instance spawned to try to control the integrated graphics card, # which is already being managed outside bumblebee. # This option doesn't hurt and it is required on platforms running # more than one nvidia graphics card with the proprietary driver. # (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT). # If this option is not set, the new Xorg may blacken the screen and # render it unusable (unless you have some way to run killall Xorg). Option "ProbeAllGpus" "false" Option "NoLogo" "true" Option "UseEDID" "false" Option "UseDisplayDevice" "none" EndSection
Considerations on specifying BusID in both files
When running lspci in order to get the BusID, keep in mind that the output will not be in the format the configuration file expects.
$ lspci | egrep 'VGA|3D' 00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06) 02:00.0 3D controller: NVIDIA Corporation GK107M [GeForce GT 750M] (rev ff)In this particular case, the BusID from lspci is 02:00.0. However it translates into PCI:2:0:0 in the configuration file.
Fixing the libturbojpeg issue
In Ubuntu 13.10 (Saucy Salamander), it seems that the libturbojpeg.so filename has changed from libturbojpeg.so to libturbojpeg.so.0 and this breaks Bumblebee. Below you'll find a quick fix for this issue. The error you might get without this fix appears below.
Error while loading shared libraries: libturbojpeg.so: cannot open shared object file: No such file or directory
If this occurs on your Ubuntu 13.10 Saucy Salamander laptop, fix it by using the following command:
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
Testing Bumblebee
After all configuration changes and fixes have been completed, reboot your system. In order to test bumblebee, run any of the following command(s).
$ optirun glxgears $ optirun glxspheres $ primusrun glxgears $ primusrun glxspheres
A note on running nvidia-settings
Do not try to run nvidia-settigs using “optirun nvidia-settings”. The nvidia driver is not active and it will not behave like a primary nvidia display. If you run the command, nvidia settings will come up, but it will say that no card was detected, and it might create an /etc/X11/xorg.conf file, which is not desirable, as an incorrect xorg.conf file will affect your bumblebee configuration. To run nvidia-settings and have it recognize your nvidia chipset, run:
optirun nvidia-settings -c :8Again, this will bring up the properties for the nvidia virtual display, but I do not seem to be able to configure multimonitor support here. More information will be added as this is achieved.
Fixing VDPAU
You may get this error when trying to run nvidia-settings as shown above.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
This is because nvidia-settings is trying to look for the VDPAU library in /usr/lib/vdpau. However, with nvidia-331, the vdpau libraries live in /usr/lib/nvidia-331/vdpau. In order to fix this, do the following. Remember to change this link if the nvidia driver is ever updated to a version different than 331.
sudo ln -s /usr/lib/nvidia-331/vdpau/libvdpau_nvidia.so.1 /usr/lib/vdpau/libvdpau_nvidia.so.1
Sources
https://wiki.ubuntu.com/Bumblebee
http://askubuntu.com/questions/360820/cant-install-bumblebee-on-ubuntu-13-10
http://ubuntuforums.org/showthread.php?t=1701074
http://ubuntuforums.org/showthread.php?t=2043971
http://www.webupd8.org/2013/10/fix-bumblebee-libturbojpegso-issue-in.html
https://wiki.archlinux.org/index.php/bumblebee
http://linuxg.net/how-to-fix-the-bumblebee-installation-error-on-ubuntu-13-10-saucy-salamander/
http://askubuntu.com/questions/61792/you-do-not-appear-to-be-using-the-nvidia-x-serverscreenshot-included
http://askubuntu.com/questions/285885/primus-failed-to-load-libraries-in-raring
https://ask.fedoraproject.org/question/29138/failed-to-open-vdpau-backend-libvdpau_nvidiaso-cannot-open-shared-object-file-no-such-file-or-directory/