There is a couple of guides out there on how to get GUI applications running in Linux Subsystem for Windows (WSL).
I tried to follow a handful of them, but each of them had something in common: Both Linux native Github Atom and Linux native Visual Studio Code refused to open.
In my last approach, following this overly simple guide, I don't get any error messages. Running atom
or code
just doesn't do anything and instantly returns.
To put that into perspective, running gvim
works without a problem:
What could be the issue here?
Edit:
Some details:
- I am using Windows 10 Pro build 17134. (I am not able to join Insiders).
- I am using the default Ubuntu distribution for WSL.
- I tried using xfce4, but got the following error when trying to start Atom:
assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:108, function pa_mutex_unlock(). aborting.
This could be resolved when running sudo apt remove --purge libpulse0
but xfce4
depends on it.
Or one could use Windows 10 build 17627 which was never released as far as I can tell.
So in my latest test I am not using any desktop environment, but instead start the applications directly into DISPLAY=:0.0
so Xming could pick it up, which it does for gvim
. (I am using LIBGL_ALWAYS_INDIRECT=1
too)
Edit 2:
I tried 18.04, using latest Atom release and both with and without xfce4. Neither was successful.
Best Answer
Installation:
Atom: Download Atom DEB package from GitHub: Atom releases. Install it with
dpkg -i /path/to/atom-amd64.deb
command. If there is any dependency error install those packages withapt-get install -f
command (source).VS Code: Download Visual Studio Code DEB package from VScode link. Install it with
dpkg -i /path/to/code_amd64.deb
command. If there is any error withlibgtk-x11-2.0
library install it withapt install libgtk2.0-0
command (source).Configure X server: Download VcXsrv and install it. Execute
xlaunch.exe
with default settings (Display Number-1
or0
). Add the following environment variables to your .bashrc:export DISPLAY=:0
(echo 'export DISPLAY=:0' >> ~/.bashrc
).export LIBGL_ALWAYS_INDIRECT=1
(echo 'export LIBGL_ALWAYS_INDIRECT=1' >> ~/.bashrc
)Execute Atom/VSCode: Type
atom
to execute Atom text editor orcode
to execute VS Code.Notes: Install only 64bit binaries because WSL is now only available in 64bit Windows OS. Don't run with root user. Always run
apt update
andapt upgrade
before and after installation. These installations are not dependent on the desktop environments, so that is optional. Long live open-source.