Computer hangs using NVIDIA driver after bad uninstall/install, 940MX

For a period, I had the graphics-drivers PPA added, with the 415 driver installed. I wanted to go back to the proprietary driver I had before, the 390 driver, but I made a mistake in removing the PPA before switching back. During the switching process, Ubuntu gave an error message (unfortunately I don’t recall the error message, but it said something about cache).

After restarting my ststem, the boot process would be stuck on a flood of “Starting NVIDIA persistence daemon” and “Stopping NVIDIA persistence daemon” messages, and to get a successful boot I needed to enter recovery mode and prime-select intel.

If I enter nvidia-settings into the terminal whilst using nvidia-driver-390, the system hangs. It also hangs if I run nvidia-bug-report.sh, with the .log.gz generated only containing the following:

____________________________________________

Start of NVIDIA bug report log file.  Please include this file, along
with a detailed description of your problem, when reporting a graphics
driver bug via the NVIDIA Linux forum (see devtalk.nvidia.com)
or by sending email to 'linux-bugs@nvidia.com'.

nvidia-bug-report.sh Version: 23805530

Date: Tue 26 Feb 16:29:05 GMT 2019
uname: Linux u-rdm 4.18.0-15-generic #16~18.04.1-Ubuntu SMP Thu Feb 7 14:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
command line flags:

/var/log/nvidia-installer.log contains the following:

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Fri Dec 14 16:54:37 2018
installer version: 410.78

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

nvidia-installer command line:
    ./nvidia-installer

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 410.78.
-> 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 www.nvidia.com.

Running dpkg -l | grep nvidia gives me the following:

ii  libnvidia-cfg1-390:amd64                   390.77-0ubuntu0.18.04.2                      amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-390                       390.77-0ubuntu0.18.04.2                      all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-390:amd64                390.77-0ubuntu0.18.04.2                      amd64        NVIDIA libcompute package
ii  libnvidia-compute-390:i386                 390.77-0ubuntu0.18.04.2                      i386         NVIDIA libcompute package
ii  libnvidia-decode-390:amd64                 390.77-0ubuntu0.18.04.2                      amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-390:i386                  390.77-0ubuntu0.18.04.2                      i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-390:amd64                 390.77-0ubuntu0.18.04.2                      amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-390:i386                  390.77-0ubuntu0.18.04.2                      i386         NVENC Video Encoding runtime library
ii  libnvidia-fbc1-390:amd64                   390.77-0ubuntu0.18.04.2                      amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-390:i386                    390.77-0ubuntu0.18.04.2                      i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-390:amd64                     390.77-0ubuntu0.18.04.2                      amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-390:i386                      390.77-0ubuntu0.18.04.2                      i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-ifr1-390:amd64                   390.77-0ubuntu0.18.04.2                      amd64        NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  libnvidia-ifr1-390:i386                    390.77-0ubuntu0.18.04.2                      i386         NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  nvidia-compute-utils-390                   390.77-0ubuntu0.18.04.2                      amd64        NVIDIA compute utilities
ii  nvidia-dkms-390                            390.77-0ubuntu0.18.04.2                      amd64        NVIDIA DKMS package
ii  nvidia-driver-390                          390.77-0ubuntu0.18.04.2                      amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-390                   390.77-0ubuntu0.18.04.2                      amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-390                   390.77-0ubuntu0.18.04.2                      amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.8.2                                      all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            390.77-0ubuntu0.18.04.1                      amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-390                           390.77-0ubuntu0.18.04.2                      amd64        NVIDIA driver support binaries
ii  xserver-xorg-video-nvidia-390              390.77-0ubuntu0.18.04.2                      amd64        NVIDIA binary Xorg driver

Any help in resolving this would be greatly appreciated.

  1. Force uninstall everything nvidia related.
  2. Reinstall mesa* and xorg* packages.
  3. Install the desired driver release.

Ubuntu forums might help you better since your issue is not related to NVIDIA drivers per se.