This worked perfectly on a Asus Zenbook Pro Ux501Jw running GTX 960M in secondary GPU mode (Optimus).
Steps:-
1. First step after installing Ubuntu is to install all updates. You may use the software updater or simply run:
sudo apt-get update && sudo apt-get upgrade
2. Add the Xorg-edgers ppa using
sudo apt-add-repository ppa:xorg-edgers/ppa
sudo apt-get update
Important Step =>
sudo apt-get upgrade && sudo apt-get dist-upgrade
3. Now Install bumblebee and Nvidia drivers using
sudo apt-get install bumblebee bumblebee-nvidia primus nvidia-352
4. Add the current user to the bumblebee security group.
sudo useradd -G bumblebee yourusername
For Ubuntu 15.04 only: you need to manually enable to bumblebee daemon using
sudo systemctl enable bumblebeed`
5. This will take care of the Installing the required software on your system. We need to configure it.We start by enabling bbswitch and intel i915 Driver.
sudo -H gedit /etc/modules
Ubuntu 15.04: the file is /etc/modules-load.d/modules.conf
Add these two lines to it
i915
bbswitch
6. Edit the bumblebee configuration file.
sudo -H gedit /etc/bumblebee/bumblebee.conf
1. line 22:
Driver=nvidia
2. line 55:
KernelDriver=nvidia-352
3. line 58:
LibraryPath=/usr/lib/nvidia-352:/usr/lib32/nvidia-352
4. line 61:
XorgModulePath=/usr/lib/nvidia-352/xorg,/usr/lib/xorg/modules
7. In addition to this there is another file that needs to edited.
sudo -H gedit /etc/modprobe.d/bumblebee.conf
Add this line at the end.
blacklist nvidia-352
Now you may reboot. After reboot, check using sudo apt-get install mesa-utils if mesa-utils is not already installed.
$> optirun glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GTX 960M/PCIe/SSE2 OpenGL core profile version string: 4.3.0 NVIDIA 352 OpenGL core profile shading language version string: 4.30 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.5.0 NVIDIA 352 OpenGL shading language version string: 4.50 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions:
This should tell you that nvidia-352 driver in use.
Please note that nvidia-352 is the latest driver at the time of writing this.
Abdridged from
http://askubuntu.com/questions/452556/how-to-set-up-nvidia-optimus-bumblebee-in-14-04