**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](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351879/inxi.txt)
and
[glxinfo.txt](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351884/glxinfo.txt)
VLC run, with "-vv" option,
[VLCcrash_verbose.txt](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351890/VLCcrash_verbose.txt)
VLC debug,
[VLC_debug.txt](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351909/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](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351971/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](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13351994/flatpak.ods)
[flatpak.xls](https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/files/13352002/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