Chromium/Electron Applications Hang on Launch on GNOME Wayland

Use gnome wayland following the instructions in the developer guide Weston (Wayland) — NVIDIA Jetson Linux Developer Guide 1 documentation

Attempt to run all chromium/electron applications and they hang on launch.
Example: github-desktop (install the latest ARM64 deb from the official linux fork Releases · shiftkey/desktop · GitHub). You may find it convenient to also test multiple electron versions using electron fiddle Electron Fiddle | Electron

Not an issue on default GNOME xorg on Jetson. Not an issue on other standard GNOME wayland systems (such as AMD MESA on x86_64 desktop).

Hi,
We are checking this with our team. Could you share the steps so that we can replicate the issue on Orin Nano developer kit?

Sure. As indicated in my first post you can easily test by first following your own documentation for using gnome wayland Weston (Wayland) — NVIDIA Jetson Linux Developer Guide 1 documentation and once that is done you can install the latest ARM64 deb release of github-desktop and run it Releases · shiftkey/desktop · GitHub (download the deb directly from the assets and install using your favorite deb installation method).

github-desktop can be run from the corresponding .desktop file or directly from terminal with github-desktop --enable-logging for more verbose logging once installed

Hi,
For information, do you use Jetpack 5.1.2 or 6.0DP?

6.0DP is being used

Hi theofficialgman,

Please follow below steps to launch GNOME Wayland and Electron application:

  1. Enable Wayland from gdm config:
    Set WaylandEnable=true in /etc/gdm3/custom.conf file and save it
  2. Stop gdm
    sudo systemctl stop gdm
  3. Kill X
    sudo pkill X
  4. Set experimental features
    gsettings set org.gnome.mutter experimental-features [\"kms-modifiers\"]
  5. Set gsettings to disable screen timeout
    gsettings set org.gnome.desktop.lockdown disable-lock-screen true
    gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend false
    gsettings set org.gnome.desktop.screensaver lock-enabled false
    gsettings set org.gnome.desktop.session idle-delay 0
    gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
  6. Load nvidia drm module
    sudo modprobe nvidia_drm modeset=1
  7. Start gdm
    sudo systemctl start gdm
  8. Launch electron applications
    $ DISPLAY=:0 /usr/bin/electron-fiddle --no-sandbox

@carolyuu I am already aware that chromium can have its sandboxing tuned back and force applications to run via xwayland. That is out of the scope of this issue and the GPU drivers should be resolved so that these applications run out of the box by default via xwayland and native wayland without disabling sandboxing and without specifying additional environment variables.

That is the case on nvidia desktop GPU drivers and should be made to be the case here as well.

To provide more debug information for nvidia, chromium, and electron developers I have done further testing.

chromium-browser (built from source latest release) does not have issues with sandboxing under wayland and it DEFAULTS to using the vulkan backend (this is important). So if I start wayland using the above steps I can run chromium-browser and it starts up just fine. If I force vulkan to be disabled (chromium-browser --disable-features=Vulkan) then I have the SAME issue as presented in my original post (hangs/black screen).

electron applications (even electron 28.1.2 which uses chromium 120.0.6099.199, the latest release version) DEFAULT to using OpenGL with Vulkan DISABLED. So they experience the problem because that is the same as upstream chromium if you manually disable Vulkan. Now why the DEFAULT is different on electron vs chromium I am not sure.

If I manually enable the Vulkan feature on the electron applications electron-fiddle --enable-features=Vulkan then it works. I used electron-fiddle to download the latest electron version, made sure it was the currently selected version for testing, then ran ~/.config/Electron\ Fiddle/electron-bin/current/electron chrome://gpu --enable-features=Vulkan so I could see the gpu info for electron and although Vulkan is enabled at the top, is still reporting OpenGL 4.5.0 in use under GL_RENDERER which is strange because chromium reports Vulkan 1.3.251. Adding --use-vulkan to the previous command does not change the results. For the vulkan feature flag not being enabled by default in electron I have opened a bug report (since it is the same on all electron releases on x64 and arm64 [Bug]: Vulkan feature is disabled by default on Linux (not the case on Chromium and Chrome) · Issue #40929 · electron/electron · GitHub)

So what needs to happen is nvidia/chromium need to investigate why the sandboxing (which is of course enabled by default for security purposes) is preventing the Nvidia OpenGL drivers from being found and used if Vulkan is disabled. When Vulkan is enabled, OpenGL and Vulkan work fine (in chromium) for starting the browser and “appear” fine in chrome://gpu but fail in WebGL benchmarks with missing features that are not missing when running GNOME X11.

Hi,
Thanks for your further information. We have checked it with our team and it looks to be this issue:
Bug #2028864 “[snap] chromium browser does not work with acceler...” : Bugs : chromium-browser package : Ubuntu

We are working on it with Ubuntu team.

No this is a different issue.

With snaps the problem is complex. Snaps do not have full access to the host system userspace libraries (that includes the userspace nvidia drivers). Snaps have multiple totally different ways of accessing the drivers… because of course there can’t just be one method! On method is the “core” snaps that you were already pointed to by ubuntu GitHub - snapcore/nvidia-core22 .

Another is a builtin interface in snapd. For OpenGL/Vulkan, snaps implement an “opengl” interface Adding OpenGL/GPU support to a snap | Snapcraft documentation where certain host libraries are allowed into the snap confine snapd/interfaces/builtin/opengl.go at master · snapcore/snapd · GitHub . Immediately I see multiple bugs.

snapd does not have access to the file /usr/lib/aarch64-linux-gnu/nvidia/nvidia_icd.json directly. Your vulkan icd file is a symlink in /etc/vulkan/icd.d/nvidia_icd.json to /usr/lib/aarch64-linux-gnu/nvidia/nvidia_icd.json. While snap appears to mount most of /etc/ it does not mount most of /usr directly and so the symlink breaks inside the snap (which is why chromium cannot read it). You would be able to see this in this post but the text here is red because the symlink is broken

root@gman-orin:/# ls -l /var/lib/snapd/hostfs/etc/vulkan/icd.d/nvidia_icd.json 
lrwxrwxrwx 1 root root 49 Nov 30 13:57 /var/lib/snapd/hostfs/etc/vulkan/icd.d/nvidia_icd.json -> /usr/lib/aarch64-linux-gnu/nvidia/nvidia_icd.json

If you manually break the symlink on the host so that is a normal independent file, chromium in the snap can now read the json but there are further bugs

Warning: libGLX_nvidia.so.0: cannot open shared object file: No such file or directory
Warning: loader_icd_scan: Failed loading library associated with ICD JSON libGLX_nvidia.so.0. Ignoring this JSON
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:101)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:493)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:379)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:301)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:556)

Now you might ask why this is, because /var/lib/snapd/hostfs/lib/aarch64-linux-gnu/nvidia is available in the snap. Well that path is restricted by AppArmor that we already talked about earlier snapd/interfaces/builtin/opengl.go at master · snapcore/snapd · GitHub and the /var/lib/snapd/hostfs/lib/aarch64-linux-gnu/nvidia needs to be allowed through.
Firstly, snapd/interfaces/builtin/opengl.go at 4f59ae0fa2ea0f3b51b49ff39dec8b8ae3771096 · snapcore/snapd · GitHub is missing GLX in the list, that needs to be added (desktop GPU drivers likely need it too). And then ofc the entire /nvidia/ and /tegra/ and /tegra-egl/ folders all need to be passed in. And then finally when all that is done, the snap needs to know to look for the dynamic libraries inside the nvidia/tegra/tegra-egl folders and not just in the typical /usr/lib/aarch64-linux-gnu folder

Basically the whole thing is a disaster, none of the vulkan/gl/egl json files are made available as is, and none of the nvidia userspace gpu libraries are made available as it.

For your developers here is an easy to use way to “enter” a snap and run simple ls and cd commands so you can see what files are available in a snap Documentation of /var/lib/snapd/hostfs - #2 by Lin-Buo-Ren - doc - snapcraft.io

and incase you wonder if the new system works snapd/cmd/snap-confine/mount-support-nvidia.c at master · snapcore/snapd · GitHub no it does not because it relies on reading the /sys/module/nvidia/version file to determine the driver version (which does work on orin and comes back with 540.2.0) but then uses that string to map it to all the driver files that contain that string appended to the end (like the nvidia desktop driver files are distributed but not tegra)

Because of the snap disaster that is why I continue to make flatpak support which is pretty painless. This is the whole json that can be used to build gpu driver support (gl/egl/gles/vulkan) in flatpak

On 35.4.1, no additional flatpak overrides were necessary, however, on 36.2.0, the use of one disallowed /dev node has returned so we have to add the sudo flatpak override --device=all and flatpak override --user --device=all overrides.

How to keep these changes persistent?

Hi,
For enabling a service in system startup, please refer to
Jetson AGX Orin FAQ

Q: How to autorun an app or commands at startup?

@theofficialgman @DaneLLL Did you have any progress with this? I think I have similar/same problem, I tried popular FOSS GAN upscaling program GitHub - upscayl/upscayl: 🆙 Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows. that is packed in electron and using vulkan.

After I set

export VK_ICD_FILENAMES=/usr/lib/aarch64-linux-gnu/nvidia/nvidia_icd.json

and running the app

I get same errors:

Warning: loader_get_json: Failed to open JSON file /usr/lib/aarch64-linux-gnu/nvidia/nvidia_icd.json
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521

It’s sad that it doesn’t run, because Jetsons got Vulkan 1.3 with JP 6.0 so it would be nice to be able to run these generative AI applications!

So are you saying it’s more of electron not seeing config files or how it integrates with Nvidia vulkan files? Rpi5 recently too got Vulkan 1.3 so I will try to run it there too.

Hi,
Chromium team is still checking this per
Bug #2028864 “[snap] chromium browser does not work with acceler...” : Bugs : chromium-browser package : Ubuntu
Comment #17 : Bug #2028864 : Bugs : chromium-browser package : Ubuntu