Background & Functionality
It is very easy to run a complete Linux environment including its graphical user interface on a Windows computer. Windows Remote Desktop is used as a client to access the graphical user interface of Linux based on the installed desktop environment (e.g. “Xfce”1). It feels as if Linux and its desktop environment are installed directly on the computer. The following features are supported:
- Copy & paste files between the Windows desktop and the Linux desktop environment
- Multi-monitor operation
- Video-Streaming, e.g. YouTube
- Preview: Connecting USB devices, e.g. audio/video via “usbipd-win”2
Prerequisites
- At least Windows 113 is installed
- WSL24 must be enabled on Windows 11
- Curl5 must be present on Windows 11 (Installed by default since Windows 10)
Steps
-
Download the rootfs-image for WSL of a Linux distribution - in our case we are using Noble Numbat LTS6
- inside Windows Command Prompt -
- Press the keyboard shortcut Windows-Key + R-Key
- Type cmd in the small window and confirm with the Return key or click OK
- Creating a Folder
mkdir "%userprofile%\mylinux"
- Download Distribution
curl https://cloud-images.ubuntu.com/wsl/noble/current/ubuntu-noble-wsl-amd64-ubuntu24.04lts.rootfs.tar.gz --output "%userprofile%\mylinux\mylinux-rootfs.tar.gz"
-
Import the downloaded rootfs-image
- inside Windows Command Prompt -
- Start the import process
wsl --import mylinux "%userprofile%\mylinux\vhdx" "%userprofile%\mylinux\mylinux-rootfs.tar.gz"
- Start the import process
-
Check the Import
- inside Windows Command Prompt -
- List the installed subsystems
wsl -l -v
- The import was successful if “mylinux” appears in the list of distributions
NAME STATE VERSION mylinux Stopped 2
- List the installed subsystems
-
Launch Linux Distribution
- inside Windows Command Prompt -
- Launch the installed subsystem
wsl -d mylinux
- Note: The Windows Command Prompt switches to the terminal of the Linux distribution for the first time
- Launch the installed subsystem
-
Check the Distribution inside the Terminal of the Linux Distribution
- inside Linux Terminal -
- Show release information
lsb_release -a
- The resulting output should look like this
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble
- Assign a password for the user “root”
passwd root
- Note: The password must be entered twice in a row
- Important: Within the Xrdp environment, the user “root” is required for security-critical processes such as mounting drives
- Show release information
-
Install the desktop environment “Xfce” and “Xrdp”7
- inside Linux Terminal -
- Install the needed packages
apt update && apt install -y xfce4 xrdp
- The technical user “Xrdp” must be assigned to the group “ssl-cert”
adduser xrdp ssl-cert
- Create a new user “tux” for the login via “Xrdp”
useradd -m -G users,sudo tux
- Assign a password for the new user “tux”
passwd tux
- Note: The password must be entered twice in a row
- Install the needed packages
-
Prepare the custom X-Session
- inside Linux Terminal -
- Switch to the user “tux” previously created
su - tux
- Edit the x-session configuration
echo xfce4-session >> ~/.xsession
- Leave the tux user session
exit
- Switch to the user “tux” previously created
-
Configuring the Linux distribution to use “systemd”
- inside Linux Terminal -
- Edit the configuration for WSL
echo -e "[network]\nhostname=mylinux\n[boot]\nsystemd=true" > /etc/wsl.conf
- Leave the terminal of the Linux distribution afterwards
exit
- Edit the configuration for WSL
-
Shut down WSL and restart the Linux distribution
- inside Windows Command Prompt -
- The subsystem must first be terminated to initiate a reboot afterwards
wsl -t mylinux
- Very important Note: If another subsystem is running, under which another Xrdp server is active on the default port 3389, it is mandatory to reboot Windows at this point!
- Boot the Linux distribution
wsl -d mylinux
- Note: The Windows Command Prompt switches back to the terminal of the Linux distribution
- The subsystem must first be terminated to initiate a reboot afterwards
-
Check if Xrdp is started
- inside Linux Terminal -
- Check if Xrdp is running correctly
systemctl status xrdp
- The first two lines of the resulting output should look like this
● xrdp.service - xrdp daemon Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; preset: enabled) Active: active (running) since ... . . .
- Check if Xrdp is running correctly
-
Important: It is required to start a separate Windows Command Prompt
- The Linux Terminal must remain open
- Press the keyboard shortcut Windows-Key + R-Key
- In the small window, type cmd and confirm with the Return key or click OK
-
Identify IP address used by WSL
- inside Windows Command Prompt -_
- Check IP addresses used by WSL
wsl hostname -I
- Possibly the resulting output are multiple IP addresses, e.g.
172.25.107.5 172.18.0.1 172.20.0.1
- Check IP addresses used by WSL
-
Access the remote desktop by using the first IP address displayed
- inside Windows Command Prompt -
- Start a new remote desktop session
mstsc /v:"172.25.107.5"
- Start a new remote desktop session
-
Log in via the Remote Desktop Client
- inside Windows Remote Desktop -
- Enter tux as username
- Log in with the password previously set for the tux user
- The desktop of Xfce will be displayed
Optional: Complete uninstallation of the Linux distribution
Attention: Removes everything that has been downloaded or created in the previous steps
-
Downloaded root-fs-image “mylinux-rootfs.tar.gz”
-
Created virtual disk “ext.vhdx”
-
Stored data within the Linux distribution
-
The following steps are needed
- inside Windows Command Prompt -
- Press the keyboard shortcut Windows-Key + R-Key
- In the small window, type cmd and confirm with the Return key or click OK
wsl --unregister mylinux
rmdir /s /q "%userprofile%\mylinux"