Nvidia Drivers – Nvidia Driver Installation Keeps Failing, Diversion Issues

driversgraphicsnvidia

I've had Nvidia drivers work successfully before.

I switched to Nouveau for a little while since a game wasn't working properly, then switched back to Nvidia only to be notified of an error.

I have uninstalled and re-installed the Nvidia driver multiple times now but keep getting the same errors.

diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 by libnvidia-gl-390'
  found 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /tmp/apt-dpkg-install-JJFsm3/13-libnvidia-gl-390_390.48-0ubuntu3_amd64.deb (--unpack):
new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2

Errors were encountered while processing:
 /tmp/apt-dpkg-install-JJFsm3/13-libnvidia-gl-390_390.48-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Installation method is sudo ubuntu-drivers autoinstall

Best Answer

Running sudo dpkg-divert --remove "/usr/lib/x86_64-linux-gnu/libGL.so.1" resolved my issue.

All thanks to @Terrance !

Related Question