2

I wanted to install Nvidia drivers in ubuntu 18.04 but

In terminal

$ sudo ubuntu-drivers autoinstall 
  Reading package lists... Done
  Building dependency tree       
 Reading state information... Done
   The following NEW packages will be installed:
   nvidia-340
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 9 not fully installed or removed.
 Need to get 0 B/51.9 MB of archives.
 After this operation, 274 MB of additional disk space will be used.
(Reading database ... 277981 files and directories currently 
installed.)
Preparing to unpack .../nvidia-340_340.107-0ubuntu0.18.04.2_amd64.deb 
...
Adding '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'
Adding '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: rename involves overwriting '/usr/lib/i386-linux- 
gnu/libGL.so.1.distrib' with
different file '/usr/lib/i386-linux-gnu/libGL.so.1', not allowed
dpkg: error processing archive /var/cache/apt/archives/nvidia- 
340_340.107-0ubuntu0.18.04.2_amd64.deb (--unpack):
new nvidia-340 package pre-installation script subprocess returned 
error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-340_340.107-0ubuntu0.18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

it never installed I tried many commend but it won't fix

UPDATE

I have followed Installing nvidia drivers on 18.04 this link but still the result same

 Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
dkms lib32gcc1 libc6-i386 libcuda1-340 libxnvctrl0 nvidia-opencl-icd- 
340
nvidia-settings pkg-config screen-resolution-extra
Suggested packages:
menu
The following NEW packages will be installed:
dkms lib32gcc1 libc6-i386 libcuda1-340 libxnvctrl0 nvidia-340
nvidia-opencl-icd-340 nvidia-settings pkg-config screen-resolution- 
extra
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/73.3 MB of archives.
After this operation, 346 MB of additional disk space will be used.
Selecting previously unselected package dkms.
(Reading database ... 277766 files and directories currently 
installed.)
Preparing to unpack .../0-dkms_2.3-3ubuntu9.2_all.deb ...
Unpacking dkms (2.3-3ubuntu9.2) ...
Selecting previously unselected package libc6-i386.
Preparing to unpack .../1-libc6-i386_2.27-3ubuntu1_amd64.deb ...
Unpacking libc6-i386 (2.27-3ubuntu1) ...
Replaced by files in installed package libc6:i386 (2.27-3ubuntu1) ...
Selecting previously unselected package libcuda1-340.
Preparing to unpack .../2-libcuda1-340_340.107- 
0ubuntu0.18.04.2_amd64.deb ...
Unpacking libcuda1-340 (340.107-0ubuntu0.18.04.2) ...
Selecting previously unselected package libxnvctrl0:amd64.
Preparing to unpack .../3-libxnvctrl0_418.56- 
0ubuntu0~gpu18.04.1_amd64.deb ...
Unpacking libxnvctrl0:amd64 (418.56-0ubuntu0~gpu18.04.1) ...
Selecting previously unselected package lib32gcc1.
Preparing to unpack .../4-lib32gcc1_1%3a8.3.0-6ubuntu1~18.04_amd64.deb 
...
Unpacking lib32gcc1 (1:8.3.0-6ubuntu1~18.04) ...
Preparing to unpack .../5-nvidia-340_340.107- 
0ubuntu0.18.04.2_amd64.deb 
...
Adding '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: rename involves overwriting '/usr/lib/x86_64- 
linux- 
gnu/libGL.so.1.distrib' with
different file '/usr/lib/x86_64-linux-gnu/libGL.so.1', not allowed
dpkg: error processing archive /tmp/apt-dpkg-install-61TLve/5-nvidia- 
340_340.107-0ubuntu0.18.04.2_amd64.deb (--unpack):
new nvidia-340 package pre-installation script subprocess returned 
error 
exit status 2
Selecting previously unselected package nvidia-opencl-icd-340.
Preparing to unpack .../6-nvidia-opencl-icd-340_340.107- 
0ubuntu0.18.04.2_amd64.deb ...
Unpacking nvidia-opencl-icd-340 (340.107-0ubuntu0.18.04.2) ...
Selecting previously unselected package pkg-config.
Preparing to unpack .../7-pkg-config_0.29.1-0ubuntu2_amd64.deb ...
Unpacking pkg-config (0.29.1-0ubuntu2) ...
Selecting previously unselected package screen-resolution-extra.
Preparing to unpack .../8-screen-resolution-extra_0.17.3_all.deb ...
Unpacking screen-resolution-extra (0.17.3) ...
Selecting previously unselected package nvidia-settings.
Preparing to unpack .../9-nvidia-settings_418.56- 
0ubuntu0~gpu18.04.1_amd64.deb ...
Unpacking nvidia-settings (418.56-0ubuntu0~gpu18.04.1) ...
Errors were encountered while processing:
/tmp/apt-dpkg-install-61TLve/5-nvidia-340_340.107- 
 0ubuntu0.18.04.2_amd64.deb
 E: Sub-process /usr/bin/dpkg returned an error code (1)
Boni
  • 743
  • It has nothing to do with the specific package you're trying to install - Nvidia drivers - but with broken software sources, the "9 not fully installed or removed packages". ANYTHING you try to install without correcting this prior problem will give the same result and pretty much the same error messages. Try in this order: sudo apt install -f then sudo dpkg --configure -a. Report back by [edit]ing your question and then ping me with @gabrielagarcia in comments. –  May 06 '19 at 14:37
  • @GabrielaGarcia after sudo apt install -f sudo dpkg --configure -a still the same result came am stuck on this please help – Boni May 06 '19 at 19:10
  • please update your question with the results –  May 06 '19 at 20:24
  • @GabrielaGarcia I updated my question...first I followed your steps but could not get any result and after that, I have followed above link and I post the result, please help – Boni May 07 '19 at 19:20

1 Answers1

0

try installing aptitude and use it instead of apt.

It will try different approaches to installing packages when there are problems and sometimes its error messages are more useful

Maybe it will help.

Tim Richardson
  • 2,294
  • 3
  • 25
  • 43