wsl switch to version 1 code example
Example 1: change wsl to version 1
wsl --set-version Ubuntu-18.04 1
// Run the above command from windows powershell
// This assumes you are running Ubuntu 18.04
Example 2: switch wsl 2 to 1
# run following commands in admin-mode PowerShell
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /norestart
wsl --set-default-version 1