Windows Subsystem for Linux - Add desktop experience to Ubuntu  

Page 1 of 7 123 ... LastLast
    Windows Subsystem for Linux - Add desktop experience to Ubuntu

    Windows Subsystem for Linux - Add desktop experience to Ubuntu

    How to add a desktop experience to a Windows Subsystem for Linux distro
    Published by Category: Apps & Features
    12 Aug 2021
    Designer Media Ltd

    information   Information
    Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019 (from Wikipedia).

    Currently, five different Linux distros can be installed to WSL from Microsoft Store: SUSE Enterprise, OpenSUSE, Kali, Debian and Ubuntu. Additional distros can be installed manually, for instance I have my favorite Linux distro CentOS installed in WSL.

    By default, all WSL distros are command line interface only, missing the graphical desktop environment.

    In this tutorial I will show how to install a desktop experience in WSL Ubuntu. The same instructions can be used to add desktop to any WSL distro by changing the commands used according to the distro in question.

    Method shown in this tutorial requires a 64 bit Windows 10 Pro, Education or Enterprise edition. It does not require any third party software to be installed in Windows 10. Notice that currently these instructions only work with Ubuntu WSL release 18.04. Instructions do not work with release 20.04.

    Please notice:

    These instructions require WSL2 Linux kernel, which was introduced in Windows 10 Insider build 18917, and will be included in Windows 10 official version 20H1 (2004) which will be released in spring 2020.

    If you are running an older Insider build than 18917, or Windows 10 version 19H2 (1909) or older, you cannot install any browsers in Ubuntu desktop. Ubuntu will still have Internet connection, its applications can connect to network and Internet, but you cannot install a browser.


    To get started with WSL, see the following Ten Forums tutorials:





    Contents

     Click links to jump to any part



    Part One: Update & Upgrade Ubuntu
    Part Two: Update Ubuntu to WSL2
    Part Three: Install XFCE Desktop Environment in Ubuntu
    Part Four: Install XRDP Remote Desktop Client in Ubuntu
    Part Five: Connect to WSL Ubuntu using Windows Remote Desktop Connection
    Part Six: Install software in Ubuntu



    Part One

     Update & Upgrade Ubuntu


    1.1 Start Ubuntu in WSL from Start > U > Ubuntu. If using Windows Terminal, start it by clicking the down arrow in Terminal title bar and selecting Ubuntu:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-start-ubuntu-terminal.jpg

    1.2 It is important that Ubuntu is updated before starting this process. Enter following command to fully update and upgrade Ubuntu, entering your Ubuntu user password when prompted:

    sudo apt-get update && sudo apt-get upgrade -y
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-update-ubuntu.jpg
    (Click screenshots to enlarge.)



    Part Two

     Update Ubuntu to WSL2


    2.1 Original WSL uses a kernel made by Microsoft. It is quite compatible with Linux kernel, but has it flaws. The new WSL2 uses a real Linux kernel. WSL2 is available starting with Windows 10 build 18917.

    2.2 If you have upgraded Windows 10 from an earlier build to build 18917 or later, previously installed Linux distros are still using WSL1 kernel. It is important to update them to use WSL2 kernel to be able to install browsers.

    You can check which kernel your distros are using with following command in PowerShell (#1 in next screenshot):

    wsl --list --verbose

    2.3 Check the kernel (WSL version) Ubuntu is using (#2). If it shows 1 under Version column, it needs to be updated to WSL 2 and real Linux kernel with following command (#3):

    wsl --set-version Ubuntu-18.04 2
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-update-wsl2.jpg

    2.4 Using the command in step 2.2, confirm that Ubuntu is now updated to WSL2:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-ubuntu-updated-wsl2.jpg



    Part Three

     Install XFCE Desktop Environment in Ubuntu


    3.1 In Ubuntu shell, enter following command to install XFCE desktop environment:

    sudo apt-get install xfce4 -y
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-install-xfce.jpg

    3.2 Install additional software to XFCE desktop with following command:

    sudo apt-get install xfce4-goodies -y
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-install-xfce-goodies.jpg



    Part Four

     Install XRDP Remote Desktop Client in Ubuntu


    4.1 In Ubuntu shell, enter following command to install XRDP Remote Desktop Client:

    sudo apt-get install xrdp -y
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-install-xrdp.jpg

    4.2 Windows Remote Desktop Connection uses port 3389 by default. This port is now reserved, connection to Ubuntu shell is using it. We need to change the port used to connect to XFCE desktop, if we leave it for default 3389, Windows Remote Desktop Connection would show an error message when trying to connect:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-rdp-cannot-connect-poer-3389.jpg

    4.3 To change the port from 3389 to 3388 (or any other free port), use the following command in Ubuntu shell (#1 in next screenshot):

    sudo sed -i 's/3389/3388/g' /etc/xrdp/xrdp.ini

    In the above command, 3389 is the default port which needs to be changed, and 3388 is the new port I want to use.

    4.4 Finally, start the XRDP service to allow Ubuntu's XFCE desktop to accept remote desktop connections (#2):

    sudo /etc/init.d/xrdp start
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-xrdp-port.jpg



    Part Five

     Connect to WSL Ubuntu using Windows Remote Desktop Connection


    5.1 You can close Ubuntu WSL shell now. Until you sign out next time, Ubuntu is running in the background and always ready for remote connection.

    Please notice that if you sign out, or restart Windows, you need to start XRDP service again with following command in Ubuntu shell before you can connect to Ubuntu remotely:

    sudo /etc/init.d/xrdp start
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-start-xrdp.jpg

    5.2 Connect to Ubuntu XFCE desktop with Windows Remote Connection using the following address:

    localhost:3388
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-remote-desktop-connection.jpg

    Replace 3388 with port number you set in step 4.3.

    5.3 Enter your WSL Ubuntu credentials and click OK to sign in:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-xrdp-sign-.jpg

    5.4 You are now connected to Ubuntu, its XFCE desktop. At first sign-in, click Use default config. This prompt will not be shown in subsequent sign-ins:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-default-config.jpg



    Part Six

     Install software in Ubuntu


    6.1 First application you need to install is the browser. The default XFCE browser does not work, giving an error message when you try to start it:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-xfce-browser-not-working.jpg

    6.2 To install Firefox, open the Terminal app, and enter the following command:

    sudo apt-get install firefox -y
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-install-firefox.jpg

    Firefox is installed:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-firefox-installed.jpg

    6.3 All software needs to be installed using Terminal. To give an example, I will install VLC Player. Bing and Google are your friends, commands required to install software in Ubuntu can be easily found.

    6.4 Installing VLC Player is easy and fast using PPA (Personal Package Archive). In Terminal, enter the following commands one by one:

    sudo add-apt-repository ppa:videolan/stable-daily -y

    sudo apt-get update

    sudo apt-get install vlc -y

    6.5 VLC installed. My YouTube channel intro running in VLC Player in WSL Ubuntu XFCE desktop:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-youtube-intro.jpg

    That's it. Easy and fast to get a desktop environment to WSL Ubuntu! Notice that Copy & Paste is working both directions. Here, I have copied a JPG file with Ten Forums background from my Windows Pictures folder and pasted it to Ubuntu, and set it as wallpaper:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-tf-wallpaper.jpg

    Kari



  1. Posts : 17,661
    Windows 10 Pro
       #1

    I like Chrome more than Firefox, so I installed it to be my default browser in Ubuntu. See how to install Chrome in WSL Ubuntu: How to Install Chrome in Ubuntu | Tutorialology
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-image.png

    Kari
      My Computer


  2. Posts : 4,580
    several
       #2

    Lovely.
      My Computer


  3. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #3

    SIW2 said:
    Lovely.
    Thanks, SIW!
      My Computer


  4. Posts : 42,966
    Windows 10 Home 22H2
       #4

    Wow! If I understood any of that, bet I'd be impressed You're quite the geek my friend :)

    A Guy
      My Computers


  5. Posts : 11,247
    Windows / Linux : Arch Linux
       #5

    A Guy said:
    Wow! If I understood any of that, bet I'd be impressed You're quite the geek my friend :)

    A Guy
    Hi there
    Brilliant
    @Kari

    I got Ubuntu working too (LTS version from the store).

    Couple of things which happened to me -- I installed for example the patience games (spider solitaire etc) and got an error --path not found -- it worked if I manually executed from the console /usr/bin/kpat so I think one needs to set various Environmental variables for default paths etc, and also dpkg wasn't working although that didn't seem to stop packages from installing.

    However on WSL2 currently the networking is only via NAT and a virtual address so I can only access the Linux system via RDP on the host machine (i.e the local Windows machine) although the ubuntu system can access the internet (firefox etc).

    It would be great if the network could be bridged so it could use a "proper" IP address and therefore be acessible from the rest of the network. I tried Putty to tunnel it and "poodle fake" the command to 3388 from outside the network (tried via an android tablet connected to our 5G phone network) but couldn't get it to work.

    Any ideas or is the networking stuff still to be "developed" by Ms.
    BTW the response etc is faster by far than using a full blown VM --especially if your Windows OS iand the WSL s on an SSD.

    Also any ideas on installing a distro not from the store e.g Centos or whatever.

    I think Version 1 of WSL supports the "standard" networking --but then you run into all sorts of problems with the X-server etc so version 2 machines are obviously the way to go.

    Cheers
    jimbo
      My Computer


  6. Posts : 668
    Win 10 pro
       #6

    Nice tutorial, always a pleasure to read your tutorials.

    A couple of suggestions if you want to try out:

    The WSL 2 kernel is from Microsoft (not the vanilla Linux kernel)
    AFAIK (I may be wrong), what is the output of:

    uname -a

    There is no default xfce browser, so that wont work until you install
    a browser (anyone)

    you can install a package manager if you want like synaptic or gnome software

    apt search synaptic
    sudo apt install synaptic


    you can try out snap packages, they are containerized and may be more secure (i.e. sandoboxed vlc)

    sudo apt install snapd
    snap install vlc
    snap search vscode
    snap install vscode


    Again nice work, thanks!
      My Computer


  7. Posts : 17,661
    Windows 10 Pro
    Thread Starter
       #7

    jimbo45 said:
    However on WSL2 currently the networking is only via NAT and a virtual address so I can only access the Linux system via RDP on the host machine (i.e the local Windows machine) although the ubuntu system can access the internet (firefox etc).

    It would be great if the network could be bridged so it could use a "proper" IP address and therefore be acessible from the rest of the network. I tried Putty to tunnel it and "poodle fake" the command to 3388 from outside the network (tried via an android tablet connected to our 5G phone network) but couldn't get it to work.
    The problem is, that WSL uses a NAT address. Here, this is my Windows 10 internal IP address:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-image.png

    Checking which IP WSL is using, scrolling to the end of ipconfig output, I can see that WSL is in another subnet, therefore not accessible from my local network:
    Windows Subsystem for Linux - Add desktop experience to Ubuntu-image.png

    The issue is not WSL1 or WSL2, the issue is the way WSL works.

    Anyway, personally I have no issues with this. As Copy & Paste is bidirectional when adding the desktop experience to WSL Linux as told in this tutorial, I can simply copy the files from W10 to Linux, and vice versa. File transfer being about 99% of my networking needs, that is enough for me.


    roy111 said:
    The WSL 2 kernel is from Microsoft (not the vanilla Linux kernel).
    Thank you for your feedback.

    A fact check: Me saying in this tutorial that WSL2 is using a real Linux kernel is based on this official announcement by Microsoft:
    information   Information
    What exactly is WSL 2?

    Our top requests from the WSL community have been to increase the file system performance, and make more apps work inside of WSL (i.e: introduce better system call compatibility). We have heard your feedback, and are glad to announce that WSL 2 helps solve these issues.

    WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version). Individual Linux distros can be run either as a WSL 1 distro, or as a WSL 2 distro, can be upgraded or downgraded at any time, and you can run WSL 1 and WSL 2 distros side by side. WSL 2 uses an entirely new architecture that uses a real Linux kernel.

    (https://devblogs.microsoft.com/comma...ouncing-wsl-2/).

    Kari
      My Computer


  8. Posts : 668
    Win 10 pro
       #8

    Kari said:
    Thank you for your feedback.
    A fact check: Me saying in this tutorial that WSL2 is using a real Linux kernel is based on this official announcement by Microsoft:
    Kari
    Hi, there is nothing wrong in what you said, but it seems like now the WSL 2 Kernel is not coming from Microsoft.

    Windows Subsystem for Linux - Add desktop experience to Ubuntu-lk.png
    As the WSL 1 kernel was from ms, the WSL 2 Linux Kernel is from Microsoft as well.
    There are some deep incompatibility between the Linux file system and Windows,
    now Microsoft is shipping a new WSL kernel especially tailored for the needs of Microsoft
    and Windows systems, which of course is not the vanilla Linux Kernel.
    source:
    https://devblogs.microsoft.com/comma...-with-windows/
    Beginning with Windows Insiders builds this Summer, we will include an in-house custom-built Linux kernel to underpin the newest version of the Windows Subsystem for Linux (WSL). This marks the first time that the Linux kernel will be included as a component in Windows. This is an exciting day for all of us on the Linux team at Microsoft and we are thrilled to be able to tell you a little bit about it.

    Repository of the Microsoft Linux Kernel:

    GitHub - microsoft/WSL2-Linux-Kernel: The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)

    I hope it's clear
      My Computer


  9. Posts : 1,656
    Windows 10 Pro x64
       #9

    Nice @Kari - easy to follow.

    One issue though : I couldn't get the wsl --list --verbose command to work in PowerShell.

    Code:
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Try the new cross-platform PowerShell https://aka.ms/pscore6
    
    PS C:\Users\Colin> wsl --list --verbose
    wsl : The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + wsl --list --verbose
    + ~~~
        + CategoryInfo          : ObjectNotFound: (wsl:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    PS C:\Users\Colin>
    I skipped it and proceeded directly to installing xfce.

    Another issue:

    How long does it take to install xrdp? It started OK, but has been sitting on this part for 15 mins now, no obvious progress.

    Windows Subsystem for Linux - Add desktop experience to Ubuntu-capture.png

    OK. It seemed like it installed but didnt bother updating progress or closing the terminal window.

    After starting xfce, I installed Firefox, but it crashes every time I open it
    Last edited by Golden; 31 Jan 2020 at 23:28.
      My Computers


 

Tutorial Categories

Windows Subsystem for Linux - Add desktop experience to Ubuntu Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:13.
Find Us




Windows 10 Forums