Skip to content
Jiří Janoušek edited this page Sep 24, 2020 · 13 revisions

NVidia Proprietary Drivers

Flatpak applications cannot simply use the proprietary driver from your system because they are sandboxed. It is necessary to install a corresponding Nvidia driver extension for Flatpak, which are available on Flathub.

If your system happens to have a recent release of Flatpak and GNOME Software, the corresponding extension should be installed automatically when you run flatpak update or perform an update from GNOME Software. However, I don't know exactly which versions are needed and older ones were buggy.

Changes

  • August 21st, 2018: Added a note not to install 32bit driver (Platform.GL32.nvidia).
  • July 23rd, 2018: Added a note about the issue with Nvidia 396.24.02.
  • May 19th, 2018: The instructions were updated to reflect the fact that new Nvidia drivers are now uploaded to Flathub repository instead of GNOME repository, which is no longer updated. If you followed the old instructions, add Flathub repository to get new Nvidia drivers in the future.

Issues

  • Nvidia 396.24.02: This version seems to be a beta release with the final release being called just "396.24". If you are stuck with Nvidia 396.24.02, please participate in the discussion at the Flatpak issue #1786. The issue is unlikely to be solved without your cooperation. See also Nuvola issue #443 for a workaround.

Instructions

Although flatpak graphics drivers should be automatically installed, you might want to try these commands first:

flatpak update --system && flatpak update --user

If your issue persist, continue reading.

The key is to have matching versions on your system as well as corresponding Nvidia flatpak runtime.

  1. Find out the name of Flathub remote. It is printed in the first column (flathub in the example below).

    $ flatpak remote-list --show-details | grep flathub
    flathub	Flathub	https://dl.flathub.org/repo/	1	system
    

    If there is no Flathub remote, add it:

    $ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    
  2. Then list available Platform.GL.nvidia runtimes:

    $ flatpak remote-ls flathub | grep Platform.GL.nvidia
    org.freedesktop.Platform.GL.nvidia-304-134
    org.freedesktop.Platform.GL.nvidia-304-135
    org.freedesktop.Platform.GL.nvidia-340-101
    org.freedesktop.Platform.GL.nvidia-340-102
    org.freedesktop.Platform.GL.nvidia-367-57 
    org.freedesktop.Platform.GL.nvidia-370-28 
    org.freedesktop.Platform.GL.nvidia-375-26 
    org.freedesktop.Platform.GL.nvidia-375-39 
    org.freedesktop.Platform.GL.nvidia-378-13 
    org.freedesktop.Platform.GL.nvidia-381-09 
    org.freedesktop.Platform.GL.nvidia-381-22
    
  3. Find out the version of Nvidia driver on your system. It's 381.22 in the example below and the corresponding Nvidia flatpak runtime is ...GL.nvidia-381-22 (a dot replaced with a dash). Note: There might also be ...GL32.nvidia-381-22 but don't install that, it's for 32bit system.

    $ cat /sys/module/nvidia/version
    381.22
    
  4. Now let's make sure that the version on your system matches the version of the Nvidia driver flatpak runtime.

    • If there is an Nvidia flatpak runtime that matches the version of your system Nvidia driver, install it:

      $ flatpak install flathub org.freedesktop.Platform.GL.nvidia-381-22
      
    • If the version of your system Nvidia driver is higher than any of the available Nvidia flatpak runtimes, create an issue in Nuvola bug tracker unless it has already been created.

    • Otherwise, please upgrade the driver on your system to the latest version that is supported by flatpak (381.22 in the example above) and install the corresponding flatpak runtime (see the first bullet point above). If you cannot upgrade the driver (e. g. because of a complex Tensorflow or CUDA set-up), create an issue in Nuvola bug tracker to find out what other options are possible in your case.

Host driver as unmanaged extension

You can use your host drivers inside Flatpak sandbox as an unmanaged extension (Using host Nvidia driver with Flatpak).

First, find out what is your Nvidia driver version:

$ cat /sys/module/nvidia/version
418.40.04
$ flatpak --gl-drivers
nvidia-418-40-04
default
host

In this example, the driver version is 418.40.04 and the driver name for Flatpak is nvidia-418-40-04.

Then download a package or an archive containing the same driver as used on your system.

This example is based on a real Nvidia CUDA installation where the user downloaded a libnvidia-gl-418_418.40.04-0ubuntu1_amd64.deb package and unpacked the deb file to find a data.tar.xz archive inside.

Next, create and populate a directory ~/.local/share/flatpak/extension/org.freedesktop.Platform.GL.<flatpak driver name>/x86_64/1.4.

Replace <flatpak driver name> with the proper Flatpak driver name. In this example, the path is ~/.local/share/flatpak/extension/org.freedesktop.Platform.GL.nvidia-418-40-04/x86_64/1.4.

The structure of the directory is as follows:

[~/.local/share/flatpak/extension/org.freedesktop.
Platform.GL.<flatpak driver name>/x86_64/1.4]
├── glvnd
│   └── egl_vendor.d
│       └── 10_nvidia.json
├── lib
│   ├── libGLX_nvidia.so.X.Y
│   └── All libs omitted for brevity…
└── vulkan
    └── icd.d
        └── nvidia_icd.json

In this example, the content of the directory was populated from the data.tar.xz archive mentioned earlier.

  • The content of glvnd comes from data.tar.xz/usr/share/glvnd.
  • The content of vulkan comes from data.tar.xz/usr/share/vulkan.
  • The content of lib comes from data.tar.xz/usr/lib/x86_64-linux-gnu.

Finally, test that it works.

  • Run flatpak run --command=ls org.gnome.Platform//3.34 -lhR /usr/lib/x86_64-linux-gnu/GL. If the directory is not empty, the driver might be recognized.
  • Run Nuvola.