blog about admin

WSL teaks


A few tweaks I've found to make WSL just a little more awesome.


You've played with WSL before

If not, start here

WSL v1

Used to be like WINE or Cygwin in reverse, pretty cool.

WSL v2

Eh, just make it a VM.
Ok, that's not fair. Virtualised, like a VM, but different. Reverse WINE is just way more cool to me, but v2 does work better / faster, and works with the whole virtualisation-based security thing, might be some security type cool stuff in the pipeline.
That said, at time of writing, it's not a security boundy, nor intended to be one. Stuff runs in the context of the parent process (you!)

Use a good distro

That does not include Ubuntu.

Not these either

wsl --list --online

The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.

NAME               FRIENDLY NAME
Ubuntu             Ubuntu
Debian             Debian GNU/Linux
kali-linux         Kali Linux Rolling
SLES-12            SUSE Linux Enterprise Server v12
SLES-15            SUSE Linux Enterprise Server v15
Ubuntu-18.04       Ubuntu 18.04 LTS
Ubuntu-20.04       Ubuntu 20.04 LTS
OracleLinux_8_5    Oracle Linux 8.5
OracleLinux_7_9    Oracle Linux 7.9

You can use a vanilla container image, clean and minimal, only install what you need.

Rocky Linux
CentOS Stream
Arch Linux
  1. Don't need admin privs for any of this
  2. Using Rocky Linux here, but same process works for any other
  3. Substitute "myRockyLinux01" name and file paths
:: check if you have WSL installed, and any distros
wsl --list

:: import the image (auto creates the directory, there's a VHDX in there)
wsl --import "myRockyLinux01" "C:\Users\xxx\AppData\Local\Programs\WSL\myRockyLinux01" "C:\Users\xxx\Downloads\Rocky-9-Container-Base.latest.x86_64.tar" --version 2

:: should  now see your new install
wsl --list

I have another install already
wsl --list

:: should log you in as root
:: can make another account later

Won't have much installed, just the basics

It's like any other Linux box at this point, do some updates, install what you need to get started.

dnf -y update
dnf -y install epel-release
dnf -y install vim bind-utils curl wget tree ncdu ncurses iproute 


Give this a good read, make your own decisions.

I landed on the following, your use case might be different.

Big performance gain came from disabiling nested virtualisation and interop.



enabled = true

enabled = false
appendWindowsPath = false

nestedVirtualization = false

default = notroot

wsl --terminate myRockyLinux01