Using Gnome Desktop on Windows WSL version of ubuntu

For Windows 10 Pro 64 Bit, is there a way to install the Gnome Desktop in the Windows (WSL downloaded from the MS Store) version of Ubuntu? Or do I need to use a different distro?


First, you have to install a "X Window System" port for Windows. I recommend you to use VcXsrv. After that's done, you should make sure that gnome is installed because, as far as I know, the wsl version of Ubuntu doesn't ship with any gui apps, including gnome, and you do that by typing sudo apt install gnome gnome-session in the terminal.

Install the packages if you don't have them already.

Open Xlaunch (which you installed earlier on your Windows host) and select "One large window" or alternatively "Fullscreen" and replace the -1 with a 0.

Then just hit enter a few times until a big, black window opens. Go to the wsl terminal and type: DISPLAY=:0 XDG_SESSION_TYPE=x11 gnome-session. Wait a bit and you should be able to see the desktop in the xlaunch.


Best working fix was provided here.


TL;DR:

nano ~/.bashrc

paste this at the end

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export LIBGL_ALWAYS_INDIRECT=1

then execute:

git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh

then restart WSL

Full Windows 10 + Ubuntu + Gnome + VcXsrv instructions

  1. in Control panel > programs > Turn Windows feature on or off: enable virtualization, the two Hyper-V checkboxes (if present), and Windows subsystem for Linux
  2. Restart computer and enter the BIOS; in the BIOS make sure that virtualization is enabled. (Google for more specific instructions for your computer model)
  3. install Ubuntu (20.04) via windows store
  4. Install VcXsrv
  5. (at any point) open VcXsrv; select single window > next > Start no client > next > enable third checkbox [disable access control] > next > finish
  6. in windows command prompt execute: wsl --set-default-version 2
  7. start WSL by either executing wsl in a command prompt / windows terminal; or by opening "Ubuntu" from the start menu
  8. in WSL:
  9. (complete default user and password dialog)
  10. sudo apt update
  11. sudo apt upgrade
  12. sudo apt install ubuntu-gnome-desktop
  13. apply above gnome fix instructions
  14. in windows execute: wsl --shutdown
  15. and restart WSL
  16. in wsl, execute: gnome-session

Congratulations. VcXsrv will now appear as a monitor which is running the gnome GUI of a virtual Ubuntu system.


I suggest reconfiguring some keyboard shortcuts such as alt-tab, so that you don't control both windows and WSL at the same time.

Note that you can also run some GUI apps in VcXsrv without first starting a gnome-session. (Try executing gedit from the wsl command line.)