flathub / org.freedesktop.Platform.GL.nvidia

42 stars 40 forks source link

Several flatpak applications, on operating systems with Nvidia GPU and 390-157 driver, with "org.freedesktop.Platform.GL.nvidia-390-157" runtime, don't launch. #211

Closed MikeNavy closed 2 weeks ago

MikeNavy commented 8 months ago

Context Several flatpak applications don't launch. Calibre: https://github.com/flathub/com.calibre_ebook.calibre/issues/195 VLC: https://github.com/flathub/org.videolan.VLC/issues/193 KeePass XC: https://github.com/keepassxreboot/keepassxc/issues/9979 Flycast and Xemu: https://github.com/flyinghead/flycast/issues/1199 VLC, Moonlight Stream and Anki: https://forums.linuxmint.com/viewtopic.php?p=2395169#p2395169 On my computer, Calibre, VLC, Gnome Sudoku and Crow Translate don't launch.

Description

Most applications crash with "*** stack smashing detected ***: terminated" error; Anki launches itself in command-line mode.

Acceptance Criteria

I have made a full debug of VLC 3.0.20 on my computer:

My computer: see inxi.txt and glxinfo.txt

VLC run, with "-vv" option, VLCcrash_verbose.txt

VLC debug, VLC_debug.txt

Debug shows that the problem is related to GLX driver not launched.

Note that VLC 3.0.20, installed on my system from this PPA, https://launchpad.net/~ubuntuhandbook1/+archive/ubuntu/ppa, does work.

Other tests:

Using Flatseal, I have tried to launch VLC with or without Wayland ("socket=wayland" option), with or without GPU acceleration ("device=dri" option) and with or without access to all devices ("device=all" option), with no change on the result, still crash with "*** stack smashing detected *** terminated" error.

Finally, I launched VLC without X11 ("socket=x11" disabled using Flatseal. VLC is then launched in command line mode:

flatpak run org.videolan.VLC
VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b)
[00005627f342eb80] main interface error: no suitable interface module
[00005627f33456d0] main libvlc error: interface "globalhotkeys,none" initialization failed
[00005627f33456d0] main libvlc: Lancement de vlc avec l’interface par défaut. Utiliser « cvlc » pour démarrer VLC sans interface.
[00005627f342eb80] skins2 interface error: cannot initialize OSFactory
[00005627f33e8140] main playlist: playlist is empty
[00005627f342eb80] [cli] lua interface: Listening on host "*console".
VLC media player 3.0.20 Vetinari
Command Line Interface initialized. Type `help' for help.
>

This confirms issue is related to graphics display.

Another user has debugged KeePass XC, see https://github.com/keepassxreboot/keepassxc/issues/9979

Same conclusion for the debug, issue is related to the graphics display.

Finally, user grzegosz, having switched from Nvidia driver to Nouveau one, sees that Anki launches, while it didn't with Nvidia driver. (see https://forums.linuxmint.com/viewtopic.php?p=2395169#p2395169)

Looking at the 9 applications failing to launch that I have identified (Calibre, Gnome Sudoku, Anki, Crow Translate, Flycast, KeePass XC, Moonlight Stream, VLC, xemu), I noticed that all the issues were related to users with Linux Mint 20.x (based on Ubuntu 20.04) and Linux Mint 21.x (based on Ubuntu 22.04), with Nvidia GPU and 390-157 driver, using "org.freedesktop.Platform.GL.nvidia-390-157" runtime.

390.157 driver has been released by Nvidia on 2022.11.22 and is no longer maintained. It has been provided by Ubuntu on 2022.12.02 for 18.04 (Bionic) and 20.04 (Focal) versions; on 2023.06.21 for 22.04 (Jammy) and 23.04 (Lunar) versions; on 2023.07.19 for 23.10 (Mantic) version; and it has been available for future 24.04 (Noble) version since 2023.11.04, see https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa/+packages.

--> It is still provided by Ubuntu, including for its most recent versions.

Here is the list of Nvidia 390-57 supported GPUs, supported_GPUs.txt

flatpak remote-info --log flathub org.freedesktop.Platform.GL.nvidia-390-157 shows that the runtime is actively maintained, with the latest commit dated 2023.11.07.

Downgrading "org.freedesktop.Platform.GL.nvidia-390-157" to its oldest commit "604fecbb09870d0e136543305f723d33a0c01a2a7614380adb9f1feb30ca4448" dated 2022.11.28 did not allow launching VLC.

I have tested a set of flatpak applications on my computer, including the ones I use (and that work) and the ones that don't launch. See flatpak.ods flatpak.xls

First part test results:

With the most recent runtimes versions:

Among 4 tested applications using "org.freedesktop.Platform/x86_64/23.08", only one fails.

Among 8 tested applications using "org.gnome.Platform/x86_64/45", only one fails.

One application using "org.gnome.Platform/x86_64/6.5" works.

Among 7 tested applications using "org.kde.Platform/x86_64/5.15-23.08", 7 fail.

--> On the 20 tested applications using recent runtimes, 11 work and 9 fail.

--> Those tests confirm that 9 applications (Calibre, Gnome Sudoku, Anki, Crow Translate, Flycast, KeePass XC, Moonlight Stream, VLC, xemu) fail.

It is difficult to extract a scheme of non-working application, except for "org.kde.Platform/x86_64/5.15-23.08" where there are 100% failures.

With older runtimes versions:

One application using "org.kde.Platform/x86_64/5.15-21.08" works.

Among 3 applications using "org.kde.Platform/x86_64/5.15-22.08", the 3 work.

Among 6 tested applications using "org.freedesktop.Platform/x86_64/22.08", the 6 work.

One application using "org.gnome.Platform/x86_64/43" works.

Second part test results:

I have uninstalled and masked "org.freedesktop.Platform.GL.nvidia-390-157" and tested again the 9 applications that had formerly failed.

Among these 9 applications, 4 applications (Gnome Sudoku, Crow Translate, KeePass XC and xemu) now launch and work. The other 5 ones fail with various errors, all related to graphics display.

Workarounds

Replace non-working flatpak applications with debs, AppImages or snaps. When sandboxing is needed, use snaps or Firejail

Use nouveau driver instead of Nvidia one; consequences: on non-flatpak apps, Cuda is not available; OpenCL and Vulkan can be simulated by the microprocessor, for compatibility reasons, but this does not give any extra computational power (several programs, including LibreOffice, can use OpenCL); VMware virtual machines can no longer have 3D acceleration graphics (this requires Nvidia GPU and driver).

Users with an Nvidia GPU with Optimus Prime have two GPUs in their computer (one in the microprocessor, and the Nvidia one). They can select the microprocessor one, with its nouveau driver, when they launch a flatpak (and uninstall and mask org.freedesktop.Platform.GL.nvidia-390-157), while selecting Nvidia GPU when they need Cuda, OpenCL or Vulkan for non-flatpak apps.

The apps working without org.freedesktop.Platform.GL.nvidia-390-157 can be installed in the user space, then org.freedesktop.Platform.GL.nvidia-390-157 uninstalled, masked for the user space, and installed again for system installed flatpaks applications.

--> None of these workarounds is completely satisfactory.

Conclusion

"org.freedesktop.Platform.GL.nvidia-390-157" runtime is there to allow flatpak applications to use Nvidia GPUs with 390-157 driver, and to take the maximum of these GPUs (graphics acceleration, OpenCL, Vulkan etc.).

But it prevents the launch of several applications (9 identified) using recent runtimes. Without the runtime, 4 of these applications can work, while the 5 others cannot.

Several workarounds are possible, but none is completely satisfactory.

Issue correction would be the best solution.

I do understand that "org.freedesktop.Platform.GL.nvidia-390-157" runtime uses Nvidia provided driver and that runtime developers cannot do much.

However, Ubuntu provided drivers, even for its most recent operating systems, based on the same Nvidia provided driver do allow a good working of Nvidia GPUs with 390-157 driver.

So, driver use by Ubuntu differs of driver use by "org.freedesktop.Platform.GL.nvidia-390-157", this might be a beginning to investigate the issue.

Regards,

MN

tcoopman commented 7 months ago

I just tried flatpak for the first time to install obs studio, and I think I ran into the same problem...

Froleatric commented 6 months ago

Starting application Luminance HDR (net.sourceforge.qtpfsgui.LuminanceHDR) results in " stack smashing detected : terminated".

LonelyMusicDisc commented 6 months ago

I have the same issue, and can't seem to get a verbose log/stacktrace of any kind.

aeerdogan commented 3 months ago

Can confirm this issue with Linux Mint 21.3 here. Krita and VLC gave the same error. Also using the same Nvidia driver with Geforce 540M

burny2 commented 1 month ago

In the current freedesktop runtime branch 23.08 a library search path seems to have been changed, which leads to a broken version of libnvidia-tls.so.390.157 being loaded.

I found a note about this in the Arch Linux forum: https://bbs.archlinux.org/viewtopic.php?pid=2083651#p2083651.

My rather crude solution is to replace the broken versions of libnvidia-tls.so.390.157 with the previously working ones in the corresponding flatpak runtime installation directories and to mask the packages to prevent further updates (which possibly would undo the replacements).

For "org.freedesktop.Platform.GL.nvidia-390-157" in Linux Mint 21.3 (path may differ in other OSs):

cd /var/lib/flatpak/runtime/org.freedesktop.Platform.GL.nvidia-390-157/x86_64/1.4/active/files/extra
sudo rm libnvidia-tls.so.390.157
sudo ln -s tls/libnvidia-tls.so.390.157 libnvidia-tls.so.390.157
sudo flatpak mask org.freedesktop.Platform.GL.nvidia-390-157

For "org.freedesktop.Platform.GL32.nvidia-390-157":

cd /var/lib/flatpak/runtime/org.freedesktop.Platform.GL32.nvidia-390-157/x86_64/1.4/active/files/extra
sudo rm libnvidia-tls.so.390.157
sudo ln -s tls/libnvidia-tls.so.390.157 libnvidia-tls.so.390.157
sudo flatpak mask org.freedesktop.Platform.GL32.nvidia-390-157

The following packages are working for me again:

I don't know if there are any negative side effects with this solution. Perhaps someone in charge of this package will take over the task and find a more elegant solution.

MikeNavy commented 1 month ago

Hi, @TingPing Thank you for your workaround!

I did something similar:

sudo cp /usr/lib/x86_64-linux-gnu/tls/libnvidia-tls.so.390.157 /var/lib/flatpak/runtime/org.freedesktop.Platform.GL.nvidia-390-157/x86_64/1.4/active/files/extra/libnvidia-tls.so.390.157
flatpak mask org.freedesktop.Platform.GL.nvidia-390-157

This avoids making a symlink for "libnvidia-tls.so.390.157", since there are two different versions of this elf, one in "/usr/lib/x86_64-linux-gnu" and one in "/usr/lib/x86_64-linux-gnu/tls". The archlinux link you gave explains why there are two diferent versions, normally automatically chosen when needed. My workaround doesn't affect the whole system, only flatpaks. My workaround allowed me to run flatpak vlc, not working without the workaround, while flatpak Pinta and Gimp can work with or without the workaround (they are unaffected by the workaround). Nice to have flatpaks working again!

[Tested on Linux Mint 21.3 Virginia, based on Ubuntu 22.04 LTS, with Mate 1.26 desktop and 5.15.0-107-generic kernel; Nvidia GeForce GTX 560 M, Nvidia 390.157 driver].

Regards,

MN

PS1: no need to write a "sudo" before each flatpak command, as an example "flatpak mask..." and not "sudo flatpak mask...".

PS2: normally, "org.freedesktop.Platform.GL.nvidia-390-157" and "org.freedesktop.Platform.GL32.nvidia-390-157" runtimes will not be updated; they are compiled at installation from Nvidia 390.157 driver sources, and this 390.157 driver is no longer maintained by Nvidia.