How to install the NVIDIA drivers on Manjaro 21 Linux

In this tutorial, you will learn how to install the NVIDIA drivers on Manjaro Linux. Installing the NVIDIA driver on Manjaro will increase graphic performance for your computer and enable additional features. You have two choices for installation, either automatic install using the standard Manjaro Repository, or manual install using the official nvidia.com driver.

NOTE
To install Nvidia driver on other Linux distributions, follow our Nvidia Linux Driver guide.

Installed NVIDIA drivers on Manjaro 21 Linux.

Installed NVIDIA drivers on Manjaro 21 Linux. After installation, optionally run Nvidia graphic card test by following our Benchmark Your Graphics Card On Linux guide.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Criteria Requirements
System Manjaro 21 Ornara Linux
Software Existing Desktop installation such as Xfce, GNOME, KDE etc.
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Automatic Installation of NVIDIA driver from Manjaro Repository

The first method is the easiest to perform and in most cases it is the recommended approach. In fact there is not much to write about as the entire installation consists of a single command:

  1. Open up terminal and execute the following command:


    $ sudo mhwd -a pci nonfree 0300
    

    The above command will auto detect and install an appropriate proprietary Nvidia driver on your Manjaro 21 Linux system.

  2. Once the installation is concluded, reboot your system and you are done:
    $ sudo reboot
    
  3. Start Nvidia Settings application to further configure your graphic card:
    $ nvidia-settings
    

Manual NVIDIA Install on Manjaro using the Official Nvidia.com driver

The previous Nvidia drivers installation was rather easy. In the case that you wish to install latest Nvidia drivers or perhaps install a specific Nvidia drivers version directly downloaded from Nvidia.com this is how you can get your hands dirty.

  1. Update your system to load the latest kernel image. Failing this step may result in kernel headers mismatch:
    sudo pacman -Syu
    
  2. Identify your NVIDIA VGA card.The below commands will allow you to identify your Nvidia card model:
    $ lspci -vnn | grep VGA
    
  3. Download the Official Nvidia Driver.
    Using your web browser navigate to the official Nvidia website and download an appropriate driver for your Nvidia graphic card. Save the file into your home directory. Example:

    $ ls
    NVIDIA-Linux-x86_64-460.67.run
    
  4. Install Prerequisites. Development tools and kernel headers are required to compile and install Nvidia driver. Let’ s start by installation of kernel headers. First, we need to detect currently loaded kernel. For example:
    $ uname -r
    5.4.116-1-MANJARO
    

    The kernel headers we need to install are linux54-headers:

    $ sudo pacman -S linux54-headers
    

    Next task is to install development tools. Execute the bellow command and hit ENTER to install all:

    $ sudo pacman -S base-devel dkms
    
  5. In this step we will disable the default nouveau drivers. To do so we need to open and edit the /etc/default/grub Grub configuration file.Locate the line starting with GRUB_CMDLINE_LINUX and include the following code nouveau.modeset=0.


    Example:

    $ sudo nano /etc/default/grub
    

    Alter the GRUB_CMDLINE_LINUX line:

    GRUB_CMDLINE_LINUX="nouveau.modeset=0"
    

    Once you have made the change update GRUB:

    $ sudo update-grub
    
    WARNING
    After reboot, your display manager may NOT start. Do not panic when you are greeted with black screen! Simply change to TTY using ALT+CTRL+F2 key combination or SSH to your Manajaro System remotely and proceed with the next step.

    Reboot your system:

    $ sudo reboot
    
  6. Login and begin the actual installation of Nvidia driver by executing the following linux command and following the wizard:
    $ sudo bash NVIDIA-Linux-x86_64-460.67.run
    

    You may also be asked questions like:

    Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a  new module, if you install a different kernel later. ->YES 
    Install NVIDIA's 32-bit compatibility libraries? -> YES
    Would you like to run the nvidia-xconfig utility? -> YES 
    

    The Nvidia driver is now installed.

  7. Reboot your system:
    $ sudo reboot
    
  8. Configure NVIDIA X Server Settings.
    After reboot you should be able to start NVIDIA X Server Settings app from the Activities menu.

Troubleshooting

  ERROR: Failed to run `/usr/bin/dkms build -m nvidia -v 460.67 -k 5.4.114-1-MANJARO`: Error! echo
         Your kernel headers for kernel 5.4.114-1-MANJARO cannot be found at                                     
         /usr/lib/modules/5.4.114-1-MANJARO/build or /usr/lib/modules/5.4.114-1-MANJARO/source.
         You can use the --kernelsourcedir option to tell DKMS where it's located.            
         
         
  ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing
         again without DKMS, or check the DKMS logs for more information.

The above error message means that the NVIDIA installer could not find the correct kernel headers matching your currently loaded kernel. Usually the reason for this error is that you do not have a your Linux kernel up to date.

For example, if your currently loaded Linux kernel is 5.4.114-1-MANJARO the install Linux kernel headers command pacman -S linux54-headers may install kernel headers for a different minor version eg. 5.4.114-1-MANJARO. To resolve this issue update your kernel to a latest version available using the below update command:

# pacman -Syu

Closing Thoughts

In this tutorial, we saw how to install the NVIDIA drivers on Manjaro Linux. This can be done either from the official Manjaro repository, or the NVIDIA website. Although installation from the web is a few more steps, it guarantees that you are getting the most recent version of the driver.



Comments and Discussions
Linux Forum