5

system update error message: the package system is broken Check if you are using third party repositories. If so disable them, since they are a common source of problems. Furthermore run the following command in a Terminal: apt-get install -f when i try sudo apt-get istall -f i get an error message :

(Reading database ... 172407 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_i386.deb ...
diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 by libnvidia-gl-390'
  found 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_i386.deb (--unpack):
 new libnvidia-gl-390:i386 package pre-installation script subprocess returned error exit status 2
Preparing to unpack .../libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_amd64.deb ...
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 /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_amd64.deb (--unpack):
 new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_i386.deb
 /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

how can i fix this ?

2 Answers2

4

First Delete the .deb using

sudo rm /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_i386.deb

sudo rm /var/cache/apt/archives/libnvidia-gl-390_390.59-0ubuntu0~gpu18.04.1_amd64.deb

then erase all of the downloaded files in your cache.

sudo apt-get clean
sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install -f
sudo apt-get update

Finally try to install fresh copy of your application using sudo apt-get install

Jorge Castro
  • 73,907
2

The relevant part of the error message is this:

when removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 by libnvidia-gl-390'
  found 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'

"Diversions" are a dpkg thing. The Nvidia-340 package must have created these diversions and never removed them. To check, do

dpkg-divert --list nvidia-340

and it will list each diversion specified.

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
...

You can remove these diversions by passing the diverted filename to (needs root)

dpkg-divert --remove /usr/lib/x86_64-linux-gnu/libGL.so.1

Once you've cleaned up the old diversions, installing the newer Nvidia driver packages with apt should succeed.

ThunderBird
  • 1,963