Skip to content

Running VSCode for Linux in WSL #2760

Closed
@mredbishop

Description

@mredbishop

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:
image
image
image

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 @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.
image

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

@commanderturner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions