Ubuntu – Correct steps to install NVidia driver + CUDA after fresh install of Ubuntu Desktop 16.04.02 LTS

16.04cudadriversgraphicsnvidia

I've just downloaded Ubuntu Desktop 16.04.02 LTS and made a fresh install.
Step by step, how should I install the NVidia driver + CUDA?

From lspci output:

VGA compatible controller: NVIDIA Corporation GK106 **[GeForce GTX 660]** (rev a1)

I haven't tried to install the NVidia driver at all, yet. Apart from updating, I have only dowloaded Blender 2.78c from blender.org and manually extracted it to my home folder, and I have installed FlightGear 2017.1.2 from an additional repository.

With both applications, the desktop freezes permanently just a few seconds or a few minutes after startup, except for the mouse cursor. Maybe it's the Nouveau driver, I don't know and I'm not addressing that issue here, either, because I need CUDA anyway.)

It's not a UEFI machine => maybe more chances.

I went to the NVidia support website in order to see what version it is.

I also downloaded the .run NVidia file but did not launch it, instead I installed the corresponding package:

sudo apt install nvidia-375

The installation procedure finished with no apparent accident and I got the terminal prompt back.

Maybe I should have issued the command which is reported to be critical in various threads:

sudo nvidia-xconfig

Well, I didn't, not to risk messing up with the installation procedure in case it had been fixed by now to a fully automatic procedure.

First reboot => boot manager OK, then the LUKS pass phrase input field appeared but my input was not being displayed with bullet chars as usual. Ctrl-alt F1…F6: black screen. Ctrl-alt F7: black screen with my passphrase on the top line.

Second reboot => boot manager OK, then not even the LUKS passphrase input screen, just black screen, ctrl-alt F1…F7 => black screen.

I'm going to reinstall from scratch right now then give it another try issuing that further nvidia-xconfig command after installing the package.

Best Answer

(Addition to my earlier answer.)

I can now avoid booting through recovery mode.

The problem was only with the input of the hard disk encryption pass phrase. The workaround was to avoid the "quiet" boot, I found how to do it on this page:
Boot into the command line console in Ubuntu 16.04

The minimal change to /etc/default/grub was to replace

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

with

GRUB_CMDLINE_LINUX_DEFAULT="text"

then run

sudo update-grub

This gives small text (more info on the screen). You can uncomment GRUB_TERMINAL=console to have "normal" text mode (less memory used presumably).

GRUB_CMDLINE_LINUX="text" doesn't seem to be indispensable.


That web page also describes

  • how to boot to text mode and eventually start up the graphic mode afterwards
  • how to set the default mode back to graphic

Booting into text mode can be interesting to leave free the maximum possible amount of video memory, for instance for Blender to GPU render animations in scenes with high resolution HDR environments, of course after using graphic mode and CPU render to setup the scene and create the animation (possibly checking it with OpenGL render to speed up the process).


I have no solution for the corrupted windows frames after suspend-resume, yet. The nvidia driver I'm using is still the most recent, apparently.

EDIT: that is now solved.

A software upgrade applied 2017-vi-02 included a new NVidia driver, 375.66, and new LibCuda version. Automated installation was straightforward, Blender and FlightGear still work perfectly fine, and I can now suspend and resume without having to kill gnome-session or logout and in again.

I only see "garbage" - meaning corrupted graphics - during a couple of seconds on resume on the left of the screen where the auto-hide launcher would appear by moving the mouse cursor there, but the "garbage" disappears without having to go anything.

(I'm still not using the "quiet" boot so I can't tell if the keyboard input of the hard drive encryption pass phrase would now work fine with it.)


Err... sorry I'm a newbie in ask ubuntu: now how do I close this... "issue"? Should I "accept" any answer here? THANKS A LOT AGAIN FOR ALL YOUR REPLIES.

EDIT: I selected this post as the one which carries the information which was most useful to me.