问题

问题

问题

无论我如何到达这里,我真正想做的就是完全删除 nvidia 和 cuda 驱动程序并重新安装它们。但是,无论我做什么,我都无法摆脱它们。

背景

我在 Ubuntu 22.04 上,我使用一个有效的 nvidia-535 驱动程序,并成功安装了 cuda 11-8(使用此处的说明)。

现在,由于某些(对我来说)未知的原因(可能是某些更新),cuda 停止工作(即稳定扩散中未使用 gpu)并nvidia-smi返回

Failed to initialize NVML: Driver/library version mismatch
NVML library version: 535.161

因此想尝试删除与 cuda 和 nvidia 相关的所有内容并重新开始,因为我知道它之前运行良好。

我努力了

  • sudo apt remove --purge nvidia*返回
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'nvidia-driver-550-server' for glob 'nvidia*'
Note, selecting 'nvidia-firmware-535-535.154.05' for glob 'nvidia*'
Note, selecting 'nvidia-docker2' for glob 'nvidia*'

... [ca. 300 similar rows] ...

Package 'nvidia-egl-wayland-common' is not installed, so not removed
Note, selecting 'nvidia-settings' instead of 'nvidia-settings-binary'
Package 'nvidia-390' is not installed, so not removed
Note, selecting 'libnvtt-bin' instead of 'nvidia-texture-tools'
Package 'nvidia-libopencl1-dev' is not installed, so not removed
Package 'nvidia-current' is not installed, so not removed
Package 'nvidia-current-updates' is not installed, so not removed
Package 'nvidia-libopencl1' is not installed, so not removed
Package 'nvidia' is not installed, so not removed

... [ca. 500 similar rows] ...

Package 'nvidia-container-toolkit-base' is not installed, so not removed
Package 'nvidia-firmware-545-545.29.02' is not installed, so not removed
Package 'nvidia-firmware-550-550.40.07' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-drivers-535 : Depends: nvidia-compute-utils-535 (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-dkms-535 (>= 535.129.03)
                    Depends: nvidia-driver-535 (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-kernel-common-535 (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-kernel-source-535 (>= 535.129.03) but it is not going to be installed or
                             nvidia-kernel-open-535 (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-utils-535 (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-modprobe (>= 535.129.03) but it is not going to be installed
                    Depends: nvidia-settings (>= 535.129.03) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • 根据建议我尝试了: 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:
  libsbc1 nvidia-firmware-535-535.146.02 nvidia-firmware-535-535.161.07
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nvidia-kernel-common-535
The following packages will be upgraded:
  nvidia-kernel-common-535
1 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
2 not fully installed or removed.
Need to get 0 B/38,3 MB of archives.
After this operation, 45,1 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 256847 files and directories currently installed.)
Preparing to unpack .../nvidia-kernel-common-535_535.161.07-0ubuntu1_amd64.deb ...
Unpacking nvidia-kernel-common-535 (535.161.07-0ubuntu1) over (535.154.05-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-kernel-common-535_535.161.07-0ubuntu1_amd64.deb (--unpack)
:
 trying to overwrite '/lib/firmware/nvidia/535.161.07/gsp_ga10x.bin', which is also in package nvidia-firmware-535-535.1
61.07 535.161.07-0ubuntu0.22.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-kernel-common-535_535.161.07-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • sudo apt autoremove给出:
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:
 nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.161.07-0ubuntu1) but 535.154.05-0ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • sudo apt remove --purge "*cuda*"返回:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libcuda-10.2-1' for glob '*cuda*'
Note, selecting 'libcudart.so.12' for glob '*cuda*'

... [ ca. 800 rows ] ...

Package 'libcudss0-cuda-12' is not installed, so not removed
Package 'libcudss0-dev-cuda-12' is not installed, so not removed
Package 'libcudss0-static-cuda-12' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libcublas-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcufft-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                          cuda-cudart-11-2 but it is not installable
                 Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                          cuda-cudart-11-2 but it is not installable
                 Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcufile-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcurand-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcusolver-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcusparse-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libnpp-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                        cuda-cudart-11-2 but it is not installable
               Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                        cuda-cudart-11-2 but it is not installable
               Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libnvjpeg-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.161.07-0ubuntu1) but 535.154.05-0ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • 正如另一篇文章中所述问题,我试图找到卸载程序: sudo /usr/local/cuda-11.4/bin/cuda-uninstaller但下没有 cuda 或 nvidia 目录/usr/local/

  • 我检查过/etc/apt/sources.list,没有“nvidia”或“cuda”的实例(即cat /etc/apt/sources.list | grep nvidia没有返回任何内容)。

  • 按照附加说明进行操作问题sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"回到:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'cublasmp-cuda-11' for glob '*cublas*'
Note, selecting 'cublasmp-cuda-12' for glob '*cublas*'

... [ >100 similar rows ] ...

Package 'libcublas-dev-12-4' is not installed, so not removed
Package 'nsight-compute-2024.1.0' is not installed, so not removed
Package 'nsight-systems-2023.4.4' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libcufft-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                          cuda-cudart-11-2 but it is not installable
                 Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                          cuda-cudart-11-2 but it is not installable
                 Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcufile-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcurand-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcusolver-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libcusparse-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                             cuda-cudart-11-2 but it is not installable
                    Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libnpp-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                        cuda-cudart-11-2 but it is not installable
               Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                        cuda-cudart-11-2 but it is not installable
               Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 libnvjpeg-11-8 : Depends: cuda-toolkit-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-config-common but it is not going to be installed or
                           cuda-cudart-11-2 but it is not installable
                  Depends: cuda-toolkit-11-8-config-common but it is not going to be installed
 nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.161.07-0ubuntu1) but 535.154.05-0ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

总之,无论我尝试删除什么,它都不会让我删除,因为依赖关系尚未满足。我尝试逐个删除上面的最后一个软件包(例如 libcufft-11-8),但我再次得到非常相似的输出,列出了其他相关软件包。

另外, sudo apt update返回:

Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 http://se.archive.ubuntu.com/ubuntu jammy InRelease                                                              
Hit:3 http://se.archive.ubuntu.com/ubuntu jammy-updates InRelease                                                      
Hit:4 http://se.archive.ubuntu.com/ubuntu jammy-backports InRelease                                                    
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease                                                          
Hit:6 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease                            
Get:7 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                                              
Hit:8 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease                            
Hit:9 https://ppa.launchpadcontent.net/qbittorrent-team/qbittorrent-stable/ubuntu jammy InRelease
Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [848 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [597 kB]
Get:12 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [162 kB]
Fetched 1 716 kB in 2s (1 033 kB/s)                               
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
29 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: https://download.docker.com/linux/ubuntu/dists/focal/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://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.

并且sudo apt upgrade不起作用:

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:
 nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.161.07-0ubuntu1) but 535.154.05-0ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

系统详细信息

Ubuntu 22.04.4 LTS

内核:6.5.0-21-generic

答案1

我运行时刚刚遇到了这个问题sudo apt --fix-broken install

尝试运行类似这样的程序来修复它

sudo dpkg --force-all -i /var/cache/apt/archives/nvidia-kernel-common-535_535.161.07-0ubuntu1_amd64.deb

sudo apt --fix-broken install

然后重新启动机器。

答案2

一步步:

sudo apt-get purge nvidia*

sudo apt remove nvidia-*

sudo rm /etc/apt/sources.list.d/cuda*

sudo apt-get autoremove && sudo apt-get autoclean

sudo rm -rf /usr/local/cuda*

如果上述命令没有帮助,请通过 Grab 菜单启动并重试。

PS 在多个 Ubuntu 版本上都有效

答案3

在“软件和更新”中将驱动程序手动设置为 Nouveau 并重新启动后,、、sudo apt remove --purge nvidia*sudo apt remove --purge "*cuda*"(如我的问题中所列以及 Siarhei 所建议的)按预期工作并且没有出现任何错误。

我知道这很简单,但以前(以及在其他系统上)我能够做到这一点,而无需手动激活 Nouveau 驱动程序并重新启动,所以我想当时我并没有想到这一点。

(感谢大家重新打开并回答问题。另外,对于打字错误,我深表歉意。)

相关内容