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.

  • Last time I had to use Software & Updates (software-properties-gtk), Additionnal Drivers. Lauch it directly, not from Synaptic. They interfere with each other. – Jean-Marie Mar 23 '17 at 16:59
  • We need to know the exact Nvidia model in order to know what drivers to install. It seems you've been trying with wrong driver versions, as usual (you are not alone). Please edit your question accordingly. – user589808 Mar 23 '17 at 18:18

(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




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.

| improve this answer | |

Check out this question. I've posted a similar answer there.

The traditional way to install Nvidia driver would be something like this:

  1. Download the Nvidia driver you want.
  2. Disable the original graphic driver.
  3. Install the Nvidia driver.
  4. Restart your computer.

This is somewhat troublesome and I found out a new way to do so by using ppa graphics-drivers (official website). All the installation procedure can be done on the command line. The procedures:

  1. On your Ubuntu, open up a terminal and type sudo add-apt-repository ppa:graphics-drivers/ppa, sudo apt-get update.
  2. After that, you may visit the ppa's offical website to figure out which driver you want based on your hardware (i.e. GPU) version. You can install a driver by typing sudo apt-get install nvidia-graphics-drivers-304 for example.
  3. When the installation finished, reboot the computer. Open up a terminal and type nvidia-smi to see if the driver is working. I've not tested CUDA using this method but it should be installed.

Also check this question.

| improve this answer | |
  • Thank you. That thread also mentions ubuntu 17.04 beta 2, I might just wait for the release and reinstall from scratch. – JazzTp Mar 31 '17 at 2:15

Killing compiz, will sometimes generate a problem report for me, but not always. I suppose there are other things to kill/restart, like lightdm, or even just logout/login, but for me, the compiz restart is only a few seconds at most, and Firefox and teminal recover without problems). You could drop back to earlier Nvidia versions offered by the software updater, like 340 or 304, but I don't know what problems that would cause CUDA.

I tested the 340 driver under 16.10, dropping back from 375, and that did not work with CUDA. I'd guess the 304 driver is also not CUDA capable. Since none of the offered additional drivers work with CUDA, you might try Byte Commander's solution strange-artifacts-along-window-borders-after-waking-from-suspend of adding a ppa and installing a driver which works (370 for him, I was using 367).

A recent CUDA install on a fresh 16.40 system after the Nvidia drivers were running was trivial, download the Nvidia deb file, install it, run sudo apt-get update, and sudo apt-get install cuda. That installed the cuda libs and exes into the system areas, unlike the 16.04 system on which I installed everything locally. You then need to add the cuda bin to the beginning of your PATH, and the CUDA lib to LD_LIBRARY_PATH, copy the cuda samples from /usr/local/cuda to some writeable directory.

If necessary, (like under 16.10), install gcc-5 and g++-5 and change the links /usr/bin/gcc and /usr/bin/g++ to the 5 versions.

Then and try a make for one of the sample directories. Your Nvidia driver problem could be a leftover blacklist -- look at /etc/modprobe.d and see what's blacklisted in nvidia-graphics-drivers.conf. If the nvidia-375 is blacklisted, comment it out, or purge and reinstall all the nvidia drivers. I do have the nvidia-375-updates blacklisted, and CUDA works for me, on a legacy install on a UEFI machine with the cuda 8.0 and the Nvidia 375 driver.

| improve this answer | |
  • Thanks, going to analyze more all your answers. CUDA works, problems are 1) need of going through recovery mode at each boot 2) windows frames corrupted after suspend-resume. Updated => kernel 4.8.0-44, nothing changed. I'd post result of ls /etc/modprobe.d/and from inside that folder grep -i nvidia * and content of nvidia-graphics-drivers.conf, but in a comment it would be a mess. Still hoping updates solve it. I would not like to mess up, I'm coming from another distribution which ended up being not upgradeable (by installing the NVidia driver + CUDA through a third party app). – JazzTp Mar 31 '17 at 2:07

NVidia driver running fine AFTER I go through recovery boot mode, each time.

Blender finds and uses CUDA.

Flightgear runs fine.

(The system has not frozen so far, which might corroborate that the problem was related to the Nouveau driver.)

HOW (please notice that this is not a UEFI machine, if it matters):

  • Reinstalled from scratch (the first time only, then I have to go through recovery each time I boot).
  • Ran the Software Updater
  • sudo apt install nvidia-375 (the driver I had found to be the most recent stable one for this card, on the NVidia website)
  • Probably not relevant, ctrl-alt-F1 and logged into text tty just in case the following would start some mode probe which might cause the process to abort if launched from graphics mode, then:
    sudo nvidia-xconfig (I issued it two times actually, the first one it complained about not finding the config file so I wanted to be sure that it had actually created one)
  • Reboot => exactly as before: first reboot => passphrase input screen but no bullet chars, second reboot => black screen
  • ctrl-alt-del to reboot again
  • (Here's the part related to any time I boot.)
    At the boot manager screen, I choose the line which offers to input options, that brings to another menu, from which I choose to boot the most recent kernel in recovery mode
  • At any prompt of the recovery mode, two times, I choose to resume normal reboot (it said it would quit recovery mode but entered it again after the first time)
  • I get to the normal desktop (possibly after seeing the NVidia screen for a couple of seconds).

Of course I hope to find a solution to avoid going through recovery each time.

EDIT: resuming after suspend, windows in Gnome (even newly created ones) are surrounded by garbage. I can save open docs and restart Gnome, and everything is OK again, but the suspend feature, if you have to close everything, is not as useful, it permits me to avoid rebooting anyway.

To restart Gnome:

kill -9 $(pgrep gnome-session)

EDIT 2: updated => kernel 4.8.0-44, nothing changed.

| improve this answer | |
  • The windows boarder garbage is a problem with the 375 driver. I was using 367 with no problems until it updated. Bug was filed, workaround is to put a script in /lib/systemd/system-sleep/ to kill compiz kill $(ps -C compiz -o pid=) – ubfan1 Mar 27 '17 at 5:11
  • Thanks for replying. I don't know if I got it right, I've created a script in that folder: The command $ cat /lib/systemd/system-sleep/killcompiz produces this output kill $(ps -C compiz -o pid=) (How do I put a newline or a blank line into a comment here?) Garbage is still there after suspend and resume. If I run the same command from a terminal window, the top bar of the same window disappears, all windows freeze, and after 10-20 seconds the garbage disappears and the system mentions an internal error, offering to report about it. – JazzTp Mar 28 '17 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.