Run Linux on Windows GUI applications 10

I bet you didn't expect to live long enough to see this day, right? Who would have thought … Linux applications running on Windows, such as Windows applications that run on Linux with WINE?

Well, that day has come. Well, not quite yet, but we're almost there. Alegre

Microsoft took the world by surprise in Build 2016 by announcing the Bash on Windows, the result of a partnership with Canonical and which resulted in the possibility to run parts of the Linux (userland, to be precise) on Windows through a translation layer of syscalls (calls to the Linux kernel), such as design WINE makes translation of Win32 calls to allow Windows desktop application on Linux. This "WINE" from Microsoft is Windows Subsystem for Linux, shown below:

Bash architecture on Windows
Bash on Windows architecture.

However, the Bash on Windows only supports command-line applications. In theory, graphics applications cannot be run in Windows through the Bash.

But why not?

If you're like me, then don't take no for an answer. At least, not without a fight!

Back to basics-GUI applications on Linux

The graphical interface of Linux is based on a technology called X Window System (commonly X 11 call). X 11 divides the applications between X Clients (are the graphics applications, such as Firefox or Gimp) and the X Server (component that manages the graphics hardware and makes the display of images).

Bash on Windows has no way to display graphics applications for the simple reason that there is an X Server running. As the focus of Microsoft with the Bash is to support the command-line interface (CLI, "command-line" interface), it makes no sense to offer a support graphic applications component (GUI "graphical user interface").

Now, what if we had an X Server running on Windows? Will that work?

Well, let's try it!

Installing Bash on Windows

For our test, we need the Bash on Windows. At the time this post was written, he was only available for Windows Insiders in Fast Ring (10 Insider Preview Windows, build 14316 or later).

With the correct version of Windows, simply open the Windows command prompt (CMD) and type in bash:

Installing Bash on Windows on Windows 10 Insider Preview
Installing Bash on Windows on Windows 10 Insider Preview

X Server on Windows

The first challenge is to get an X Server. You can't get a Linux-like the X Server interacts with graphics devices, he needs low-level access. Therefore, needs to be written especially for Windows.

We need, therefore, a port of the X Server for Windows. For our test, I used the Xming X Server. Download it and install it on your computer.

Xming running in your Windows system tray
Xming running in your Windows system tray

Moment of truth

Start Xming from the Start Menu for terms our X server running.

Now, open the Bash from the Start Menu. For our test we will install the famous Gimp. Just go to the command line of bash and type apt install gimp:

Installing gimp under Bash on Windows
Installing gimp under Bash on Windows.

As the Bash on Windows doesn't know that we now have an X server running, we need to inform it on the command line. Type the command DISPLAY =: 0 gimp to start Gimp on Windows:

GIMP running on Windows 10
GIMP running on Windows 10 (click to enlarge)

Conclusion

This post was just to kill the curiosity to know if it would be possible to run Linux applications on Windows. The answer is a surprising and heartening "Yes!", but the truth is more complex than that.

First it is important to highlight that, right now, are unstable and lock all the time. It is virtually impossible to use the Gimp in this moment. But that's to be expected, after all the Windows Subsystem for Linux (WS4L) is not ready yet. As the focus of Microsoft's command line, probably there are kernel features required for X applications that are not yet available in the WS4L. In fact, it may never be available. But the simple fact of being possible to run Linux GUI applications on Windows 10 is something that would be unimaginable a few days ago. Who knows what the future holds?

My suggestion: try with other applications. It may be that some are more stable than others. Some people managed to turn CAME and Firefox. Take a look at this thread on Reddit, where people are swapping tips and tricks regarding this subject.

And you, what do you think of this brave new world? Share your experience in the comments!

 

A hug,
Igor

Author: Igor Abade

Igor Abade V. Leite ([email protected]) is a Visual Studio ALM MVP (Microsoft Most Valuable Professional) since 2006. Speaker at various Software Development community events (TechEd Brasil, The Developers’ Conference, DevOps Summit Brasil, Agile Brazil, Visual Studio Summit, QCON among others), has also written articles in magazines and websites such as MSDN Brazil. Since March/2011 is one of the owners of Lambda3, a Brazilian consulting company specialized in ALM, software development and training. Visit his blog about VS ALM at http://www.tshooter.com.br/ and follow him on Twitter @igorabade.

Leave your comment!