Technically Impossible

Lets look at the weak link in your statement. Anything "Technically Impossible" basically means we haven't figured out how yet.

Gnome on WSL2 + Ubuntu 20.04 LTS

f:id:espio999:20210404220340p:plain

Abstract

Although Microsoft supports Linux GUI application at the next version of WSL, Windows user can enjoy Linux GUI with X server on Windows at the current version of WSL.

This article introduces step-by-step process below to launch minimum Gnome desktop on Ubuntu 20.04 LTS with WSL2.

  1. install minimum Gnome packages
  2. scripting on Ubuntu
  3. run Gnome desktop

Prerequisite

Bosh Ubuntu 20.04 LTS provided by Microsoft Store, and WSL2 must be installed and executable. Environment in this article is

If this is the 1st run of Ubuntu after its installation, you should make a user there in advance of starting following processes.

X server

To support Linux GUI, X server must be installed and executable in advance of following processes. Popular one is as followings.
FYI, I am using MobaXterms. It can cooperate with WSL as terminal and X server is also integrated there.

Popular X server
sourceforge.net
mobaxterm.mobatek.net
x410.dev

MobaXterm
f:id:espio999:20210404220826p:plain
f:id:espio999:20210404220837p:plain

Update apt repository, and install Gnome

Login Ubuntu and update repository of Ubuntu packages with following commands.

Command

sudo apt update
sudo apt upgrade


Installed packages just after these commands, especially for "ubuntu", "x11" and "gnome" are listed at the end of this article. Any packages for Gnome is not installed at this moment.

Then, install minimum packages of Gnome with next command. It install minimum packages required for Gnome desktop environment.

Command

sudo apt install ubuntu-desktop-minimal


Installed packages just after this command is also listed at the end of this article. Many packages for "gnome" are installed.

Edit "~/.profile" to point X server

Windows and Ubuntu run on a single hardware in physical world, but they are on a different network in logical world. In other words, different network addresses are assigned to Windows and Ubuntu. Then, Ubuntu must recognize the address of Windows to access X server running there.

Windows address whould be assigned dynamically. To find it automatically at booting of Ubuntu, set command to find appropriate IP address at the end of "~/.profile". It sets network address and screen info as "192.168.1.10:0.0" to "DISPLAY".
And set unique IT generated by "dbus-uuidgen" to "/etc/machine-id".

Command

cat << EOF >> ~/.profile
export DISPLAY=$(ipconfig.exe | grep -m 1 IPv4 | awk '{print $14}' | awk 'sub(/\r$/,"")'):0.0
EOF

source ~/.profile
dbus-uuidgen | sudo tee /etc/machine-id


Write script to run Gnome

Write script file to run Gnome as "win.sh". You can set different file name as "rungnome.sh".

Command

cat << EOF >> ~/win.sh
sudo service dbus restart
sudo service x11-common restart
gnome-shell --x11 -r
EOF

chmod 777 ~/win.sh
exit


Reboot Ubuntu, and run Gnome

Then, logoff from Ubuntu to reboot it. Type following commands from PowerShell.

Commands on PowerShell

wsl --terminate Ubuntu
wsl --list --verbose


Run "~/win.sh" after login, you will see the desktop as this.
Gnome on Ubuntu
f:id:espio999:20210404220340p:plain

Reference

docs.microsoft.com

Packages

Just after apt update, apt upgrade

Output

wsluser@paulownia:~$ apt list --installed | grep ubuntu-

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

fonts-ubuntu-console/focal,now 0.83-4ubuntu1 all [installed,automatic]
plymouth-theme-ubuntu-text/focal-updates,now 0.9.4git20200323-0ubuntu6.2 amd64 [installed,automatic]
ubuntu-advantage-tools/focal,now 20.3 amd64 [installed,automatic]
ubuntu-keyring/focal-updates,now 2020.02.11.4 all [installed,automatic]
ubuntu-minimal/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-release-upgrader-core/focal-updates,now 1:20.04.30 all [installed,automatic]
ubuntu-server/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-standard/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-wsl/focal-updates,now 1.450.2 amd64 [installed]
wsluser@paulownia:~$ apt list --installed | grep x11

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dbus-x11/focal-updates,focal-security,now 1.12.16-2ubuntu2.1 amd64 [installed]
libx11-6/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 amd64 [installed,automatic]
libx11-data/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 all [installed,automatic]
libx11-xcb1/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 amd64 [installed]
x11-common/focal,now 1:7.7+19ubuntu14 all [installed]
x11-utils/focal,now 7.7+5 amd64 [installed]
wsluser@paulownia:~$ apt list --installed | grep gnome

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

wsluser@paulownia:~$


Just after, apt install ubuntu-desktop-minimal

Output

wsluser@paulownia:~$ apt list --installed | grep ubuntu-

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

fonts-ubuntu-console/focal,now 0.83-4ubuntu1 all [installed,automatic]
gnome-shell-extension-ubuntu-dock/focal-updates,now 68ubuntu1~20.04.1 all [installed,automatic]
gsettings-ubuntu-schemas/focal,now 0.0.7+17.10.20170922-0ubuntu1 all [installed,automatic]
plymouth-theme-ubuntu-text/focal-updates,now 0.9.4git20200323-0ubuntu6.2 amd64 [installed,automatic]
ubuntu-advantage-tools/focal,now 20.3 amd64 [installed,automatic]
ubuntu-desktop-minimal/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-docs/focal-updates,now 20.04.3 all [installed,automatic]
ubuntu-drivers-common/focal-updates,now 1:0.8.6.5~0.20.04.1 amd64 [installed,automatic]
ubuntu-keyring/focal-updates,now 2020.02.11.4 all [installed,automatic]
ubuntu-minimal/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-mono/focal,now 19.04-0ubuntu3 all [installed,automatic]
ubuntu-release-upgrader-core/focal-updates,now 1:20.04.30 all [installed,automatic]
ubuntu-release-upgrader-gtk/focal-updates,now 1:20.04.30 all [installed,automatic]
ubuntu-report/focal,now 1.6.1 amd64 [installed,automatic]
ubuntu-server/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-session/focal,now 3.36.0-2ubuntu1 all [installed,automatic]
ubuntu-settings/focal,now 20.04.5 all [installed,automatic]
ubuntu-standard/focal-updates,now 1.450.2 amd64 [installed]
ubuntu-wallpapers-focal/focal,now 20.04.2-0ubuntu1 all [installed,automatic]
ubuntu-wallpapers/focal,now 20.04.2-0ubuntu1 all [installed,automatic]
ubuntu-wsl/focal-updates,now 1.450.2 amd64 [installed]
wsluser@paulownia:~$ apt list --installed | grep x11

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dbus-x11/focal-updates,focal-security,now 1.12.16-2ubuntu2.1 amd64 [installed]
libx11-6/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 amd64 [installed,automatic]
libx11-data/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 all [installed,automatic]
libx11-protocol-perl/focal,now 0.56-7 all [installed,automatic]
libx11-xcb1/focal-updates,focal-security,now 2:1.6.9-2ubuntu1.1 amd64 [installed]
libxkbcommon-x11-0/focal,now 0.10.0-1 amd64 [installed,automatic]
x11-apps/focal,now 7.7+8 amd64 [installed,automatic]
x11-common/focal,now 1:7.7+19ubuntu14 all [installed]
x11-session-utils/focal,now 7.7+4 amd64 [installed,automatic]
x11-utils/focal,now 7.7+5 amd64 [installed]
x11-xkb-utils/focal,now 7.7+5 amd64 [installed,automatic]
x11-xserver-utils/focal,now 7.7+8 amd64 [installed,automatic]
wsluser@paulownia:~$ apt list --installed | grep gnome

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gir1.2-gnomebluetooth-1.0/focal-updates,now 3.34.3-0ubuntu1 amd64 [installed,automatic]
gir1.2-gnomedesktop-3.0/focal-updates,now 3.36.8-0ubuntu1 amd64 [installed,automatic]
gnome-accessibility-themes/focal,now 3.28-1ubuntu1 all [installed,automatic]
gnome-bluetooth/focal-updates,now 3.34.3-0ubuntu1 amd64 [installed,automatic]
gnome-calculator/focal,now 1:3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-characters/focal,now 3.34.0-1 amd64 [installed,automatic]
gnome-control-center-data/focal-updates,now 1:3.36.5-0ubuntu1 all [installed,automatic]
gnome-control-center-faces/focal-updates,now 1:3.36.5-0ubuntu1 all [installed,automatic]
gnome-control-center/focal-updates,now 1:3.36.5-0ubuntu1 amd64 [installed,automatic]
gnome-desktop3-data/focal-updates,now 3.36.8-0ubuntu1 all [installed,automatic]
gnome-disk-utility/focal,now 3.36.1-1ubuntu1 amd64 [installed,automatic]
gnome-font-viewer/focal,now 3.34.0-2 amd64 [installed,automatic]
gnome-getting-started-docs/focal-updates,now 3.36.2-0ubuntu0.1 all [installed,automatic]
gnome-initial-setup/focal-updates,now 3.36.2-0ubuntu2 amd64 [installed,automatic]
gnome-keyring-pkcs11/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-keyring/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-logs/focal-updates,now 3.34.0-1ubuntu1 amd64 [installed,automatic]
gnome-menus/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-online-accounts/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-power-manager/focal,now 3.32.0-2 amd64 [installed,automatic]
gnome-screenshot/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
gnome-session-bin/focal,now 3.36.0-2ubuntu1 amd64 [installed,automatic]
gnome-session-canberra/focal,now 0.30-7ubuntu1 amd64 [installed,automatic]
gnome-session-common/focal,now 3.36.0-2ubuntu1 all [installed,automatic]
gnome-session/focal,now 3.36.0-2ubuntu1 all [installed,automatic]
gnome-settings-daemon-common/focal-updates,now 3.36.1-0ubuntu1 all [installed,automatic]
gnome-settings-daemon/focal-updates,now 3.36.1-0ubuntu1 amd64 [installed,automatic]
gnome-shell-common/focal-updates,now 3.36.7-0ubuntu0.20.04.1 all [installed,automatic]
gnome-shell-extension-appindicator/focal-updates,now 33.1-0ubuntu0.20.04.1 all [installed,automatic]
gnome-shell-extension-desktop-icons/focal-updates,now 20.04.0-3~ubuntu20.04.1 all [installed,automatic]
gnome-shell-extension-ubuntu-dock/focal-updates,now 68ubuntu1~20.04.1 all [installed,automatic]
gnome-shell/focal-updates,now 3.36.7-0ubuntu0.20.04.1 amd64 [installed,automatic]
gnome-startup-applications/focal,now 3.36.0-2ubuntu1 amd64 [installed,automatic]
gnome-system-monitor/focal-updates,now 3.36.1-0ubuntu0.20.04.1 amd64 [installed,automatic]
gnome-terminal-data/focal-updates,now 3.36.2-1ubuntu1~20.04 all [installed,automatic]
gnome-terminal/focal-updates,now 3.36.2-1ubuntu1~20.04 amd64 [installed,automatic]
gnome-themes-extra-data/focal,now 3.28-1ubuntu1 all [installed,automatic]
gnome-themes-extra/focal,now 3.28-1ubuntu1 amd64 [installed,automatic]
gnome-user-docs/focal-updates,now 3.36.2+git20200704-0ubuntu0.1 all [installed,automatic]
language-selector-gnome/focal-updates,now 0.204.2 all [installed,automatic]
libgnome-autoar-0-0/focal-updates,focal-security,now 0.2.3-2ubuntu0.2 amd64 [installed,automatic]
libgnome-bluetooth13/focal-updates,now 3.34.3-0ubuntu1 amd64 [installed,automatic]
libgnome-desktop-3-19/focal-updates,now 3.36.8-0ubuntu1 amd64 [installed,automatic]
libgnome-menu-3-0/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
libgnomekbd-common/focal,now 3.26.1-1 all [installed,automatic]
libgnomekbd8/focal,now 3.26.1-1 amd64 [installed,automatic]
libpam-gnome-keyring/focal,now 3.36.0-1ubuntu1 amd64 [installed,automatic]
libsoup-gnome2.4-1/focal,now 2.70.0-1 amd64 [installed,automatic]
nautilus-extension-gnome-terminal/focal-updates,now 3.36.2-1ubuntu1~20.04 amd64 [installed,automatic]
network-manager-gnome/focal-updates,now 1.8.24-1ubuntu3 amd64 [installed,automatic]
network-manager-openvpn-gnome/focal,now 1.8.12-1 amd64 [installed,automatic]
network-manager-pptp-gnome/focal,now 1.2.8-2 amd64 [installed,automatic]
pinentry-gnome3/focal,now 1.1.0-3build1 amd64 [installed,automatic]
yaru-theme-gnome-shell/focal-updates,now 20.04.10.1 all [installed,automatic]
wsluser@paulownia:~$