You're probably here because XUbuntu 14.10 worked with bumblebee out of the box, but 16.04 LTS does not.
The T440p has an in-built NVidia GT 730M, running on Optimus through an Intel HD 4600. It's a beast of a laptop, but getting bumblebee going is rather a pain. This guide may very well work for laptops other than Lenovo-branded slabs, but I've only tested it on my T440p so your mileage may vary.
So, first things first...
1. Install a fresh copy of XUbuntu 16.04 LTS
2. Update Package Lists
Got to make sure we can pull packages.
3. Remove nouveau
I never liked nouveau. It always had sub-standard performance. While I love open-source drivers, the fact that NVidia's drivers always do better in terms of compatibility and frame-rate is reason enough to get rid of that sucka! I just want to play games ...
4. Install bumblebee, primus and NVidia Drivers
You'll notice that our command includes everything in order. By default, installing bumblebee-nvidia will install the crappy old 304.x drivers. We don't want this. This is why we're specifying 361.x in the same apt-get line. 361.x drivers are recognised as a substitute for the 304.x ones, and apt-get will not install the old ones if we explicitly tell it we want the new ones as a substitute.
5. Blacklist NVidia Drivers
Do not reboot until you have done this. Rebooting after installing drivers but before blacklisting them will result in a black-screen and you'll have to enter through recovery mode to blacklist them. In fact, don't reboot unless it explicitly says to.
Add these lines:
To your /etc/modprobe.d/bumblebee.conf. I like to put it at the end of the file so that it's the same as the rest of the file because I'm crazy:
6. Update bumblebee Config to Point to 361.x Drivers
This appears to actually be a bug in Ubuntu. By default bumblebee-nvidia installs a config file that points to nvidia-current, but that directory is empty, and not because we chose 361.x as opposed to the default version that the package lists (304.x) as a dependency, even that does not link itself to nvidia-current. We're going to point ours to 361.x. Change the following fields to the following values in /etc/bumblebee/bumblebee.conf:
7. Select Mesa as your GL Provider
Update your alternatives to point all GL providers to mesa. We actually want mesa, because this will indeed be your provider. By default, all of your GL will run on the Intel card, and this will run through mesa. Only through optirun/primusrun will things be handled by the NVidia GL implementation.
This is important!
9. Disable gpu-manager
The ubuntu-drivers-common package installs this thing called gpu-manager. It's started by /etc/init/gpu-manager.conf, which is run by upstart, but what it does is actually creates a new /etc/X11/xorg.conf every time you shut-down/reboot your laptop. We need to disable it, because the xorg.conf it creates will break our setup. Add nogpumanager to your /etc/default/grub file.
Now update your grub menu.
10. Re-build the bbswitch and nvidia modules.
Now that all of the LD paths are refreshed after a reboot, we can re-build the modules. Something goes wrong during the install that requires this. I presume it's to do with ldconfig not finding the right paths. Also, do not reboot again until this step is complete. Doing so will result in a black screen.
Okay. Now you may ...
Yes, again. Yes, you have to.
12. Test it
glxinfo will tell you if the provider of your GL is the NVidia proprietary driver, and glxgears will test rendering through that provider.
Note: Black Screen, Xorg not Starting.
If the next time you reboot you get a black screen, or Xorg doesn't start and drops you shell, or the screen is flickering between the console and a black screen, then chances are the gpu-manager has created an /etc/X11/xorg.conf. Just enter the recovery mode in the GRUB menu, and delete (rm) the file.