Debian is one of the supported distros under WSL 2. Learn how to run GUI apps using X410.

WSL 2 Debian GUI Apps with X410

WSL 2 Debian GUI Apps with X410

Debian is one of the distros supported under WSL (Windows Subsystem Linux). It’s the foundation of what Ubuntu runs on so if you are familiar with the most popular Linux distro, you should still feel familiar using Debian.

In this guide you will learn how to run GUI apps using Debian distro from Windows Store and X410.

Installing Debian, X410 and Windows Terminal

Before you start, make sure you install the following apps from the Windows Store:

Once installed you should check what distros you have installed, you can do this by running wsl -l -v using Powershell via our recently installed Windows Terminal. In our particular case we have both Ubuntu running on WSL 2 and Debian running on WSL 1. Before we continue with our guide let’s convert our distro to version 2.

1
2
3
4
PS C:\Users\user> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
Debian Running 1

Update Debian to use WSL 2 wsl --set-version Debian 2.

Once updated you should see the correct version of Debian by running the command above.

1
2
3
  NAME      STATE           VERSION
* Ubuntu Running 2
Debian Stopped 2

Use Windows Terminal with Debian

With Windows Terminal installed you should see Debian in the list for launching a new shell. You can launch your new session from that list or configure it as the default shell if you go into the settings file.

Use X410 with Debian

If you installed all apps listed above you should see X410 in the list of recently installed apps when opening your Start Menu. Start X410 by clicking the app and after prompting for network access you should see the X icon in your taskbar tray.

X410 is an X Windows Server, basically the platform where Linux GUI apps run on. While X410 is one of the most straightforward ways to run GUI apps it’s not as simple to use as we would like. Before we can call this complete we need to do a few more things.

Running Terminator on WSL 2 with X410

Let’s start by installing an app that needs X Server. You can install this app by running sudo apt update -y && sudo apt install terminator -y. You will be prompted to use your root password (the one you created when installing Debian) and after installing all dependencies, you will be able to run the command terminator.

When running terminator you should see something similar to this:

1
2
3
4
user@hostname:/mnt/c/Users/user$ terminator
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
You need to run terminator in an X environment. Make sure $DISPLAY is properly set

We can see that the app couldn’t connect to the X environment. We need to make some changes here.

Configure WSL to use X410

Here comes one of the only differences we have when using WSL2 compared to WSL1. In WSL1, X server will normally run in 127.0.0.1 but in WSL2 the IP changes often. Before we do anything permanent let’s test things first.

Run the following command in the terminal:

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0

It shouldn’t give any output, but if you run terminator again, the app will start.

Pretty easy, right? Well, the only inconvenience is that we need to run the export command every time we start our shell. Let’s fix that by adding it to our .bashrc. You can do that by using nano editor:

  • nano ~/.bashrc
  • Add the line provided to the bottom of the file
  • Press Control+X then Y then ENTER to close the editor.

Debian will now execute that line every time you start a new shell. Let’s try it by closing our terminal, re-opening Debian distro and running terminator. It should now work.

Running Chromium on Debian with X410

Let’s try another app: Chromium. We can install it by running sudo apt install chromium -y. Once installed you will be able to run chromium.

Closing

Running GUI Apps with X410 is very easy and currently the best option for running Linux GUI apps on Windows. That, at least until Microsoft releases an update to add native support for GUI apps on WSL.

More Content