How to install sane graphics drivers for Nvidia Optimus hardware on *Ubuntu 16.04?

Solution 1:

What I did

1: First I ran lspci | grep VGA to check which Nvidia graphics card/chipset my computer is using.

2: Then I went to the nvidia driver website to check which graphics driver version I should install for Linux x86_64.

3: I added the graphics drivers ppa to my system sudo apt-add-repository ppa:graphics-drivers/ppa

4: Then sudo apt-get update

5: Then sudo apt-get install nvidia-367 but you your system it will be a different driver version depending on your result from Step 2!

... will now reboot to check if it worked...

Did it work?

Probably. I can login, but I needed to change my dual screen configuration again. Now that's done it seems to work alright. If anyone has any suggestion as to how I can check the performance of my system please leave a comment.

Edit: glxgears reports 13000 FPS. Not sure what it would be without the Nvidia driver.

Update - No it doesn't work!

I have a rather irritating problem which has rendered my system unusable. When browsing files, sometimes when changing directory there is a ~1 second delay before the window updates - this makes it difficult to browse files on the system quickly.

In addition, when typing in the terminal, there is an occasional delay/lag which prevents one from running commands efficiently and quickly.

Hence my system is "unusable".

What I am trying now.

0: Fresh install of xubuntu 16.04. apt-get update / upgrade

1: sudo apt-get install intel-microcode

2: Reboot

3: sudo apt-add-repository ppa:/graphics-drivers/ppa

4: sudo apt-get install nvidia-364 (not 367)

Just checked and laptop BIOS appears to have secure boot disabled.

5: Reboot

6: glxgears -info | grep "GL_" reports that glxgears is now running using Nvidia card

7: glxinfo | grep "OpenGL version" Also suggests nvidia card is functioning.

8: ... will update if graphics problems resurface...

Updates: Noticed graphics problems when switching into/out of screensaver. This was quite annoying so ran sudo apt-get remove nvidia-*, rebooted, then sudo apt-get install nvidia-361... hopefully this driver will be better...

nvidia-361 appears to have the same problem of screen tearing when scrolling with the file manager, as did driver version nvidia-367.

Will try nvidia-361-updates... Not hopeful however.

361 still has problems with file manager scrolling and tearing... Going to try 352

I have noticed that attempting to install version 352 causes apt-get to try and install nvidia-361 as an additional package... Not sure what has caused this or if I just didn't notice before...

Tried nvidia 340... Crashed when I tried to login, so removed all nvidia packages. This appears to be the correct method, however none of these drivers seem to play nicely with my system.


I came back to this some weeks later

... and followed this guide: http://lenovolinux.blogspot.co.uk/2016/05/bumblebee-on-lenovo-t440p-nvidia-gt.html?m=1

I was getting an error with optirun but with the additional command sudo apt-get remove xserver-xorg-legacy it seemed to work, however performance doesn't seem to be as good as it used to be with 14.04!