版权声明:本博客采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可, 转载请注明出处 https://blog.csdn.net/u014025444/article/details/91454059
全程root
用户运行, 本次的闭源驱动最新版是430
- 1、安装闭源驱动
$ pacman -S nvidia nvidia-utils nvidia-settings
- 2、查看n卡的BusID
$ lspci | egrep 'VGA|3D' 出现如下格式: ---------------------------------------------------------------------- 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop) 01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
- 3、自动生成配置文件
$ nvidia-xconfig
- 4、启动脚本配置
LightDM
$ nano /etc/lightdm/display_setup.sh ---------------------------------------------------------------------- #!/bin/sh xrandr --setprovideroutputsource modesetting NVIDIA-0 xrandr --auto ---------------------------------------------------------------------- $ chmod +x /etc/lightdm/display_setup.sh $ nano /etc/lightdm/lightdm.conf ---------------------------------------------------------------------- [Seat:*] display-setup-script=/etc/lightdm/display_setup.sh ----------------------------------------------------------------------
SDDM
$ nano /usr/share/sddm/scripts/Xsetup ---------------------------------------------------------------------- xrandr --setprovideroutputsource modesetting NVIDIA-0 xrandr --auto
GDM
创建两个桌面文件 /usr/share/gdm/greeter/autostart/optimus.desktop /etc/xdg/autostart/optimus.desktop ---------------------------------------------------------------------- [Desktop Entry] Type=Application Name=Optimus Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto" NoDisplay=true X-GNOME-Autostart-Phase=DisplayServer
- 5、修改配置文件
$ nano /etc/X11/xorg.conf ---------------------------------------------------------------------- Section "Module" #此部分可能没有,自行添加 load "modesetting" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "1:0:0" #此处填刚刚查询到的BusID Option "AllowEmptyInitialConfiguration" EndSection
- 6、解决画面撕裂问题
$ nano /etc/mkinitcpio.conf ---------------------------------------------------------------------- MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) ---------------------------------------------------------------------- $ nano /etc/default/grub # 此处必须是grub引导,其他引导自行百度 ---------------------------------------------------------------------- GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia-drm.modeset=1" #此处加nvidia-drm.modeset=1参数 ---------------------------------------------------------------------- $ grub-mkconfig -o /boot/grub/grub.cfg # 就算grub引导,配置文件也可能不在一个地方,请查看清楚
文章来源: https://blog.csdn.net/u014025444/article/details/91454059