21

I just installed Ubuntu 18.04.5 LTS on my workstation along with the recommended nvidia drivers, where I used sudo ubuntu-drivers autoinstall to do so, and ubuntu-drivers devices recommends installing nvidia-driver-450-server - distro non-free recommended.

However, after installing the recommended driver, my package system is broken. When I try to update the software using the "Software updater", I get the following 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
Transaction failed: The package system is broken
 The following packages have unmet dependencies: libnvidia-gl-450: Depends: libnvidia-common-450 but it is not installed
                  Depends: libgcc1 (>= 1:4.2) but 1:8.4.0-1ubuntu1~18.04 is installed
libnvidia-gl-450:i386: Depends: libnvidia-common-450 but it is not installed

A forced installation of the package using sudo apt-get install -f libnvidia-common-450 yields the following error:

dpkg: error processing archive /var/cache/apt/archives/libnvidia-common-450_450.80.02-0ubuntu0.18.04.2_all.deb
(--unpack):
 trying to overwrite '/usr/share/nvidia/nvidia-application-profiles-450.80.02-key-documentation',
 which is also in package libnvidia-common-450-server  450.80.02-0ubuntu0.18.04.3
 Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-common-450_450.80.02-0ubuntu0.18.04.2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

And nothing is resolved. Trying to reconfigure the package using sudo dpkg --configure -a says that the package libnvidia-common-450 is not installed. I'm not sure where to go next, and any advice would be greatly appreciated.

user.dz
  • 47,137
  • 13
  • 140
  • 258
Kaszt
  • 395
  • 2
  • 3
  • 8
  • 4
    Try the solution here https://askubuntu.com/q/56761/26246 `sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450` – user.dz Oct 21 '20 at 12:09
  • the same question and I have solved it by: https://askubuntu.com/questions/1253784/cannot-purge-nvidia-drivers?newreg=a976a4de75734ce4a265affc5b7ec0d4 – leng yuner Oct 21 '20 at 12:28
  • This is not 18.04 specific and happened on my Ubuntu 20.04 too. – Mischa Oct 26 '20 at 15:38
  • Thanks for the comments; running `sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450` worked for me! For this problem, the solution posted on https://askubuntu.com/questions/1253784/cannot-purge-nvidia-drivers?newreg=a976a4de75734ce4a265affc5b7ec0d4 didn't work for me... – Kaszt Oct 29 '20 at 16:03
  • Does this answer your question? [dpkg error: "trying to overwrite file, which is also in..."](https://askubuntu.com/questions/176121/dpkg-error-trying-to-overwrite-file-which-is-also-in) – karel Nov 09 '20 at 12:41

2 Answers2

35

I solved this issue by using the the following command to reinstall libnvidia-common-450-server:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450-server

The problem started after following an online article to install nvidia drivers. This was the error I was getting:

libnvidia-gl-450-server: Depends: libnvidia-common-450-server but it
is not installed Depends: libgcc1 (>= 1:4.2) but
1:8.4.0-1ubuntu1~18.04 is installed libnvidia-gl-450-server:i386:
Depends: libnvidia-common-450-server but it is not installed
Nmath
  • 12,105
  • 8
  • 25
  • 54
Roopak
  • 466
  • 4
  • 3
  • 9
    Worked for me, but had to change to `sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450`. What a lifesaver! – Erasmus Cedernaes Oct 23 '20 at 13:40
  • 5
    Thx a lot, that helped me too. Here is a related report: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-450-server/+bug/1899522 – Mischa Oct 26 '20 at 15:25
  • 2
    Thank you so much; this worked for me too when I ran `sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450`. Interesting to learn that it is a bug - but this solution seems to work quite well. Thanks again!! – Kaszt Oct 29 '20 at 16:02
6

Same issue. Also because of it could not update via Software updater and other issues installing lead to same dependency error. This fixed it for me too:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f libnvidia-common-450