关于独立显卡笔记本安装显卡驱动及调节亮度
程序员文章站
2022-07-06 16:20:38
...
关于独立显卡笔记本安装显卡驱动及调节亮度
在网上参考了很多教程,很多都不通用,以我的笔记本电脑为例(光影精灵4_GTX1050Ti),整理了一下有效的教程
1. 将NVIDIA repository 加入你的 apt
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt update
2. 安装 NVIDIA Driver
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
若在安装期间遇到driver安装不完整的情况,所以重新再试一次:
sudo apt-get update
sudo ubuntu-drivers autoinstall
安装完以后重新启动:
sudo reboot
测试一下是否安装成功:
base) ➜ Frequent-use git:(master) nvidia-smi
Sun Aug 18 09:03:59 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.40 Driver Version: 430.40 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 106... Off | 00000000:05:00.0 On | N/A |
| 29% 33C P8 8W / 120W | 110MiB / 6077MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1630 G /usr/lib/xorg/Xorg 39MiB |
| 0 2055 G /usr/bin/gnome-shell 68MiB |
+-----------------------------------------------------------------------------+
(这里声明一下,上面是我看另一个老哥的安装结果,我运行nvidia-smi
的时候出错,但我的附加驱动显示已安装)
3.修改xorg.conf文件
1.先看一下有没有xorg.conf这个文件cd /etc/X11
ls
一下,若没有的话执行sudo nano xorg.conf
然后输入下面的内容:
Section "Screen"
Identifier "Default Screen"
DefaultDepth 24
EndSection
Section "Module"
Load "glx"
EndSection
Section "Device"
Identifier "Default Device"
Driver "nvidia"
Option "NoLogo" "True"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection
如果有的话在终端输入:
sudo nano /etc/X11/xorg.conf(注意大小写)打开该文件,把
Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
EndSection
改成
Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
Option “RegistryDwords” “EnableBrightnessControl=1”
EndSection
然后保存退出
重启后就可以调节亮度了
但暂时还无法通过键盘快捷键调节亮度,若后续找到可以使用的教程,我会补上
参考文献
【1】ubuntu 18.04 安装 nvidia drivers 430安装
【2】ubuntu安装nvidia显卡驱动后不能用快捷键调节亮度的解决办法