Repository navigation
Description
I'm creating a new issue for this as the previous two got way off track talking about the windows version of VS Code from WSL.
I now have VS Code for Ubuntu installed in the Ubuntu WSL in windows at version 1.19.0-insider
To get to the point at which I am at, install an XServer for windows, I use VcXsrv with the following settings:



Then, in WSL you need at least the creators update, do the following:
Install the required libs
ed@ed-surface-book: sudo apt-get install libgtk2.0-0
ed@ed-surface-book: sudo apt-get install libxss1
ed@ed-surface-book: sudo apt-get install libasound2
Add VS Code repository
ed@ed-surface-book: curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
ed@ed-surface-book: sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
ed@ed-surface-book: sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
Install VS Code Insiders (and code itself if you like)
ed@ed-surface-book: sudo apt-get update
ed@ed-surface-book: sudo apt-get install code
ed@ed-surface-book: sudo apt-get install code-insiders
Set the environmental paramaters
ed@ed-surface-book: export LIBGL_ALWAYS_INDIRECT=1
ed@ed-surface-book: export DISPLAY=0:0
NOTE At this point you need the DBUS service to be running (thanks Kinman Lam (@kinmanlam), I forgot :) ):
sudo service dbus start
Attempt to run VS Code Insiders with verbose logging so you see any issues
ed@ed-surface-book: code-insiders --verbose
[6398:1218/130534.978077:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[6398:1218/130534.978163:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
I now have only two warnings about multiple instances of AudioManager being detected and no errors. When clicking exit in XServer, it reports that there are clients connected so VS Code seems to be attaching to the XServer instance however the app does not display in the XServer window.

As there are no further errors in the verbose output I am stuck as to where to go next to debug this, are there any other logs/output sources I can look into?
Related:
Running VS Code native in WSL
Support launching VS Code from Bash on Ubuntu on Windows
Activity
jack-guy commentedon Dec 18, 2017
therealkenc Has done a lot of investigating on this. Two recent comments by him that shed some light on why this is happening:
#2293 (comment)
#2293 (comment)
FWIW in my time experimenting with running my own electron app on WSL, I believe I encountered the same event loop problem. Ultimately, the addition of
to the main process kept the event loop spinning in the background. I have no clue why that worked, however. Maybe someone could try plugging that line into a custom VSCode build to see if it works?
khuongduybui commentedon Dec 19, 2017
Wait, so someone planned to close the issue in microsoft/vscode#13138 and link here because (s)he thought the issue had nothing to do with VSCode and instead a problem with WSL.
I followed the link here only to find out what the next step is probably a PR to Microsoft/vscode ???
jack-guy commentedon Dec 19, 2017
Duy K. Bui (@khuongduybui) The one-liner I recommended would be a hack that could help verify the underlying event loop issue in running VS Code (if it even works). This is 100% a problem with WSL, as is elaborated on in the comments I linked.
khuongduybui commentedon Dec 19, 2017
ok thanks for the clarification.
mredbishop commentedon Dec 19, 2017
Duy K. Bui (@khuongduybui) Yeh sorry for not being clearer, based on what therealkenc and Harangue have found out, it looks like the event loop locks up on WSL where this doesn't happen in "clean" Linux.
khuongduybui commentedon Dec 20, 2017
Guys, I just updated to 17063. Code is running now, wow!
mredbishop commentedon Dec 20, 2017
mredbishop commentedon Dec 20, 2017
Do I close this issue now or wait until it's in the mainstream release?
WSLUser commentedon Dec 20, 2017
I think it's safe to say you can close it but therealkenc or somebody will need to add the "fixed in insiders build" tag. Question is if the fix for this can be backported to 16299.
NellyWhads commentedon Dec 24, 2017
Hey guys (espeically Duy K. Bui (@khuongduybui) ), been trying to set this up as well. Few questions:
AndrewPardoe commentedon Dec 25, 2017
Thanks for all the investigation! I've verified that this works with non-insiders Code, on Windows Insider build 17063.
I'm running VCXsrv, multiwindow, no special configuration. I added the
LIBGLline to my.bashrc, in addition to theDISPLAYline that's always been there. You also need to be running dbus:sudo service dbus startI installed Code (non-insiders) using the commands from above:
Running Code is slow, but it works. A few times Code failed to launch completely and I had to kill it using Task Manager. As expected, it can create and edit files in your Linux paths.
mredbishop commentedon Jan 8, 2018
Interestingly, this has stopped working for me again now 😢 with a Pulseaudio issue:
Up to now (for the last 19 days) this was working almost flawlessly and was my main coding environment.
therealkenc commentedon Jan 8, 2018
That is #486 aka #1006, as explained in #648 (message) and Microsoft/vscode#13138 (message).
6 remaining items
mredbishop commentedon Feb 18, 2018
manooog commentedon Feb 23, 2018
Duy K. Bui (@khuongduybui) hi,can you tell me which way that you get the 17063 insider build?thanks!
jawjop commentedon Feb 23, 2018
@Xixi20160512
Win key + I
Search for "insider"
Click "Windows Insider Programme settings"
Sign up to Insider builds. The settings you want to select are "Active development of Windows" and "Slow" ring.
I just did this to test the solution. My PC is currently downloading version 17074.1002
EDIT:
And it works :) VS Code is running perfectly on WSL (aside from a bunch of dbus/pulseaudio errors). Thanks lads!
therealkenc commentedon May 25, 2018
Ran course.
jgoux commentedon Aug 6, 2018
Hello,
it seems that of today (Windows 10 build 17730.1000 + Code Insiders 1.26.0), the settings are a little different than the one you provided to make it works.
I didn't need to make these 2 instructions :
sudo apt-get install libgtk2.0-0export LIBGL_ALWAYS_INDIRECT=1And I needed to install the following :
sudo apt-get install libgl1Also, to get rid of the error
libGL error: failed to load driver: swrast, I needed to launch VcXserver with the-nowgloption :vcxsrv.exe :0 -ac -terminate -lesspointer -multiwindow -clipboard -nowglI've put these at the end of my
~/.bashrcso they get started automatically :Hope this helps! 😄
I still have a lot of these warnings :
Does anyone have any idea if it's solvable?
sworisbreathing commentedon Aug 21, 2018
I don't quite understand why this issue was closed. It's not working for me.
fedme commentedon Aug 28, 2018
This is working for me, thanks!
I've written a more detailed and beginners-proof version of the installation steps you provided here.
Still, VS Code is blurry on High DPI monitors. Anyone knows how to fix that?
Overriding Windows' DPI settings for VcXserver works but makes VS Code very unresponsive for me.
spences10 commentedon Sep 14, 2018
That Gist you linked is a 404 Federico Meini (@fedme) 😢
fedme commentedon Sep 14, 2018
Updated the link, sorry for that!
photon-schiesser commentedon Nov 3, 2018
I cannot get this to work. I have followed the instructions, but nonetheless,
code-insidersdoes not show any activity in the XWindow and nails my CPU.Here is the output. Seems to be multiple errors, but I am having trouble tracking down how to fix any of them. Help would be appreciated.
photon-schiesser commentedon Nov 3, 2018
Windows 10 Pro
Version 1803 (OS Build 17134.345)
therealkenc commentedon Nov 3, 2018
sudo apt install mesa-utilsAlso don't export
LIBGL_ALWAYS_INDIRECT, and it isDISPLAY=localhost:0not0:0.The
memfd open()thing is a red herring, unrelated to vscode proper, and basically dupe #1209.You're better off on 17763 aka 1809 for unrelated reasons but it should fly alright on 17134. If you subsequently get the
audio_manager.ccfail that's #1006 aka #486.photon-schiesser commentedon Nov 4, 2018
therealkenc after a restart, it is now working. Though, I still see the following error, even though
code-insidersis displayed.Another red herring perhaps?
therealkenc commentedon Nov 4, 2018
Hard to say. Something thinks that missing
.../swiftshader/libGLESv2.sois part of the VSCode package (strictly speaking, a distant dependency thereof) but it isn't there. I don't have that path on my1.29.0-insidereither, but I also don't get theERROR:gl_implementation.ccline out ofcode-insiders --verbose. So we'll call that difference between my run and your run "odd" and/or "unexplained". I can't (won't?) speculate on the cause. It would take a deep dive to see how your run makes it togl_implementation.cc(245), and, I can't do that myself because I don't get there. It's a dive that probably isn't worth the trouble unless/until it becomes some kind of hard fail. I am sure there is a "good explanation", but it won't be one that has anything to do with WSL (with usual caveat that anything is possible). Make sure you have 'native opengl` unchecked in VcXsrv, but I don't think that will matter. Happy to hear you got it running.