I am running apt --fix-broken install. I get:

dpkg-divert: error: mismatch on package when removing 'diversion of /usr/lib/i386-linux-gnu.so.1 by libnvidia-gl-390'
found 'diversion of /usr/lib/i386-linux-gnu.so.1 to /usr/lib/i386-linux-gnu.so.1.distrib by nvidia-340

(also other stuff but let's take it one step at a time)

Aha! Thinks I; I'll remove nvidia-340 then, except ...

apt remove nvidia-340
Package 'nvidia-340' is not installed, so not removed

How do I remove diversion errors from packages that look to me at though they aren't installed? What am I missing?

1 Answer 1


Looks like this is a bug with Ubuntu. package libnvidia-gl-390 (not installed) failed to install/upgrade: new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2 (NOT FIXED)

The workaround I did was #5, Yuri's improvement of Alexandre's suggestion


# for FILE in $(dpkg-divert --list | grep nvidia-340 | awk '{print $3}'); do echo $FILE; done

first and choose the correct number for substring {print $3}

For example for Russian locale it will be $2:

# for FILE in $(dpkg-divert --list | grep nvidia-340 | awk '{print $2}'); do dpkg-divert --remove $FILE; done

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.