首页 新闻 会员 周边 捐助

ubunbu 22.04安装nvidia驱动

0
[待解决问题]

Errors were encountered while processing:
/tmp/apt-dpkg-install-UHrEYm/30-nvidia-compute-utils-550_550.127.08-0ubuntu1_amd64.deb
/tmp/apt-dpkg-install-UHrEYm/35-nvidia-utils-550_550.127.08-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
这个错误怎么修改哇

檀檀爱吃糖的主页 檀檀爱吃糖 | 菜鸟二级 | 园豆:202
提问于:2025-01-13 17:00
< >
分享
所有回答(3)
0
dudu | 园豆:28548 (高人七级) | 2025-01-13 22:32

谢谢,但是我去看了一下,因为可能我不是很懂所以有点看不懂,其次我看问题好像有点不是很一样

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 09:32

@檀檀爱吃糖: 我之前在 ubunbu 22.04 上安装过 nvidia 驱动,可以看一下当时记录的博文 阿里云轻量级 GPU 实例安装 NVIDIA 驱动

支持(0) 反对(0) dudu | 园豆:28548 (高人七级) | 2025-01-14 10:21

@dudu: 好滴,谢谢!我先去试试

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 10:23

@dudu: 你好我去看了一下,这个是靠阿里云,但是我的虚拟机是学校的,我是通过学校接口连接的,所以好像不太能适配

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 10:52

@檀檀爱吃糖: 那只是参考,建议先确定一下驱动版本,如果驱动版本没有问题,只是 linux 系统的问题,可以试试这个回答中的方法 https://unix.stackexchange.com/a/688302

支持(0) 反对(0) dudu | 园豆:28548 (高人七级) | 2025-01-14 11:00

@dudu: 谢谢!我试了一下还是不行,和之前报错一样

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 15:59
0

在 Ubuntu 22.04 上安装 NVIDIA 驱动时遇到 E: Sub-process /usr/bin/dpkg returned an error code (1) 的错误,通常表示安装过程中出现了问题。以下是一些步骤和解决方法,您可以尝试解决该错误:

1. 更新包列表和系统

首先,确保您的包管理器是最新的,您可以通过以下命令更新:

sudo apt update
sudo apt upgrade

2. 清理未完全安装的软件包

执行以下命令以清理未完全安装的软件包:

sudo apt --fix-broken install

3. 手动安装 NVIDIA 驱动

如果您从 PPA 或通过普通的 APT 安装驱动程序,可以手动安装 NVIDIA 驱动。

  1. 添加 NVIDIA PPA(如果尚未添加):

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
    
  2. 查找可用的驱动版本
    查看可用的驱动版本:

    ubuntu-drivers devices
    
  3. 手动安装推荐的驱动
    使用以下命令安装推荐的驱动(例如 nvidia-driver-xxx,您在上一步看到的):

    sudo apt install nvidia-driver-xxx
    

4. 检查已锁定的包

如果某些包在安装时被锁定,可以使用以下命令查看:

sudo dpkg --get-selections | grep -v deinstall

如果发现某些 NVIDIA 相关的包被锁定,使用以下命令解锁:

sudo apt-mark unhold package-name

5. 删除问题包

如果某些包仍然引起问题,可以尝试手动删除它们:

sudo dpkg --remove --force-remove-reinstreq nvidia-compute-utils-550
sudo dpkg --remove --force-remove-reinstreq nvidia-utils-550

6. 重新安装 NVIDIA 驱动

在删除问题包后,再次尝试安装 NVIDIA 驱动:

sudo apt install nvidia-driver-xxx

7. 查看日志文件

如果错误依然存在,可以查看相关日志输出以获取更多信息:

cat /var/log/dpkg.log | grep nvidia

8. 最后的步骤

完成上述步骤后,重启计算机,检查 NVIDIA 驱动是否正确安装:

sudo reboot

重新启动后,您可以使用以下命令检查 NVIDIA 驱动是否正常工作:

nvidia-smi

总结

通过以上步骤,您应该能够解决安装 NVIDIA 驱动时遇到的问题。如果仍然遇到麻烦,请提供更多错误信息,以便进一步诊断和帮助。

Technologyforgood | 园豆:7846 (大侠五级) | 2025-01-14 09:02

还是报错,麻烦可以帮忙看看怎么回事吗
执行sudo apt install nvidia-driver-565报错:
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
nvidia-driver-565 : Depends: nvidia-compute-utils-565 (= 565.57.01-0ubuntu1) but it is not going to be installed
Depends: nvidia-utils-565 (= 565.57.01-0ubuntu1) but it is not going to be installed
Recommends: libnvidia-compute-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-decode-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-encode-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-fbc1-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-gl-565:i386 (= 565.57.01-0ubuntu1)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
这是日志的输出(大体全是这样):
2025-01-14 01:14:17 install nvidia-compute-utils-565:amd64 <none> 565.57.01-0ubuntu1
2025-01-14 01:14:17 status half-installed nvidia-compute-utils-565:amd64 565.57.01-0ubuntu1
2025-01-14 01:14:17 status not-installed nvidia-compute-utils-565:amd64 <none>
2025-01-14 01:14:17 install nvidia-utils-565:amd64 <none> 565.57.01-0ubuntu1
2025-01-14 01:14:17 status half-installed nvidia-utils-565:amd64 565.57.01-0ubuntu1
2025-01-14 01:14:17 status not-installed nvidia-utils-565:amd64 <none>
不知道是不是更新问题,执行sudo apt update会有些红色
Reading package lists... Done
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
执行sudo apt upgrade,报错:
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
nvidia-driver-565 : Depends: nvidia-compute-utils-565 (= 565.57.01-0ubuntu1) but it is not installed
Depends: nvidia-utils-565 (= 565.57.01-0ubuntu1) but it is not installed
Recommends: libnvidia-compute-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-decode-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-encode-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-fbc1-565:i386 (= 565.57.01-0ubuntu1)
Recommends: libnvidia-gl-565:i386 (= 565.57.01-0ubuntu1)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 09:28

对,查看包锁定时,我sudo apt-mark unhold package-name后,再次看哪些包锁定时,发现还是被锁定的。
其次dpkg -l | grep -i nvidia会返回
ii cuda-nvtx-12-0 12.0.140-1 amd64 NVIDIA Tools Extension
hi libnccl-dev 2.16.2-1+cuda12.0 amd64 NVIDIA Collective Communication Library (NCCL) Development Files
hi libnccl2 2.16.2-1+cuda12.0 amd64 NVIDIA Collective Communication Library (NCCL) Runtime
ii libnvidia-cfg1-565:amd64 565.57.01-0ubuntu1 amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-565 565.57.01-0ubuntu1 all Shared files used by the NVIDIA libraries
ii libnvidia-compute-565:amd64 565.57.01-0ubuntu1 amd64 NVIDIA libcompute package
ii libnvidia-decode-565:amd64 565.57.01-0ubuntu1 amd64 NVIDIA Video Decoding runtime libraries
ii libnvidia-encode-565:amd64 565.57.01-0ubuntu1 amd64 NVENC Video Encoding runtime library
ii libnvidia-extra-565:amd64 565.57.01-0ubuntu1 amd64 Extra libraries for the NVIDIA driver
ii libnvidia-fbc1-565:amd64 565.57.01-0ubuntu1 amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-gl-565:amd64 565.57.01-0ubuntu1 amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
iU nvidia-dkms-565 565.57.01-0ubuntu1 amd64 NVIDIA DKMS package
iU nvidia-driver-565 565.57.01-0ubuntu1 amd64 NVIDIA driver metapackage
iU nvidia-firmware-565-565.57.01 565.57.01-0ubuntu1 amd64 Firmware files used by the kernel module
iU nvidia-kernel-common-565 565.57.01-0ubuntu1 amd64 Shared files used with the kernel module
iU nvidia-kernel-source-565 565.57.01-0ubuntu1 amd64 NVIDIA kernel source package
iU nvidia-modprobe 565.57.01-0ubuntu1 amd64 Load the NVIDIA kernel driver and create device files
iU nvidia-prime 0.8.17.1 all Tools to enable NVIDIA's Prime
iU nvidia-settings 565.57.01-0ubuntu1 amd64 Tool for configuring the NVIDIA graphics driver
ii screen-resolution-extra 0.18.2 all Extension for the nvidia-settings control panel
ii xserver-xorg-video-nvidia-565 565.57.01-0ubuntu1 amd64 NVIDIA binary Xorg driver
执行nvcc -V也会返回
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 09:35
0

你的apt源不对. bionic是18.04的. 22.04是jammy
参考 https://developer.aliyun.com/article/1430362

www378660084 | 园豆:1322 (小虾三级) | 2025-01-14 10:24

谢谢!我已经将这里修改,sudo apt update已经没有问题了,但是,其他错误还是存在,可以麻烦您帮我看看吗

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 10:39

@檀檀爱吃糖: 好像是版本不对. 你的nvdia源是什么,确认下是不是ubuntu 22.04的

支持(0) 反对(0) www378660084 | 园豆:1322 (小虾三级) | 2025-01-14 11:04

@www378660084: 是Ubuntu22.04滴,下面是返回的结果
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.5 LTS"

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-14 11:32

@檀檀爱吃糖: 这是ubuntu版本,不是nvdia源的版本

支持(0) 反对(0) www378660084 | 园豆:1322 (小虾三级) | 2025-01-15 10:13

@www378660084:应该是没有问题的,前面提示后边修改了的
deb http://archive.ubuntu.com/ubuntu/ jammy multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse

deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

or updates from the Ubuntu security team.

deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted

deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted

security team.

deb http://archive.ubuntu.com/ubuntu/ jammy multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse

deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

or updates from the Ubuntu security team.

deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted

deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted

deb http://security.ubuntu.com/ubuntu/ jammy-security universe

deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe

deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse

deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse

支持(0) 反对(0) 檀檀爱吃糖 | 园豆:202 (菜鸟二级) | 2025-01-15 11:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册