Windows Subsystem For Linux – Part 2 – Graphical Stuff

In the previous post I’ve been looking at Windows Subsystem For Linux (WSL) being a potential solution of how I could remotely administer and support a Windows box with tools and processes I use for supporting remote Linux machines. As it turned out this works great in practice. So how about using WSL and FOSS tools to do things locally on a Windows box with Linux tools for which there are no tools that I would rate as equivalent?

Out of the box, WSL does not support graphical Linux applications as it does not have a built-in X11 server. There are a number of X11 server implementations for Windows and I found ‘Xming‘ to work quite well. After installing and starting the X11 server on Windows, I could install and start graphical Linux apps on Windows in a bash shell just like I would do on native Linux.

One graphical Linux tool I like quite a lot is ‘gscan2pdf‘ to create PDF files out of jpg images. To start this Linux app after installing it with the usual ‘apt install‘ command, the only extra command that is required in a bash session to start the application is to make the X11 server known with ‘export DISPLAY=:0’. It’s also possible to start the program from Windows in a batch file with the following one-liner: ‘bash -c “export DISPLAY=:0; gscan2pdf”‘.

Linux version of Luckybackup running on Windows

Another tool that has become indispensable to me for local backups is Luckybackup, a graphical rsync front-end. It turns out that Luckybackup runs quite nicely as well and in combination with Veracrypt encrypted external drives and access of Linux programs to local files via ‘/mnt…‘, I could successfully make local backups to an encrypted external drive. The only addition I had to make is to add ‘–ignore-errors‘ to the manual options, as Linux programs in WSL can’t access some obscure files and links in the Windows user’s directory. Removable drives are not automatically mounted on the Linux side, but a single command line instruction does the trick: After initially creating in new directory in ‘/mnt‘, e.g. ‘sudo mkdir /mnt/i‘, a Veracrypt volume can be mounted on the Linux side as follows:

# Mount drive i: on the Linux side:
sudo mount -o gid=martin,uid=martin -t drvfs i: /mnt/i

No question, running Linux applications on a pure X11 server without a proper Window manager and desktop environment is not very pretty. But I’m after function here, so that’s a small price to pay.