How-To

Hands-On with WSL: Running Graphical Apps

The fourth article of a five-part series on Microsoft's Windows Subsystem for Linux (WSL).

This article is part four of a five-part series in which I discuss various aspects and functions of the Windows Subsystem for Linux (WSL). In my previous article I demonstrated how to install different versions of Linux by using WSL.

This particular article is an update to a previous one I had written on the same topic back in February 2017, but at the time I used a preproduction version of WSL. This time, I'll briefly go over how to run graphical programs by using the production version of WSL using Ubuntu. I wanted to revisit the topic to see if all of the graphics applications that worked in the preproduction version of WSL still work on the production version.

Running Graphical Programs
Microsoft doesn't support graphical programs on WSL. Instead, WSL is intended for running command-line programs that developers might need. It's possible, however, to run graphical Linux desktop programs on Windows by using WSL. To be more precise, you're able to display graphical programs running in WSL on a Windows 10 desktop by using an X server that runs on Windows 10.

In order to use WSL with graphical programs, first you'll have to install an X server on a Windows 10 system and the DISPLAY variable will be need to be set in Ubuntu. Fortunately, there are many free X servers available that run on Windows; some of the more popular ones are Xming, Cygwin X and vcXsrv.

Because I have experience with using Xming and have had good luck with it, this is the X server I chose to use for this test. Xming comes with a Setup Wizard (see Figure 1), and I installed it on my Windows 10 system without any difficulty.

[Click on image for larger view.] Figure 1. The Xming Setup Wizard.

I used the default settings when using the Xming Setup Wizard. After launching, it appeared in my system tray, running in the background and waiting for a graphical WSL program (see Figure 2).

[Click on image for larger view.] Figure 2. Xming appearing in the system tray.

Graphics Applications
Once you have an X server installed and running, you'll need to install graphics applications. A good starting point would be the x11-apps package, which has about two dozen X applications, including xclock, xcalc and xeyes. To download and install this package, run the following:

# sudo apt-get install x11-apps

Once the applications have been installed, you can start them by setting your display and executing the application on the Ubuntu shell. Figure 3 shows xeyes running (a program with "eyes" that follow a moving cursor).

# export DISPLAY=:0
# xeyes 
[Click on image for larger view.] Figure 3. Running the X application xeyes.

The three other applications that I worked with were Blockout (a 3-D Tetris-like game), VLC (a video player) and the Firefox Web browser. All of these applications were installed using apt-get by using the following commands:

# sudo apt-get install blockout2
# sudo apt-get install vlc
# sudo apt-get install firefox

Firefox (Figure 4) worked, even though I received some error messages on the command line when I first started it; however, YouTube videos on Firefox would not play. Blockout (Figure 5) worked flawlessly, which surprised me, as it's an extremely graphics-intensive application.

[Click on image for larger view.] Figure 4. Running Firefox.
[Click on image for larger view.] Figure 5. Running Blockout2.

When I tried to run VLC (a video and audio player), it errored out with the message "Cannot create PulseAudio stream: Connection refused." It looks like there may be some hacks to get VLC to work, but that's beyond the scope of this article.

Wrapping Up
I'm happy to report that all of the graphics applications that worked in the preproduction version of WSL also worked on the production version. An added bonus in the production version, however, was that the graphics seemed slightly more responsive. Although graphic programs aren't supported on WSL, it's nice to see that they do work, and they may come in handy.

In the final article in this series, I'll look at some of the additional applications and extensions that users have written to take full advantage of everything WSL has to offer.

About the Author

Tom Fenton has a wealth of hands-on IT experience gained over the past 30 years in a variety of technologies, with the past 20 years focusing on virtualization and storage. He previously worked as a Technical Marketing Manager for ControlUp. He also previously worked at VMware in Staff and Senior level positions. He has also worked as a Senior Validation Engineer with The Taneja Group, where he headed the Validation Service Lab and was instrumental in starting up its vSphere Virtual Volumes practice. He's on X @vDoppler.

Featured

Subscribe on YouTube