SDB:NVIDIA drivers

Jump to: navigation, search


By default, openSUSE provides the opensource nouveau driver for NVIDIA GPUs. For advanced use cases, you may want to use NVIDIA's own drivers. NVIDIA provides an open driver and proprietary one. You can find details in this openSUSE Blog article.

Installation

While it is possible to use the official installer from NVIDIA's own website, we advise using openSUSE's package management tools instead (see below). Guidance on using NVIDIA's official installer can be found here. Additional instructions can be found in the maintainers blog.

If you disabled multiversion kernel packages, make sure you re-enable them in /etc/zypp/zypp.conf. It should contain the line multiversion = provides:multiversion(kernel).

The drivers are provided via NVIDIA's openSUSE repository for licensing reasons. You'll be asked whether you trust NVIDIA's GPG key the first time you reload the software repositories. The fingerprint of this key should be 2FB0 3195 DECD 4949 2BD1 C17A B1D0 D788 DB27 FD5A.

If you are upgrading to a new GPU, we recommended that you uninstall any NVIDIA drivers that may be specific to your old hardware before replacing the card.

Adding the NVIDIA repository

Via terminal

Leap, Tumbleweed, Slowroll

As root, enter one of the following command (matching your openSUSE distribution flavour) in a terminal.

# zypper install openSUSE-repos-Leap-NVIDIA
# zypper install openSUSE-repos-Tumbleweed-NVIDIA
# zypper install openSUSE-repos-Slowroll-NVIDIA

or

# zypper addrepo --refresh 'https://download.nvidia.com/opensuse/leap/$releasever' NVIDIA
# zypper addrepo --refresh https://download.nvidia.com/opensuse/tumbleweed NVIDIA

(ATM the Tumbleweed repository is also used by Slowroll.)

Aeon, Kalpa, Leap Micro

For a successful driver installation there are more steps required.

As root, enter the following in a terminal:

# cp /usr/etc/transactional-update.conf /etc/transactional-update.conf

Open the newly created file with super user privileges:

# vim /etc/transactional-update.conf

and enter:

ZYPPER_AUTO_IMPORT_KEYS=1

Save the file using ESC + :q. As root enter the following in a terminal:

# transactional-update -i pkg install openSUSE-repos-MicroOS-NVIDIA

Via GUI (only on Leap and Tumbleweed)

  1. Open YaST, then click Software Repositories.
  2. Click Add (in the bottom left), then select Community Repositories.
  3. Select NVIDIA Graphics Drivers, then click OK.

Automated installation (tested on Tumbleweed)

To auto-detect and install the right driver for your hardware, run

# zypper install-new-recommends --repo repo-non-free

or

# zypper install-new-recommends --repo NVIDIA

Which command to choose depends on how you added the NVIDIA repository and which name the repo has.

Manual installation

Get the hardware information

In a terminal:

# lspci | grep VGA
# lscpu | grep Arch

Alternatively:

# hwinfo --gfxcard | grep Model
# hwinfo --arch

Using inxi utility:

# inxi -G
# inxi -Ga

This information is also available in the Display subsection at YaST Hardware Information.


Determination of driver version

Beware: NVIDIA's site may declare a shorter support period with the same chip for mobile graphics compared to desktop video cards. This is not true for Linux drivers (more info here). openSUSE provides a unified Linux driver for all flavours: GeForce and Quadro, desktop and mobile. The driver decides during startup whether it supports this GPU or not.

To determine the appropriate driver for your card, put your hardware information into NVIDIA's driver search engine.

Note: NVIDIA driver versions are mapped to the following naming convention listed below. You will need this information when you are ready to install via commandline/zypper.

  • G03 = driver v340 = legacy driver (via a community user)
  • G04 = driver v390 = legacy driver (Fermi devices)
  • G05 = driver v470 = driver for Kepler devices
  • G06 = driver v550/v570 = driver for Maxwell, Pascal devices and up

Note: Some OEMs use different chip familys (Kepler, Fermi) for the same product, as example GeForce 730.

Icon-warning.png
Warning: Legacy drivers G03 and G04 won't work with the actual kernel 6.6.x series. Use free nouveau drivers instead!

Installation

Alternatively, YaST Software or the following command can be used to check the available packages:

# zypper se -s x11-video-nvidia*G0* nvidia-video-G0* nvidia-gl*G0* nvidia-compute*G0* nvidia-compute-utils-G0*


Example driver search result for G06 (G04 and G05 filtered out):

S  | Name                      | Type    | Version         | Arch   | Repository
---+---------------------------+---------+-----------------+--------+---------------
   | nvidia-compute-G06        | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-compute-G06-32bit  | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-compute-utils-G06  | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-gl-G06             | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-gl-G06-32bit       | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-video-G06          | package | 570.124.04-32.1 | x86_64 | repo-non-free
   | nvidia-video-G06-32bit    | package | 570.124.04-32.1 | x86_64 | repo-non-free

If you are going to install CUDA later, then you must use the latest driver version (G06 as of Feb, 2024).

YaST (for Leap and Tumbleweed)

  1. Go to the YaST Control Center and click Software Management.
  2. View > Repositories > NVIDIA
  3. Choose the appropriate driver, e.g. x11-video-nvidiaG04 or x11-video-nvidiaG05 or nvidia-video-G06
  4. Optionally choose the corresponding OpenGL acceleration libraries; nvidia-glG04 or nvidia-glG05 or nvidia-gl-G06.
  5. Press Accept.
  6. Restart your computer.

Command line

It's for the moment the only way to install the drivers in openSUSE Aeon and Kalpa.

Once you know which product is mapped to the appropriate driver command mapping (e.g. G04 or G05 or G06), you can use :

Leap and Tumbleweed
# zypper in <x11-video-nvidiaG04 or x11-video-nvidiaG05 or nvidia-video-G06>
# zypper in <nvidia-glG04 or nvidia-glG05 or nvidia-gl-G06>
# zypper in <nvidia-computeG04 or nvidia-computeG05 or nvidia-compute-G06 and nvidia-compute-utils-G06>
Aeon and Kalpa
  • For nvidia-video-G06 :
# transactional-update -i pkg in nvidia-driver-G06-kmp-default nvidia-video-G06 nvidia-gl-G06 nvidia-compute-G06
  • For x11-video-nvidiaG05 :
# transactional-update -i pkg in nvidia-gfxG05-kmp-default x11-video-nvidiaG05 nvidia-glG05 nvidia-computeG05
  • For x11-video-nvidiaG04 :
# transactional-update -i pkg in nvidia-gfxG04-kmp-default x11-video-nvidiaG04 nvidia-glG04 nvidia-computeG04
Whenever nonfree drivers get installed or updated the user by default has to manually accept the licenses in order to update. This is not an issue unless you want to automate updating your system on distributions such as MicroOS, Aeon or Kalpa. The auto updater will stop working whenever zypper needs you to manually agree to the license of the Nvidia driver updates. In these cases, you can get Zypper to autoaccept proprietary licenses by editing /etc/zypp/zypper.conf as described below:
# vim /etc/zypp/zypper.conf

uncomment the line:

#autoAgreeWithLicenses = no

and change it to:

autoAgreeWithLicenses = yes

Restart your computer.

Secureboot

Kernels in Leap 15.2 or higher (and Tumbleweed since Kernel 6.2.1) will, by default, refuse to load any unsigned kernel modules on machines with secure boot enabled.

During the NVIDIA driver installation on a secureboot system a MOK keypair is created and the kernel modules are signed with the created private key. The created certificate (public key) remains on the storage below /usr/share/nvidia-pubkeys, and the installer attempts to import it to the list of to-be-enrolled MOK pubkeys.

During the following reboot this certificate can easily be enrolled to the MOK database. The EFI tool for this (mokutil) is automatically started: inside the tool select "Enroll MOK", then "Continue", then "Yes". Use your root password (US keyboard layout!) when prompted for a password. The certificate is now added to the MOK database and is considered trusted, which will allow kernel modules with matching signatures to load. To finish, select "Reboot".

Nvidia-secureboot-enrollKey.jpg

In case the import fails (for example, when no root password is set), or you miss the timeout for certificate enrollment after first reboot, you can easily import the certificate again by running the following command:

  • For nvidia-driver-G0X (X >= 6):
# mokutil --import /usr/share/nvidia-pubkeys/MOK-nvidia-driver-G0<X>-<driver_version>-<kernel_flavor>.der --root-pw
  • For nvidia-gfxG0X (X < 6):
# mokutil --import /usr/share/nvidia-pubkeys/MOK-nvidia-gfxG0<X>-<driver_version>-<kernel_flavor>.der --root-pw

Then reboot the machine and enroll the certificate as described before.

As a last resort, in case you are having problems with secure boot, you can, at your own risk, disable validation for kernel modules:

# mokutil --disable-validation


Driver Update

During a driver update the old and no longer used public key is being registered to be deleted from the MOK data base. So in addition to the "Enroll MOK" menu entry, a "Delete MOK" entry will appear in the EFI tool once you reboot the machine. In order to finally remove it from the MOK data base, select "Delete MOK", then "Continue", then "Yes". Use your root password (US keyboard layout!) when prompted for a password. You can show the certificate/description of the public key when selecting "View Key X" in order not to delete the wrong key. Press any key to continue from there.

Nvidia-secureboot-deleteKey.jpg

Uninstalling the NVIDIA driver

Identify every package that has been installed from the NVIDIA repo. As the repository name may differ, dependend how it was added, you first need to identify the correct repository:

# zypper lr
# zypper search -ir <repo name or number>

For a proper cleanup, you may want to uninstall all listed packages.

When installing the NVIDIA driver, the nouveau driver may have been added to the blocklist. To ensure the opensource driver is allowed to take over again, make sure that there are no files containing the words blacklist nouveau at /etc/modprobe.d/. Also check that /etc/default/grub no longer contains rd.driver.blacklist=nouveau and that grub2-mkconfig -o /boot/grub2/grub.cfg ran to update grub.cfg. After uninstalling the packages, you might need to recreate the initrd by running:

# dracut -f --regenerate-all

Troubleshooting

  • https://en.opensuse.org/SDB:NVIDIA_troubleshooting
  • If your computer freezes before the login screen after installing the propietary drivers and you are using GDM (usually the case if you are using GNOME), try adding WaylandEnable=false in /etc/gdm/custom.conf. This will disable the GNOME Wayland session as an option during login. If you want Wayland to still be enabled, run the command below and reboot.
 # sudo ln -sfv /dev/null /etc/udev/rules.d/61-gdm.rules
  • KDE may not work with Wayland protocol.
  • You can verify the driver was actually loaded by running lsmod | grep nvidia in the terminal. The output should be like:
nvidia_drm             57344  2
nvidia_modeset       1187840  3 nvidia_drm
nvidia_uvm           1110016  0
nvidia              19771392  81 nvidia_uvm,nvidia_modeset
drm_kms_helper        229376  2 nvidia_drm,i915
drm                   544768  13 drm_kms_helper,nvidia_drm,i915

The numbers in the middle column do not need to be the same. If the driver is loaded the problem relies elsewhere, since that means it was installed successfully.

  • As stated before in this guide, if you are using secure boot make sure you accept the MOK, else the module won't load. One way to know if secure boot could be blocking the module is to look at the output of dmesg and search for warnings like the following:
Lockdown: modprobe: unsigned module loading is restricted; see man kernel_lockdown.7
modprobe: ERROR: could not insert 'nvidia': Required key not available


See also

Optimus

Users on hardware configurations with NVIDIA Optimus (usually the case on laptops) are advised to read SDB: NVIDIA SUSE Prime. Offloading to the dedicated GPU is possible using the instructions at [1]

CUDA

Developers and users involved in High Performance Computing applications may want to install CUDA libraries. Additional instructions are provided at the CUDA Toolkit Documentation and download links at NVIDIA Developer.

The installation instructions for CUDA require adding an NVIDIA-maintained repo. In openSUSE Aeon or Kalpa you must use "transactional-update shell" and then "zypper" within that shell.

WARNING: The repo added is an NVIDIA-maintained repo and contains the same drivers as the openSUSE-mantained repo(s) added above, but often with a less up-to-date a version. However the driver versions and NVML/CUDA libraries in the NVIDIA-maintained repo are designed to be used as matched sets, and using an openSUSE-provided NVIDIA driver with the NVIDIA-provided NVML/CUDA libraries will often result in "NVML library/driver mismatch" errors when they aren't compatible. The driver version must also be compatible with the kernel version though or the driver will fail to build (this won't cause zypper to error out, it will simply result in no nvidia driver being present).

It is recommended to use the 'kernel-longterm' rather than the 'kernel-default' so the NVIDIA-maintained driver can remain compatible with it, and set the NVIDIA-maintained repo to a higher priority than the openSUSE-maintained repo to ensure the working combination of NVML/CUDA libraries and drivers from NVIDIA are used together. Otherwise, every 3 months or so when a newer driver version is released by OpenSUSE, you'll have an unresolvable incompatibility between the NVML/CUDA libraries that still need the older version and the newer driver that's necessary for use with the newer kernel version.

For installation instructions have a look at the maintainers blog.

NVIDIA Container Toolkit

Developers and users involving containerized High Performance Computing applications may want to install the NVIDIA Container Tools to enable GPU usage within containers. Additional instructions are provided at NVIDIA Container Toolkit Documentation.

NVIDIA Container Toolkit is provided in the stand alone NVIDIA-maintained repo mentioned in the NVIDIA documentation, but is also available from the NVIDIA-maintained CUDA repo (see above). CUDA installation is usually also necessary even for purely containerized workloads, so installation of only the NVIDIA-maintained CUDA repo and not the stand alone NVIDIA Container Toolkit repo listed in the documentation is a suggested deviation from the NVIDIA Container Toolkit Documentation.

External links