赞
踩
千万不要使用Nvidia官方提供的.run文件,那个玩意有很大问题!!!
参考Debian Wiki(不要看中文翻译版,那玩意几百年没更新了)
确定你安装了当前内核的linux-headers文件,最好的方法是再安装一遍:sudo apt install linux-headers-$(uname -r)
/etc/apt/
这个目录下注释掉你的所有镜像源列表,然后使用USTC提供的配置生成器提供的内容,替换掉/etc/apt/source.list
里面的所有内容,并保证/etc/apt/source.list.d
这个目录下的文件里的镜像源都没有启用,然后apt update
,再安装一遍安装dkms
,用于将Nvidia内核模块安装进内核(很重要!)
如果你已经通过其他方法安装了驱动但是无法使用:
如果是通过.run文件,恭喜你,你完蛋了,但是还有办法补救:
$ sudo zypper remove "cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
$ sudo apt-get --purge remove "*nvidia*" "libxnvctrl*"
$ sudo apt-get autoremove
如果是通过下面提到的使用apt方法后出现问题,那么直接尝试下面提到的使用dkms
将驱动安装进内核。
dkms
将驱动安装进内核(看下面的方法)在前面的/etc/apt/source.list
里添加下面一行:
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
进行安装
$ apt update
$ apt install nvidia-driver firmware-misc-nonfree
CUDA
:$ apt install nvidia-cuda-dev nvidia-cuda-toolkit
使用dkms
将驱动安装进内核(很重要):
$ ls /usr/src | grep nvidia
nvidia-[版本号]
$ do dkms install -m nvidia -v [版本号]
使用nvitop
验证是否安装成功,若出现nvitop
界面则安装成功
一般来讲,目前Gnome对Wayland的支持会好一些,KDE Plasma则不建议使用Wayland;如果能使用X11则尽量使用X11
编辑grub
以切换至Nvidia模式:
$ echo 'GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX nvidia-drm.modeset=1"' > /etc/default/grub.d/nvidia-modeset.cfg
$ update-grub
安装并启用systemd
和电源管理脚本:
$ apt install nvidia-suspend-common
$ systemctl enable nvidia-suspend.service
$ systemctl enable nvidia-hibernate.service
$ systemctl enable nvidia-resume.service
验证NVIDIA模块参数PreserveVideoMemoryAllocations是否已激活:
cat /proc/driver/nvidia/params | grep PreserveVideoMemoryAllocations
PreserveVideoMemoryAllocations: 1
echo 'options nvidia NVreg_PreserveVideoMemoryAllocations=1' > /etc/modprobe.d/nvidia-power-management.conf
重启,Wayland应该可以启用了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。