This guide is only for Maxwell and newer cards
Simple guide to install nvidia drivers and cuda on arch linux. Please read the wiki before following this guide. I will be using the linux-zen kernel for this guide but this guide should work for the other kernels in the arch repo as well.
sudo nano /etc/pacman.confFeel free to use vim, gedit or any other text editor. Scroll down until you find the words "multilib" and uncomment the following lines (remove the # sign)
[multilib]
Include = /etc/pacman.d/mirrorlistUpdate the system using pacman to sync the multilib repo and to make sure you have the latest kernel
sudo pacman -SyuTo proceed you will need the kernel headers if you are not using the default "Linux" kernel. The following table shows which package you will need to install.
| Kernel Name | Kernel Header Name |
|---|---|
| linux | linux-headers |
| linux-zen | linux-zen-headers |
| linux-lts | linux-lts-headers |
If you have installed a kernel from the AUR check to see if they provide the headers. For example linux-xanmod will require the linux-xanmod-headers package to provide headers
Install kernel headers using pacman or an AUR helper
sudo pacman -S linux-zen-headers dkmsMake sure your card is maxwell or newer, run the following to check your card model
lspci -k | grep -A 2 -E "(VGA|3D)"My output:
01:00.0 VGA compatible controller: NVIDIA Corporation AD107M [GeForce RTX 4060 Max-Q / Mobile] (rev a1)Install nvidia-dkms, nvidia-utils and lib32-nvidia-utils packages
sudo pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utilsopen the file /etc/mkinitcpio.conf and make delete the word 'kms' from the line which contains Hooks()
HOOKS=(base udev autodetect microcode modconf keyboard keymap consolefont block filesystems fsck)
# make sure this line does not contain the word kmsOpen grub config file and add the following statements after GRUB_CMDLINE_LINUX_DEFAULT
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 splash nvidia-drm.modeset=1"Recreate grub
sudo grub-mkconfig -o /boot/grub/grub.cfgOpen your mkinitcpio conf and add the following to the Modules line
sudo nano /etc/mkinitcpio.conf
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)recreate initramfs
sudo mkinitcpio -PYou have completed all steps to install proprietary nvidia drivers. You can reboot your system now or move onto the next steps which explain how to install CUDA and other nvidia tools
nvidia-settings package can be used to configure the GPU
sudo pacman -S nvidia-settingsOverclocking
In an xorg session you can overclock your nvidia GPU using Green With Envy which is available through flathub and the AUR
AUR
paru -S gweFlatpak
sudo pacman -S flathub
Discover store -> search -> green with envyPRIME
install nvidia-prime and launch applications using prime-run
sudo pacman -S nvidia-prime
prime-run vkcubeInstall the above proprietary drivers then follow the instructions
Install opencl-nvidia and cuda
sudo pacman -S opencl-nvidia cudaInstall cuda-tools for nvvp and nsight
sudo pacman -S cuda-toolsinstall cudnn for NVIDIA CUDA Deep Neural Network library
sudo pacman -S cudnn