microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.25k stars 29.3k forks source link

VSCode Snap doesn't start when using Wayland mode #202072

Open major-mayer opened 10 months ago

major-mayer commented 10 months ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Download the code-insiders snap package
  2. Run it like this: code-insiders --ozone-platform-hint=auto --verbose
  3. VSCode doesn't start but reports this in the console:
 Warning: 'ozone-platform-hint' is not in the list of known options, but still passed to Electron/Chromium.
MESA-LOADER: failed to open radeonsi: /usr/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: radeonsi
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load swrast driver
[340245:0109/202358.589994:WARNING:wayland_object.cc(158)] Binding to gtk_shell1 version 4 but version 5 is available.
[340245:0109/202358.590067:WARNING:wayland_object.cc(158)] Binding to zwp_pointer_gestures_v1 version 1 but version 3 is available.
[340245:0109/202358.590093:WARNING:wayland_object.cc(158)] Binding to zwp_linux_dmabuf_v1 version 3 but version 4 is available.
(code-insiders:340245): GLib-GIO-ERROR **: 20:23:58.596: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'
brianfcoleman commented 7 months ago

I believe that this issue is caused by a bug in the VSCode snapcraft.yaml.

--- snapcraft.yaml  2024-04-01 18:39:12.742475423 +0100
+++ snapcraft-mesa.yaml 2024-04-01 18:45:08.677398621 +0100
@@ -70,12 +70,30 @@
         cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
       done
       patchelf --print-rpath $SNAPCRAFT_PRIME/usr/share/@@NAME@@/chrome_crashpad_handler
+  mesa-patchelf:
+    plugin: nil
+    stage-packages:
+    - libgl1-mesa-dri
+    stage:
+      # The libraries in .../dri need no-patchelf, so they come from the mesa-unpatched part
+      - -usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri
+  mesa-no-patchelf:
+    plugin: nil
+    stage-packages:
+      - libgl1-mesa-dri
+    build-attributes:
+      - no-patchelf # Otherwise snapcraft may strip the build ID and cause the driver to crash
+    stage:
+      # Only the libraries in .../dri need to not be patched, the rest come from the mesa part
+      - usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri

 apps:
   @@NAME@@:
     command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --no-sandbox
     common-id: @@NAME@@.desktop
+    environment:
+      LIBGL_DRIVERS_PATH: $SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri

   url-handler:
     command: electron-launch $SNAP/usr/share/@@NAME@@/bin/@@NAME@@ --open-url --no-sandbox
deepak1556 commented 7 months ago

Thanks @brianfcoleman , the mesa driver issue would be good solve but that is not the direct cause of this issue. We would need to address the incorrect settings configured for snap (code-insiders:340245): GLib-GIO-ERROR **: 20:23:58.596: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'

FredHaa commented 6 months ago

Any updates on this issue?

MadeManMax commented 5 months ago

Any updates on this issue?

I've removed snap version and installed deb from https://code.visualstudio.com/docs/setup/linux and this fixed it for me.

galpar commented 2 months ago

Any updates on this? Having the ELECTRON_OZONE_PLATFORM_HINT set to auto crashes the application, and I woudn't want to remove that, so other electron apps can read it and scale properly.