Sometimes a Desktop GUI on top of your WSL2 comes handy. Let me describe shortly, what’s needed to run the XFCE Linux Desktop environment on top of your Ubuntu WSL.
To start, you need obviously your WSL2 setup and configured. This is a requirement I won’t cover here. Then, to get XFCE running, you need a so called X11 server running on your Windows host. This could be something like VcXsrv or MobaXTerm. In my case, I use MobaXTerm which brings a built in X11 server. Regardless of your X11 server, I recommend you to configure it to run X11 on a single window. For both named options, this is possible, using the settings. If you decide not to follow this advice, XFCE will open a new window for every application that’s started on your desktop, which will become messy really fast.
xfce4-goodies using the WSL shell.
sudo apt install xfce4 xfce4-goodies
To get you X11 connection forwarded to your X11 server, you need to specify the target display location in the DISPLAY environment variable. Therefore, you need to find out your WSL network adapters IP address. Open a Commandprompt or a Powershell terminal and enter the following:
ipconfig ... Ethernet-Adapter vEthernet (WSL): Verbindungsspezifisches DNS-Suffix: Verbindungslokale IPv6-Adresse . : fe80::e827:47b7:e969:8d11%53 IPv4-Adresse . . . . . . . . . . : 172.27.0.1 Subnetzmaske . . . . . . . . . . : 255.255.240.0 Standardgateway . . . . . . . . . : ...
Note down the IPv4 address and proceed into your WSL shell. The next step depends on your shell you’re using in the terminal. If you haven’t changed anything, this will be bash. Edit the
.bashrc in your users home then and add the following line:
Enter the IP address noted from above and save the file. Now reopen the terminal or source the
The only thing that’s missing is to start XFCE by the
startxfce4 command. You will get a lot or warning and error messages which can be ignored mostly. After some seconds of waiting, the XFCE desktop environment should show up in your X11 Server window.
When i run the command : sudo startxfce4, i have this message :
Vcxsrv is still black.
Version WSL = 18.104.22.168
Version Ubuntu = 22.04.1 L
“(xfwm4:4818): xfwm4-WARNING **: 15:06:25.234: Could not find a screen to manage, exiting
(xfsettingsd:4826): libupower-glib-WARNING **: 15:06:25.308: Couldn’t connect to proxy: Could not connect: No such file or directory
xfsettingsd: Another clipboard manager is already running.
(xfsettingsd:4826): xfsettingsd-WARNING **: 15:06:25.656: Failed to get the _NET_NUMBER_OF_DESKTOPS property.”
have you tried if xserver forwarding works in general? With
Also please doublecheck the
DISPLAYenvironment variable is set correctly.