dotfiles/NVIDIA.md

2.5 KiB

Step 1: Installing required packages and enabling multilib

  1. Update the system: sudo pacman -Syu
  2. Install required packages: sudo pacman -S base-devel linux-headers git nano --needed
  3. Install the AUR helper, yay
    • cd ~
    • git clone https://aur.archlinux.org/yay.git
    • cd yay
    • makepkg -si
  4. Enable multilib repository
    • sudo nano /etc/pacman.conf
    • Uncomment the following lines by removing the # -character at the start them
      • [multilib]
      • Include = /etc/pacman.d/mirrorlist
    • Save the file with CTRL+S and close nano with CTRL+X
  5. Run yay -Syu, to update the system package database

Step 2: Installing the driver packages

yay -S nvidia nvidia-utils lib32-nvidia-utils nvidia-settings

Step 3: Enabling DRM kernel mode setting

  1. Edit the GRUB configuration file:
    • sudo nano /etc/default/grub
    • Find the line with GRUB_CMDLINE_LINUX_DEFAULT
    • Append the words inside the quotes with nvidia-drm.modeset=1
      • Example: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia-drm.modeset=1"
    • Save the file with CTRL+S and close nano with CTRL+X
  2. Update the GRUB configuration: sudo grub-mkconfig -o /boot/grub/grub.cfg

Add Early Loading of NVIDIA Modules:

  1. Edit the mkinitcpio configuration file:
    • sudo nano /etc/mkinitcpio.conf
    • Find the line that says MODULES=()
    • Update the line to: MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
    • Find the line that says HOOKS=()
    • On the HOOKS=() line, find the word kms inside the parenthesis and remove it
    • Save the file with CTRL+S and close nano with CTRL+X
  2. Regenerate the initramfs with sudo mkinitcpio -P

Adding the Pacman Hook:

  1. Get the nvidia.hook -file from this repository
    • cd ~
    • wget https://raw.githubusercontent.com/korvahannu/arch-nvidia-drivers-installation-guide/main/nvidia.hook
  2. Move the file to /etc/pacman.d/hooks/ with: sudo mv ./nvidia.hook /etc/pacman.d/hooks/

[Trigger] Operation=Install Operation=Upgrade Operation=Remove Type=Package Target=nvidia Target=linux

Adjust line(6) above to match your driver, e.g. Target=nvidia-470xx-dkms

Change line(7) above, if you are not using the regular kernel For example, Target=linux-lts

[Action] Description=Update Nvidia module in initcpio Depends=mkinitcpio When=PostTransaction NeedsTargets Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'