WSL Installation

There are some special use cases where I would like to go through and show the process of setting up WSL. Ubuntu’s official document works well on Windows 11 LTSC for WSL installation, there is also a tutorial from sitepoint with more details.

I’m doing this on a double debloated version of Windows 11 from previous post of Tiny 11 WTG, where I downloaded WinGet, extracted DesktopAppInstaller_Dependencies.zip and installed with PowerShell:

Add-AppxPackage Microsoft.UI.Xaml.2.8_8.2310.30001.0_x64.appx
Add-AppxPackage Microsoft.VCLibs.140.00.UWPDesktop_14.0.33728.0_x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

From this point, it’s time to install Windows Ternimal if that is not present on the OS already.

Run winget install --id Microsoft.WindowsTerminal -e inside a PowerShell to install Windows Terminal

After this installation, Win key + x + a would open a terminal which replacing PowerShell

Run wsl --install to download prerequirements, reboot when it’s done.

Back to the system, run wsl --list --online in terminal to get a list of options

For example, I need to install 22.04 therefore run wsl --install -d Ubuntu-22.04

When installation finished, input a set of credential if asked, and Ubuntu will start automatically. I can run sudo apt update right now in this bash prompt.

Now, if run wsl -l -v in a new terminal, it would show the installed linux with status. And a new Ubuntu icon is showing up in the start menu.

Use the icon or run wsl in terminal to launch it and sudo apt upgrade to update.

Full Desktop Environment (WSLg)

Proceed with sudo apt install ubuntu-desktop acpi-support- if a full desktop environment is needed.

I decided to use WLSg rather than GWSL for less 3rd party involvement.

After a long time for waiting, run sudo systemctl mask gdm.service and sudo systemctl edit --full --force wslg-fix.service then paste:

[Service]
Type=oneshot
ExecStart=-/usr/bin/umount /tmp/.X11-unix
ExecStart=/usr/bin/rm -rf /tmp/.X11-unix
ExecStart=/usr/bin/mkdir /tmp/.X11-unix
ExecStart=/usr/bin/chmod 1777 /tmp/.X11-unix
ExecStart=/usr/bin/ln -s /mnt/wslg/.X11-unix/X0 /tmp/.X11-unix/X0

[Install]
WantedBy=multi-user.target

Save the file and close the editor. Now we have to enable this service and configure the GNOME Shell to start in nested mode

sudo systemctl enable wslg-fix.service
sudo mkdir /etc/systemd/user/[email protected]/
sudo nano /etc/systemd/user/[email protected]/override.conf

Paste the code below in the editor

[Service]
ExecStart=
ExecStart=/usr/bin/gnome-shell --nested

Shutdown WSL with wsl.exe --shutdown and restart wsl again.

Now gnome DE is ready for use and run following code every time when using DE:

DESKTOP_SESSION=ubuntu \
GDMSESSION=ubuntu \
GNOME_SHELL_SESSION_MODE=ubuntu \
GTK_IM_MODULE=ibus \
GTK_MODULES=gail:atk-bridge \
IM_CONFIG_CHECK_ENV=1 \
IM_CONFIG_PHASE=1 \
QT_ACCESSIBILITY=1 \
QT_IM_MODULE=ibus \
XDG_CURRENT_DESKTOP=ubuntu:GNOME \
XDG_DATA_DIRS=/usr/share/ubuntu:$XDG_DATA_DIRS \
XDG_SESSION_TYPE=wayland \
XMODIFIERS=@im=ibus \
MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768 \
gnome-session

To make it simpler, create a script with code above by nano de.sh and run sh de.sh when needed.