如何卸载 NVIDIA 内核模块“nvidia”以安装新驱动程序?

Posted

技术标签:

【中文标题】如何卸载 NVIDIA 内核模块“nvidia”以安装新驱动程序?【英文标题】:How to unload an NVIDIA kernel module 'nvidia' for new driver installation? 【发布时间】:2020-08-15 23:39:59 【问题描述】:

我需要升级我的 nvidia 驱动程序,以便我尝试运行 NVIDIA-LInux-x86_64.run 文件

但是,我看到了以下消息

ERROR: An NVIDIA kernel module 'nvidia' appears to already be loaded in your kernel.  This may be because it is in use (for example, by an X server, a CUDA program, or the NVIDIA Persistence Daemon), but this may also happen if your kernel was configured without support for module unloading.  Please be sure to exit any programs that may be using the GPU(s) before attempting to upgrade your driver.  If no GPU-based programs are running, you know that your kernel supports module unloading, and you still receive this message, then an error may have occured that has corrupted an NVIDIA kernel module's usage count, for which the simplest remedy is to reboot your computer.

我已经卸载了nvidia-drm,当我尝试卸载nvidia

$ sudo modprobe -r nvidia
modprobe: FATAL: Module nvidia is in use.

谁能指导我安装这个新驱动程序没有任何问题?

谢谢

【问题讨论】:

嗨布兰登·李。您的问题听起来像是系统管理问题,而不是编程问题。在superuser.com 询问您可能会更幸运,或者,如果这确实是一个特定于 Ubuntu 的问题,请在askubuntu.com 询问。 【参考方案1】:

使用lsof /dev/nvidia* 查找正在使用旧驱动程序的进程。就我而言,它是“nvidia-persistenced”。只需通过 pid 终止进程并重试安装程序 NVIDIA-***.run

# lsof /dev/nvidia*
COMMAND    PID                USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
nvidia-pe 1334 nvidia-persistenced    2u   CHR 195,255      0t0  420 /dev/nvidiactl
nvidia-pe 1334 nvidia-persistenced    3u   CHR   195,0      0t0  421 /dev/nvidia0
nvidia-pe 1334 nvidia-persistenced    5u   CHR   195,0      0t0  421 /dev/nvidia0
nvidia-pe 1334 nvidia-persistenced    6u   CHR   195,0      0t0  421 /dev/nvidia0
nvidia-pe 1334 nvidia-persistenced    7u   CHR   195,0      0t0  421 /dev/nvidia0

【讨论】:

【参考方案2】:

我刚刚删除了现有的驱动程序并重新安装了

【讨论】:

以上是关于如何卸载 NVIDIA 内核模块“nvidia”以安装新驱动程序?的主要内容,如果未能解决你的问题,请参考以下文章

尝试在 AWS EMR 中获得 GPU 支持时出现错误“一个 NVIDIA 内核模块 'nvidia' 似乎已加载到您的内核中”

活久见!NVIDIA正式开源其Linux GPU内核模块

无法加载内核模块“nvidia.ko”

在 Ubuntu 20.04 中为 GTX 560 Ti 安装 Nvidia 驱动程序时,如何修复客户端版本和内核模块版本之间的“NVRM:API 不匹配”?

Ubuntu如何卸载NVIDIA驱动

如何安装nvidia显卡驱动啊?