CUDA Driver 515 520 version conflict

Hi there,

I am getting a conflict from apt when I am trying to upgrade and doing sudo apt --fix-broken install does not fix it. I’ve tried reaching out to the Pop!_OS devs but they are telling me to sudo apt purge the nvidia drivers but I can’t purge until I am get rid of the drivers. Is there a way to aviod this conflict from the NVIDIA side? Thanks in advance

(base) ➜  ~ sudo apt update && sudo apt upgrade -y
Hit:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease
Hit:2 http://packages.microsoft.com/repos/code stable InRelease                                                              
Hit:3 https://packages.microsoft.com/repos/ms-teams stable InRelease                                                         
Hit:4 http://apt.pop-os.org/proprietary jammy InRelease                                                                      
Hit:5 http://apt.pop-os.org/release jammy InRelease                                             
Hit:6 http://apt.pop-os.org/ubuntu jammy InRelease                                              
Get:8 http://apt.pop-os.org/ubuntu jammy-security InRelease [110 kB]                                        
Get:9 http://apt.pop-os.org/ubuntu jammy-updates InRelease [114 kB]                                                  
Hit:7 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Get:10 http://apt.pop-os.org/ubuntu jammy-backports InRelease [99.8 kB]
Fetched 324 kB in 1s (257 kB/s)     
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
28 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://packagecloud.io/slacktechnologies/slack/debian/dists/jessie/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-drivers : Depends: cuda-drivers-520 (= 520.61.05-1) but it is not installed
 libnvidia-compute-495 : Depends: libnvidia-compute-515 but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
(base) ➜  ~ sudo apt --fix-broken install         
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libaccinj64-11.5 libcupti11.5 libnvidia-egl-wayland1 node-html5shiv nvidia-cuda-toolkit-doc
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  cuda-drivers-520 libgles2:i386 libnvidia-cfg1-520 libnvidia-extra-520 libnvidia-fbc1-520:i386 libnvidia-gl-520:i386
  libopengl0:i386 nvidia-compute-utils-520 nvidia-dkms-520 nvidia-driver-520 nvidia-kernel-common-520
  nvidia-kernel-source-520 nvidia-modprobe nvidia-settings nvidia-utils-520 xserver-xorg-video-nvidia-520
Recommended packages:
  nvidia-prime libnvidia-compute-520:i386 libnvidia-decode-520:i386 libnvidia-encode-520:i386
The following packages will be REMOVED:
  libcuinj64-11.5 libnvidia-cfg1-515 libnvidia-compute-495 libnvidia-extra-515 nvidia-dkms-515 nvidia-kernel-common-515
  nvidia-kernel-source-515 nvidia-profiler nvidia-visual-profiler xserver-xorg-video-nvidia-515
The following NEW packages will be installed:
  cuda-drivers-520 libgles2:i386 libnvidia-cfg1-520 libnvidia-extra-520 libnvidia-fbc1-520:i386 libnvidia-gl-520:i386
  libopengl0:i386 nvidia-compute-utils-520 nvidia-dkms-520 nvidia-driver-520 nvidia-kernel-common-520
  nvidia-kernel-source-520 nvidia-utils-520 xserver-xorg-video-nvidia-520
The following packages will be upgraded:
  nvidia-modprobe nvidia-settings
2 upgraded, 14 newly installed, 10 to remove and 26 not upgraded.
7 not fully installed or removed.
Need to get 0 B/110 MB of archives.
After this operation, 3,721 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 519429 files and directories currently installed.)
Preparing to unpack .../nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb ...
Unpacking nvidia-compute-utils-520 (520.61.05-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/nvidia-powerd', which is also in package nvidia-kernel-common-515 515.65.01-1pop0~1663626642~22
.04~1f94f41
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-compute-utils-520_520.61.05-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I don’t know anything about PopOS, so this might not work for you. But, I encountered similar errors on Ubuntu. I fixed it by uninstalling all the Ubuntu NVIDIA drivers and then installing CUDA.

# this purges all existing nvidia packages from the distro
sudo dpkg -P $(dpkg -l | grep nvidia | awk '{print $2}'

# install CUDA and its dependencies, which should include the correct
# non-free nvidia drivers.
sudo apt-get install cuda

Then, I needed to reboot.

Hope this helps.

Any solutions which do not involve removing the ubuntu drivers? → I am on a new laptop (Alienware x17) and my monitor doesn’t work without the ubuntu drivers…

Hey Josh. Did you find a solution for this?

You can boot to multi-user versus graphical boot.
Multi-user gives you the command line, and you can remove the driver… Reinstall CUDA and the driver, and reboot with Graphical user.

Also ‘Control-Alt-F2’ to Control-Alt-F5 should bring you to different non-graphical terminals.

Also at the non-graphical level boot (Multi-user) you can remove the drivers and reload them without rebooting. But rebooting is good to confirm all is well.

Show the default target/runlevel:
systemctl get-default
Set the target to multi-user:
sudo systemctl set-default multi-user
Set the default target to graphical:
sudo systemctl set-default graphical

Or for temporary changes:
Temporarily change to multi-user:
sudo systemctl isolate multi-user
Temporarily change to graphical:
sudo systemctl isolate graphical