WSL Prep #######
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
I said reboot!
Just double click on the package an follow instructions.
#######
When trying to move from WSL1 to WSL2 on Windows 10 1909 I experienced a lot of network related issues.
- DNS not resolving locally and/or via vpn
- Docker integration not available for WSL2 for Windows builds 1903 and 1909
First I tried to move over to WSL2 completely, but I couldn't get things fixed, so I decided to clone my WSL1 instance to a WSL2 instance instead. Only then I was able to resolve all isues follwing the below steps.
As I had to use a corporate managed Cisco AnyConnect VPN connection, I had to change priorities of the differen networking adapaters via PowerShell (Admin)
Get-NetIPInterface -InterfaceAlias "vEthernet (WSL)" | Set-NetIPInterface -InterfaceMetric 1
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco"} | Set-NetIPInterface -InterfaceMetric 6000
First I had to export my Ubuntu-20.04 WSL1 instance:
wsl --export Ubuntu-20.04 Ubuntu-20.04-default.tar
Then I created a destination location for the WSL2 instance
<somedrive>\<somedir>\Ubuntu-20.04-WSL2
Next step is to import the exported instance
wsl --import Ubuntu-20.04-WSL2 <somedrive>/<somedir>/Ubuntu-20.04-WSL2 <source_location_of_the_export>/Ubuntu-20.04-default.tar --version 2
Now lets verify...
wsl -l -v
Start the WSL2 instance.
wsl -d Ubuntu-20.04-WSL2
As the default user isn't logged in, I needed to edit /etc/wsl.conf and add the following content on the WSL2 env:
[user]
default=<your_user>
As ~/.bashrc wasn't sourced by default I had to edit ~/.bash_profile and add the following content on the WSL2 env:
if [[ -f ~/.bashrc ]] ; then
. ~/.bashrc
fi
To apply all changes, run from the Windows PowerShell (admin)
wsl --shutdown
If you'd like to have a Windows shortcut, create one and set the following as target:
C:\Windows\System32\wsl.exe -d Ubuntu-20.04-WSL2