Problem installing NVIDIA 390.42 driver on Ubuntu 16.04

When trying to install the 390.42 driver version on Ubuntu 16.04 the next message shows:

the distribution-provided pre-install script failed!

I quit the installation and I haven’t found anything related to this issue. The log file for the installation contains this:

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Mon Mar 19 16:57:46 2018
installer version: 390.42

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

nvidia-installer command line:

Unable to load: nvidia-installer ncurses v6 user interface

Using: nvidia-installer ncurses user interface
-> Detected 8 CPUs online; setting concurrency level to 8.
-> Installing NVIDIA driver version 390.42.
-> Running distribution scripts
   executing: '/usr/lib/nvidia/pre-install'...
-> done.
-> The distribution-provided pre-install script failed!  Are you sure you want to continue? (Answer: Abort installation)
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.  You may find suggestions on fixing installation problems in the README available on the Linux driver download page at



# Trigger an error exit status to prevent the installer from overwriting
# Ubuntu's nvidia packages.

exit 1

Install the driver from ubuntu’s graphics ppa, not the .run installer.

nvidia really needs to get their stuff together! The only thing that work for me was the ppa, which is contrary to their own documentation. In fact when you go to download the 9.1 toolkit they say the following:

“Before installing the CUDA Toolkit on Linux, please ensure that you have the latest NVIDIA driver R390 installed”

But when you try to do that the 390.42 version causes the login loop on ubuntu 16.04. And when you you think that you have it working correctly and then follow the instructions for installing the toolkit from their website the installer removes 390.xx and replaces it with 387.xx! Seriously?

So, after struggling to wipe everything nvidia from the system (this was also a brand new ubuntu 16.04 install), here’s what worked for me:

  1. Install the cuda toolkit 9.1 and patches according the nvidia instructions
  2. sudo add-apt-repository ppa:graphics-drivers/ppa
  3. sudo apt update
  4. sudo apt install nvidia-390
  5. Finally install the cuDNN libraries using the nvidia instructions

This should put on the driver version 390.25 on to the system. And no login loop of death!

Thank you @davemers. that is what I did and it works now.

Bless your soul. This problem caused me so much frustration yesterday.

Glad I could help out. Trust me there were a lot of four letter words flying around when I was trying to get this working correctly.

@davemers thank you a lot!

Very helpful, ty. Would be good if the official docs could be updated to include this or the ppa packages uploaded to the nvidia area.

man you’re awesome million thanks !!! i just installed ubuntu without any freezes with your steps !!!

A heads-up warning:
The layout of the driver changed with Ubuntu 18.04. So mixing and over installing packages from <18.04 and >=18.04 will lead to a broken system.
Better procedure:

  • install driver fom ppa
  • download and add the cuda .deb (9.2)
  • don’t install cuda, instead use
    sudo apt install cuda-toolkit-9-2

thank you soooooooooooooooooooooooooooooooooooooooooooooooo much!!! You save my three weeks struggling

thank you