Broken Nvidia driver and package manager on Ubuntu 18.04
Linux - Laptop and NetbookHaving a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to make this properly, but I'm lacking experience so I'm not sure from where to start and how to fix first the package manager and second to properly make my video card to be working.
zutobg@zutobg-Latitude-E6220:~$ sudo apt-get clean
zutobg@zutobg-Latitude-E6220:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libnvidia-gl-390 libnvidia-gl-390:i386
The following NEW packages will be installed:
libnvidia-gl-390 libnvidia-gl-390:i386
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
3 not fully installed or removed.
Need to get 29,2 MB of archives.
After this operation, 149 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/restricted i386 libnvidia-gl-390 i386 390.132-0ubuntu0.18.04.1 [14,9 MB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 libnvidia-gl-390 amd64 390.132-0ubuntu0.18.04.1 [14,3 MB]
Fetched 29,2 MB in 8s (3601 kB/s)
(Reading database ... 202189 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-390_390.132-0ubuntu0.18.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.132-0ubuntu0.18.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.132-0ubuntu0.18.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.132-0ubuntu0.18.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.132-0ubuntu0.18.04.1_i386.deb
/var/cache/apt/archives/libnvidia-gl-390_390.132-0ubuntu0.18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Excuse my ignorance, but maybe my knowledge it too much basic. Your command is totally new to me. So I applied it.
Code:
zutobg@zutobg-Latitude-E6220:~$ dpkg-divert --list|LC_ALL=C awk '$NF=="nvidia-340",$0=$3'|xargs -L1 sudo dpkg-divert --remove
[sudo] password for zutobg:
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1.distrib by nvidia-340'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib by nvidia-340'
Removing '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'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv1_CM.so to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib by nvidia-340'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.distrib by nvidia-340'
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib by nvidia-340'
Removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
Then I did
Code:
zutobg@zutobg-Latitude-E6220:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libnvidia-ifr1-390 : Depends: libnvidia-gl-390 but it is not installed
libnvidia-ifr1-390:i386 : Depends: libnvidia-gl-390:i386 but it is not installed
nvidia-driver-390 : Depends: libnvidia-gl-390 (= 390.132-0ubuntu0.18.04.1) but it is not installed
Recommends: libnvidia-gl-390:i386 (= 390.132-0ubuntu0.18.04.1)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
The I run
Code:
zutobg@zutobg-Latitude-E6220:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libnvidia-gl-390 libnvidia-gl-390:i386
The following NEW packages will be installed:
libnvidia-gl-390 libnvidia-gl-390:i386
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
3 not fully installed or removed.
Need to get 0 B/29,2 MB of archives.
After this operation, 149 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 202161 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-390_390.132-0ubuntu0.18.04.1_i386.deb ...
Unpacking libnvidia-gl-390:i386 (390.132-0ubuntu0.18.04.1) ...
Preparing to unpack .../libnvidia-gl-390_390.132-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libnvidia-gl-390:amd64 (390.132-0ubuntu0.18.04.1) ...
Setting up libnvidia-gl-390:i386 (390.132-0ubuntu0.18.04.1) ...
Setting up libnvidia-gl-390:amd64 (390.132-0ubuntu0.18.04.1) ...
Setting up libnvidia-ifr1-390:amd64 (390.132-0ubuntu0.18.04.1) ...
Setting up libnvidia-ifr1-390:i386 (390.132-0ubuntu0.18.04.1) ...
Setting up nvidia-driver-390 (390.132-0ubuntu0.18.04.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Seems now my problem with package manager is solved. I really don't understand how and why. Can you explain me what we just did here? Thank you
I just followed the link that was given to you at askubuntu.com. OK, I've rewritten the command a bit, but it still does the same. If you follow through to the LP bug #1768050, you'll see another incantation of this command linked from there that takes additional precautions against filenames containing spaces:
Code:
LC_ALL=C dpkg-divert --list nvidia-340|sed -nr 's/^diversion of (.+) to .*/\1/p'|
xargs -d'\n' -n1 sudo dpkg-divert --remove
File divertions are dpkg's way to deal with a situation when two or more packages try to install a file to the same location. See dpkg-divert.
And don't forget to mark your thread solved. Both here and at askubuntu.com
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.