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

How to unload an NVIDIA kernel module 'nvidia' for new driver installation?

我需要升级我的 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.

任何人都可以指导我安装这个新驱动程序吗?

谢谢

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

使用lsof /dev/nvidia*查找正在使用旧驱动程序的进程。在我的例子中是“nvidia-persistenced”。只需通过 pid 终止进程并重试安装程序 NVIDIA-***。运行

# 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