//
you're reading...
cool stuff, Tips'n'Tricks, UNIX/Linux

HOWTO: Functional Ubuntu desktop on Windows 10/WSL

Introduction

With the creator’s update for Windows 10, Microsoft added the ability to install Linux inside Windows through something they call Windows Subsystem for Linux. WSL runs a binary compatibility layer inside windows allowing execution of Linux binary code, and nowadays installation of a number of Linux distributions are a few clicks away in the bundled Microsoft Store.

However, out of the box you only get a shell and CLI programs, and so far I’ve not seen any usable guide to get a full-featured desktop up and running. Most guides seem to focus on running an X-server in Windows and running the Linux programs through that. It works, but it is not pretty.

This is a guide to running a full desktop with near-native performance, and is based around a client-server suite called X2go that provides blazingly fast remote desktop services to Linux and has clients for Windows, MacOS and Unix/Linux.

Getting started: Installing WSL and Ubuntu

Before we can get to the exciting part, we have to enable the Windows Subsystem for Linux. This is enabled in the control panel under Programs -> Programs and Features -> Turn Windows Features on or off

Follow this article from Microsoft for detailed instructions.

After a quick reboot, you can now use the Microsoft Store to install Ubuntu. Just search for Ubuntu, and you will find it right away.

store-ubuntu

Once done installing, clicking Ubuntu from your start menu will launch a quick installer, and you’ll find yourself in a familiar bash shell.

Fixing SSH

Out of the box, sshd doesn’t work because the installer doesn’t create the host keys correctly. The easiest way to fix that, is to remove ssh and install it again.

$ sudo apt-get remove --purge openssh-server
$ sudo apt-get install openssh-server
$ sudo service ssh --full-restart

If you need to point ssh to a different port than 22, you can edit the configuration file, /etc/ssh/sshd_config before running the restart command.

Installing x2go and the desktop

First enable the third-party x2go repository

$ sudo add-apt-repository ppa:x2go/stable
$ sudo apt-get install x2goserver x2goserver-xsession

This will pull a large amount of dependencies, all needed to run the Xorg desktop.

When this is done, you need to install a desktop environment as well. Not all desktop environments are working optimally with X2go, but Mate, XFCE and LXDE are the ones guaranteed to work fully. I selected Mate, and installed the full desktop like this:

$ sudo apt-get install ubuntu-mate-desktop
$ sudo apt-get install x2gomatebindings

Installing the x2go client and connecting to your new desktop

To connect to your new desktop, you need the x2go client, available from their website.

Once installed, create a new session, fill in the server part as Host: localhost, Login: your username, and be sure to select Mate (or whatever you chose to use) as Session type.

x2go-client

Under Connection you can select the highest connection rate, and under Input/Output select the screen resolution you want – either fullscreen or windowed.

Save, and connect. After a little moment you should see your shiny new Linux desktop.

Caveats

Performance

It seems to me that the performance is quite good, however it may vary with your computer’s specifications. Obviously I wouldn’t run any intensive games on it, but native apps works like native apps are supposed to.

I’ve had some trouble suspending and resuming the session if run in full screen, but if you log out when you’re done, you can just start a new session.

WslRegisterDistribution failed with error: 0x800700b7 (error after reboot)

I had some trouble after I rebooted my pc, as Ubuntu wouldn’t start up, giving a “WslRegisterDistribution failed with error: 0x800700b7” message.

To fix it, I launched a cmd.exe process in admin mode and restarted the LxssManager process:

sc stop LxssManager
sc start LxssManager

Other issues

The ubuntu-mate-desktop metapackage installs blueman, which is something to do with bluetooth I believe. This doesn’t work and generates errors. It can safely be removed with the following:

sudo apt-get remove blueman

Conclusion

It doesn’t have to be that complicated to get a Linux desktop running in Windows with WSL. Hopefully this guide will help you get there. If you have any comments, questions or suggestions for me, let me know in the comment section.

screenshot-ubuntu-in-windows

Discussion

5 thoughts on “HOWTO: Functional Ubuntu desktop on Windows 10/WSL

  1. sudo add-apt-repository ppa:x2go/stable
    Cannot add PPA: ‘ppa:~x2go/ubuntu/stable’.
    ERROR: ‘~x2go’ user or team does not exist.
    =(

    Posted by Livio Romolux | November 27, 2018, 12:47 pm
  2. Great guide, I made it works, but after a few days it does not longer run the desktop and I get constantly “timeout connecting to localhost”

    Posted by Barto | May 30, 2019, 9:16 pm
  3. Sorry, I managed to make it work by re-starting ssh and x2goserver services

    Posted by Barto | May 31, 2019, 6:33 am
  4. Thank you for the article. I installed ubuntu and connected the desktop, but there is nothing in, such a menu or apps. How can I install menu and another apps?

    Posted by emreshepherd | June 2, 2019, 3:59 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: