Code OSS will not render GUI in Wayland + Nvidia

I installed Code OSS. When launching the app, it loads the window but no GUI.

                    ./o.                  robbie@endeavour-razerblade15 
                   ./sssso-                ----------------------------- 
                 `:osssssss+-              OS: EndeavourOS Linux x86_64 
               `:+sssssssssso/.            Host: Blade 15 Advanced Model (Mid 2021) - RZ09-0409 7.04 
             `-/ossssssssssssso/.          Kernel: 5.16.11-arch1-2 
           `-/+sssssssssssssssso+:`        Uptime: 1 hour, 55 mins 
         `-:/+sssssssssssssssssso+/.       Packages: 939 (pacman) 
       `.://osssssssssssssssssssso++-      Shell: bash 5.1.16 
      .://+ssssssssssssssssssssssso++:     Resolution: 2560x1440 
    .:///ossssssssssssssssssssssssso++:    DE: GNOME 41.4 
  `:////ssssssssssssssssssssssssssso+++.   WM: Mutter 
`-////+ssssssssssssssssssssssssssso++++-   WM Theme: Adwaita 
 `..-+oosssssssssssssssssssssssso+++++/`   Theme: Mojave-dark [GTK2/3] 
   ./++++++++++++++++++++++++++++++/:.     Icons: WhiteSur-dark [GTK2/3] 
  `:::::::::::::::::::::::::------``       Terminal: gnome-terminal 
                                           CPU: 11th Gen Intel i7-11800H (16) @ 4.600GHz 
                                           GPU: NVIDIA GeForce RTX 3070 Mobile / Max-Q 
                                           Memory: 2517MiB / 15807MiB 

nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.54       Driver Version: 510.54       CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  N/A |
| N/A   53C    P0    25W /  N/A |    595MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1042      G   /usr/bin/gnome-shell              502MiB |
|    0   N/A  N/A      1204      G   easyeffects                         7MiB |
|    0   N/A  N/A      1487      G   /usr/bin/Xwayland                   8MiB |
|    0   N/A  N/A      2350      G   ...350546932265520303,131072       68MiB |
|    0   N/A  N/A      6938      G   gnome-control-center                2MiB |
+-----------------------------------------------------------------------------+

Does it launch with code --enable-features=UseOzonePlatform --ozone-platform=wayland? If yes then you can copy /usr/share/applications/code-oss.desktop to ~/.local/share/applications and modify the “Exec” line accordingly. Also see https://wiki.archlinux.org/title/Visual_Studio_Code#Running_natively_under_Wayland.\

Edit - You can also try with --disable-gpu-sandbox as suggested here:

Hey @ishaanbhimwal - I’m new to EndeavourOS, so thanks for jumping in to help!

Nothing happens:

$ code --enable-features=UseOzonePlatform --ozone-platform=wayland
Warning: 'enable-features' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.

This launches Code OSS with GUI. Excellent! Now how do I get this to work when clicking on app icon in Dock favorites panel?

$ code --disable-gpu-sandbox
Warning: 'disable-gpu-sandbox' is not in the list of known options, but still passed to Electron/Chromium.

If this works then you can follow the below steps to fix the issue. Make sure you reboot afterwards and then you should be able to launch code as usual from any application launcher.

mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/applications"
cp -a "/usr/share/applications/code-oss.desktop" "${XDG_DATA_HOME:-$HOME/.local/share}/applications/code-oss.desktop"
sed -i -e 's,/usr/bin/code-oss --unity-launch %F,/usr/bin/code-oss --unity-launch --disable-gpu-sandbox %F,' "${XDG_DATA_HOME:-$HOME/.local/share}/applications/code-oss.desktop"
sed -i -e 's,/usr/bin/code-oss --new-window %F,/usr/bin/code-oss --new-window --disable-gpu-sandbox %F,' "${XDG_DATA_HOME:-$HOME/.local/share}/applications/code-oss.desktop"
1 Like

Well, how about that! Perfection. This worked like a charm. Thank you very much for your help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.