These are just the installation notes of Kubuntu 14.04.5 with the Bumblebee subsystem.

https://wiki.ubuntu.com/Bumblebee
https://github.com/Bumblebee-Project/Bumblebee/wiki/Troubleshooting
http://hemenkapadia.github.io/blog/2016/05/07/Ubuntu-with-Nvidia-Bumblebee.html

(kernel parameters, edit /etc/default/grub)

GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=\"Windows 2015\" acpi_backlight=vendor pci=nomsi intel_pstate=disable psmouse.proto=imps i915.enable_execlists=0 i915.semaphores=1"
GRUB_TERMINAL=console
# update-grub
# reboot
# apt-get update
# apt-get install build-essential
# echo manual > /etc/init/gpu-manager.override
# apt-get install nvidia-367
# reboot

# apt-get install bumblebee bumblebee-nvidia primus
# reboot

# stop lightdm

(edit /etc/X11/xorg.conf)

    Screen 0 "intel"
    Inactive "nvidia"

# start lightdm

# prime-select intel
# rm /etc/X11/xorg.conf
# reboot

(test)

# apt-get install mesa-utils inxi

$ glxinfo | grep "OpenGL vendor"
OpenGL vendor string: Intel Open Source Technology Center

$ primusrun glxinfo | grep "OpenGL vendor"
OpenGL vendor string: NVIDIA Corporation

$ inxi -Gx
Graphics:  Card: Intel Sky Lake Integrated Graphics bus-ID: 00:02.0 X.Org: 1.18.3 driver: intel Resolution: 1920x1080@60.1hz 
           GLX Renderer: Mesa DRI Intel HD Graphics 520 (Skylake GT2) GLX Version: 3.0 Mesa 11.2.0 Direct Rendering: Yes

$ primusrun inxi -Gx
Graphics:  Card: Intel Sky Lake Integrated Graphics bus-ID: 00:02.0 X.Org: 1.18.3 driver: intel Resolution: 1920x1080@60.1hz 
           GLX Renderer: GeForce 920M/PCIe/SSE2 GLX Version: 4.5.0 NVIDIA 367.57 Direct Rendering: Yes

$ dmesg | grep bbswitch
[    7.356588] bbswitch: version 0.7
[    7.356594] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[    7.356600] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.RP01.PXSX
[    7.356708] bbswitch: detected an Optimus _DSM function
[    7.356719] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
Advertisements