29
October
2025
20:48

Eliminating deviations when installing the nVidia video card driver

29 October 2025 20:48

Solving the problem when installing the nvidia-driver-390 driver using the dpkg-divert commands.

Background

В Linux Lite 20.04 (domestic OS based on Ubuntu with a lightweight interface) works at my home and I am happy with it (for AMD Phenom(tm) II X3 710). In the operating system for the GF119 [GeForce GT 610] video card, the nvidia-driver-390 driver was installed and worked perfectly. In the terminal I executed the command by mistake ubuntu-drivers install , которая удалила драйвер nvidia-driver-390 и попыталась установить ранее не выбранный пакет nvidia-340.

Reason

nvidia-340 is the recommended driver in Ubuntu.

sudo ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0 ==
modalias : pci:v000010DEd0000104Asv00001043sd0000847Bbc03sc00i00
vendor: NVIDIA Corporation
model : GF119 [GeForce GT 610]
driver: nvidia-340 - third-party non-free recommended
driver : nvidia-driver-390 - third-party non-free
driver : xserver-xorg-video-nouveau - distro free builtin

As a result of executing the command sudo ubuntu-drivers install, the nvidia-340 driver did not install due to the error:

dpkg: error processing archive /var/cache/apt/archives/nvidia-340_340.108-0ubuntu5.20.04.2_amd64.deb (--unpack):
trying to overwrite "/usr/bin/nvidia-bug-report.sh" which is already in package nvidia-utils-390 390.157-0ubuntu0.20.04.1
pkg-deb: ошибка: вставка subprocess was killed by signal (Обрыв канала)
Errors occurred while processing the following packages:
/var/cache/apt/archives/nvidia-340_340.108-0ubuntu5.20.04.2_amd64.deb

The nvidia-driver-390 driver also failed to install due to another error:

sudo apt install nvidia-driver-390

dpkg-divert: error: package mismatch
when uninstalling "/usr/lib/x86_64-linux-gnu/libGL.so.1 was rejected due to libnvidia-gl-390"
found "deviation of /usr/lib/x86_64-linux-gnu/libGL.so.1 in /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib due to nvidia-340"
dpkg: error processing archive /tmp/apt-dpkg-install-NZZNFn/04-libnvidia-gl-390_390.157-0ubuntu0.20.04.1_amd64.deb (--unpack):
new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2

So the command ubuntu-drivers install I uninstalled one driver and could not install another.

Trying to restore broken packages didn't help.

sudo apt --fix-broken install

dpkg-divert: error: package mismatch
when uninstalling "/usr/lib/x86_64-linux-gnu/libGL.so.1 was rejected due to libnvidia-gl-390"
found "deviation of /usr/lib/x86_64-linux-gnu/libGL.so.1 in /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib due to nvidia-340"

Solution

Studying errors

From the output of the commands I learned the reason - some “deviations” in the libraries:

sudo apt install nvidia-driver-390

dpkg-divert: error: package mismatch
_when deleted "deviation/usr/lib/x8664-linux-gnu/libGL.so.1 due to libnvidia-gl-390"
found "deviation...

I started looking into it and found out about a team I was unfamiliar with dpkg-divert.

Help about the program man dpkg-divert:

dpkg-divert- override package file version

--list glob-pattern
Список отклонений, соответствующих шаблону glob-pattern.

Listing deviations using dpkg-divert --list

dpkg-divert --list nvidia | grep nvidia-340

or like this:

If the system is healthy, the list should be empty. In my case, candidates for correction appeared:

dpkg-divert --list | grep nvidia-340

rejection of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib due to nvidia-340
rejecting /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib due to nvidia-340
rejecting /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1.distrib due to nvidia-340
rejecting /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.distrib due to nvidia-340
rejection of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib due to nvidia-340
rejection of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib due to nvidia-340
rejection of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libGLESv1_CM.so to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib due to nvidia-340
rejection of /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.distrib due to nvidia-340
rejection of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib due to nvidia-340
rejection of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib due to nvidia-340

Correction of deviations

I consistently corrected all the “deviations” using the commands:

sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libEGL.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGLESv2.so.2
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGLESv2.so.2
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libEGL.so.1
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGLESv2.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libEGL.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGL.so
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGL.so.1
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGL.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGLESv1_CM.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libEGL.so.1
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1
sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGLESv2.so
sudo dpkg-divert --remove --no-rename /usr/lib/i386-linux-gnu/libGL.so.1

I also corrected the main deviation:

sudo dpkg-divert --remove --no-rename /usr/lib/x86_64-linux-gnu/libGL.so

where are the keys:

--remove removes a deviation from a file...
--no-rename specifies to remove rather than rename the deviation (relevant for important packages that should reliably disappear from the dpkg database).

Package reinstallation: now successful

sudo apt install --reinstall libnvidia-gl-390

Reading package lists... Done
Building a dependency tree
Reading status information... Done
The following NEW packages will be installed:
libnvidia-gl-390

etc.

DKMS: install completed.
The package xserver-xorg-video-nvidia-390 (390.157-0ubuntu0.20.04.1) is being configured...
The package nvidia-driver-390 (390.157-0ubuntu0.20.04.1) is being configured...
Processing triggers for libc-bin (2.31-0ubuntu9.18) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for initramfs-tools (0.136ubuntu6.8) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-216-lowlatency
I: The initramfs will attempt to resume from /dev/sda7
I: (UUID=7a17fe7e-acee-4c19-8641-1fdd39d0364d)
I: Set the RESUME variable to override this.

Reboot

Now that the driver is installed and the video card driver has been added to the dkms kernel, I rebooted:

sudo shutdown --reboot now

sudo shutdown --halt now

or

sudo poweroff --reboot

sudo poweroff --halt

Result - 2D works

The OS has loaded and 2D graphics are working correctly.


Source:https://forum.ubuntu.ru/index.php?topic=301381.0


Addition: video acceleration library

Checking video acceleration: vainfo command

vainfo

There should be no errors, in my command output there is an error indicating that libva doesn't work.

libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

Made to speed up the video

sudo apt install mesa-va-drivers mesa-vdpau-drivers

Older Ununtu Linux requires vdpau-va-driver, which is not there.

sudo apt install vdpau-va-driver

E: No installation candidate was found for package 'vdpau-va-driver'.

Video acceleration solution for vdpau in Ubuntu 20.04

https://launchpad.net/ubuntu/cosmic/amd64/vdpau-va-driver/0.7.4-6ubuntu1

Command to install from the directory where the file is downloaded:

sudo dpkg -i vdpau-va-driver_0.7.4-6ubuntu1_amd64.deb

Checking vainfo

vainfo

Result:

libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
                     : VAEntrypointVLD
    VAProfileH264Main : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD

When you start playing FullHD video from any site, for example,Vimeo, CPU load 56%.

Then I applied the Mozilla Firefox setting to speed up the browser - article enabling hardware acceleration in the FireFox browser. Enabled the parameter media.hardware-video-decoding.enabled = true in about:config - processor load 50-65%.



Related publications