visual studio code does not launch on windows 10 subsystem for linux (ubuntu)

5.7k views Asked by At

I am on windows 10 and have installed Linux (Ubuntu) directly from the store using the guidelines given here I also have Xming and have set DISPLAY=:0 in my bashrc file. Programs such as Firefox and PyCharm run just fine but VSCode does not run. It's not the same as this issueand the produced error messages seem different. running it with --verbose option I got below:

Me@DESKTOP-1:/mnt/e/ubuntu-stored/repoitories/pawlib$ code .
Me@DESKTOP-1:/mnt/e/ubuntu-stored/repoitories/pawlib$ which code
/usr/bin/code
Me@DESKTOP-1:/mnt/e/ubuntu-stored/repoitories/pawlib$ code --verbose
[3773:0916/193522.695084:ERROR:bus.cc(395)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
shared memfd open() failed: Function not implemented
[main 7:35:23 PM] Starting VS Code
[main 7:35:23 PM] from: /usr/share/code/resources/app
[main 7:35:23 PM] args: { _: [],
  help: false,
  h: false,
  version: false,
  v: false,
  wait: false,
  w: false,
  diff: false,
  d: false,
  add: false,
  a: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'unity-launch': false,
  'reuse-window': false,
  r: false,
  'open-url': false,
  performance: false,
  p: false,
  'prof-startup': false,
  verbose: true,
  logExtensionHostCommunication: false,
  'disable-extensions': false,
  disableExtensions: false,
  'list-extensions': false,
  'show-versions': false,
  nolazy: false,
  issue: false,
  'skip-getting-started': false,
  'skip-release-notes': false,
  'sticky-quickopen': false,
  'disable-restore-windows': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-crash-reporter': false,
  'skip-add-to-recently-opened': false,
  status: false,
  s: false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false }
[main 7:35:23 PM] Resolving machine identifier...
[main 7:35:23 PM] Resolved machine identifier: d4398814e404b0f7472543859e2fed861c7a29fc750e4c131eab633c4e5a44b8
[main 7:35:23 PM] update#setState idle
[main 7:35:23 PM] windowsManager#open
[3805:0916/193523.829735:ERROR:gl_surface_glx.cc(413)] GLX 1.3 or later is required.
[3805:0916/193523.829875:ERROR:gl_initializer_x11.cc(153)] GLSurfaceGLX::InitializeOneOff failed.
[3805:0916/193523.848836:ERROR:gpu_child_thread.cc(252)] Exiting GPU process due to errors during initialization
[3773:0916/193523.869175:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.
[3773:0916/193524.216326:ERROR:browser_main_parts.cc(139)] X IO error received (X server probably went away)

I installed VScode using below commands:

$ sudo apt install curl
$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
$ sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
$ sudo apt update
$ sudo apt install code

When I got the launch error, I tried installing the .deb file using "dpkg -i" just to make sure the issue wasn't with the installation.

3

There are 3 answers

0
Daniel Imms On BEST ANSWER

VS Code does not support launching the Linux client via WSL, you can however launch the Windows client via WSL by calling <VS Code Install>\bin\code.sh.

Also, while it is possible to launch Linux apps through WSL by installing an X server, it's more of an experimental thing. The focus of WSL is about bringing Linux-based command line tools to Windows.

0
user2990007 On

I have the same issue, but I am launching code from a Linux machine. Xming handles xterm, firefox, etc. but is unhappy with vs code. You can fix the glx issues with

$ code --disable-gpu

but I still get:
[main 2:29:54 PM] update#setState idle
[main 2:29:54 PM] windowsManager#open
[42083:0108/142954.536002:ERROR:browser_main_parts.cc(139)] X IO error received (X server probably went away)

So maybe an X-server problem?  Maybe try a different X server?
0
user2990007 On

Hah! Mr. Google to the rescue. Here is the fix:

# make a copy of the relevant library
mkdir ~/lib
cp /usr/lib/x86_64-linux-gnu/libxcb.so.1 ~/lib
sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' ~/lib/libxcb.so.1
# set the dynamic loader path to put your library first before executing VS Code
LD_LIBRARY_PATH=$HOME/lib code

This is from: https://github.com/Microsoft/vscode/issues/3451