Search This Blog

Friday, March 13, 2015

How to install Bumblebee on Ubuntu 15.04/14/04 and Derivatives on Laptops with Optimus Nvidia Cards

How to install Bumblebee on Ubuntu 15.04/14/04 and Derivatives on Laptops with Optimus Nvidia Cards

Nvidia Optimus technology is something that is not completely supported out of the box. I have recently purchased a Lenovo Z50 laptop which has a 2GB NVIDIA GE FORCE GT820M. This is an entry level gaming card but can play most games without issues.

So I was happy with my purchase. Since I am a Linux Power User I immediately got rid of Windows and installed Ubuntu on it. However to my surprise I always got a black screen after installing Nvidia proprietary drivers.

Bumblebee would also throw errors . After 2 weeks or breaking my head against the wall an formatting my laptop 5 times now I am back. I have been able to successfully install the nvidia drivers and configure bumblebee as well.


Below are the steps I took to get things working for myself. I am sharing this to make things easier for others.

1) Install Bumblebee from the Official Ubuntu Repositories.

Sudo apt-get install bumblebee bumblebee-nvidia  --– This installs bumblebee.
dkms status-- This tels whch ersion of bbswitch and kernel is installed
sudo apt-get install bbswitch-dkms - Install bbswitch dkms
sudo apt-get install primus
sudo systemctl enable bumblebeed ( Ubuntu 15.04 Since it uses systemd now)
sudo gpasswd -a $USER bumblebee

2) Add the following lines to the /etc/modules file

I am using Ubuntu 15.04 beta and it has switched to Systemd so I have added these two into this file.

3) Now We need to blacklist nouveau module, we need to do it event though we might need to use it later. This is important we want only bbswitch to load either the nouveau or nvidia drivers
/etc/modprobe.d/nouveau.conf OR /etc/modprobe.d/blacklist-nouveau.conf
just add one line to any of these files

blacklist nouveau

4) Reboot and then run
sudo cat /proc/acpi/bbswitch this shoud give a result as OFF

sudo echo ON > /proc/acpi/bbswitch

sudo cat /proc/acpi/bbswitch This should now give a result of ON

This confirms that BBSWITCH works.

6) One more reboot

Once rebooted if you run the command
primusrun glxinfo | grep OpenGL

You would see the OpenGL String points to
OpenGL vendor string: nouveau

This confirms that bumblebee is working fine and able to load the nouveau driver fine.

NOTE no need to edit the /etc/bumblebee/bumblebee.conf file as of yet as it is already configured for using nouveau drivers.

7) Now the really tricky part. Which means We need to install the Proprietary NVIDIA Drivers which Will override the nuoveau drivers.



Contents of this file are

sudo cat /etc/modprobe.d/bumblebee.conf
# installed by bumblebee-nvidia
# to be used by kmod / module-init-tools, and installed in /etc/modprobe.d/
# or equivalent

# do not automatically load nouveau as it may prevent nvidia from loading
blacklist nouveau
# do not automatically load nvidia as it's unloaded anyway when bumblebeed
# starts and may fail bumblebeed to disable the card in a race condition.
blacklist nvidia
blacklist nvidia-current
blacklist nvidia-current-updates
# 304
blacklist nvidia-304
blacklist nvidia-304-updates
blacklist nvidia-experimental-304
# 310
blacklist nvidia-310
blacklist nvidia-310-updates
blacklist nvidia-experimental-310
# 313
blacklist nvidia-313
blacklist nvidia-313-updates
blacklist nvidia-experimental-313
# 319
blacklist nvidia-319
blacklist nvidia-319-updates
blacklist nvidia-experimental-319
# 325
blacklist nvidia-325
blacklist nvidia-325-updates
blacklist nvidia-experimental-325
# 331
blacklist nvidia-331
blacklist nvidia-331-updates
blacklist nvidia-experimental-331
# 334
blacklist nvidia-334
blacklist nvidia-334-updates
blacklist nvidia-experimental-334
# 337
blacklist nvidia-337
blacklist nvidia-337-updates
blacklist nvidia-experimental-337
# 340
blacklist nvidia-340
blacklist nvidia-340-updates
blacklist nvidia-experimental-340
blacklist nvidia-343
blacklist nvidia-343-updates
blacklist nvidia-experimental-343

This is a problem specific to Ubuntu and its derivatives only.(Sorry for this earlier I posted that one needs to uncomment the Driver in above file which is not true.)

So if you see the contents of this file reveal that no matter what you do you can't get succes in getting bumbleebee work with any of the nvidia drivers unless you Ensure that your Driver is listed above and blacklisted.

This will ensure that the driver Is not loaded automatically. If it loads automatically, you will have a BLACK SCREEN at boot.

Bumblebee needs to be controlling the Loading and Unloading of the NVIDIA DRIVER MODULE.

Or example i am using the 340 series of drivers so My drivers were already blacklisted.

blacklist nvidia-340
blacklist nvidia-340-updates
blacklist nvidia-experimental-340

Now you can edid the bumblebee.conf as below.

Sudo gedit /etc/bumblebee/bumblebee.conf

1. line 22:


2. line 55:


3. line 58:


4. line 61:


5. Reinstall bbswitch-dkms:

sudo apt-get install --reinstall bbswitch-dkms

6. Reboot

NOTE :- You neeed to make sure that you place the nvidia-331 with whatever driver version you have installed in previous steps and the one you uncommented from the bbswitch.conf file under /etc/modprobe.d/bumblebee.conf

In my case below is what my bumblebee.conf looks like.

# 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.
# The secondary Xorg server DISPLAY number
# 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.
# The name of the Bumbleblee server group name (GID name)
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
# 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)
# Directory with a dummy config file to pass as a -configdir to secondary X

## Client options. Will take effect on the next optirun executed.
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
# List of paths which are searched for the primus when using
# the primus bridge
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?

# 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

## Section with nvidia driver specific options, only parsed if Driver=nvidia
# Module name to load, defaults to Driver if empty or unset
# colon-separated path to the nvidia libraries
# comma-separated path of the directory containing and the
# default Xorg modules path

## Section with nouveau driver specific options, only parsed if Driver=nouveau

So please make changes to your files accordingly..

Now the final Reboot.

After the reboot you can now test

Run the command

primusrun glxinfo | grep OpenGL

primusrun glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 820M/PCIe/SSE2
OpenGL core profile version string: 4.4.0 NVIDIA 340.76
OpenGL core profile shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.4.0 NVIDIA 340.76
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:

So now my Laptop is using the Nvidia Optimus technology with the 340 Series Nvidia Proprietary Driver.

I Hope this helps people..

I have used the below two articles to reach this solution.

My OS :- Ubuntu 14.04.2

Laptop :- Lenovo Z50
Nvidia:- GE GFORCE GT 820M
COREI5 4th gen with Haswell graphics.

Rajat Pandita

No comments:

Post a Comment