WSL2 | Windows Subsystem for Linux

Hello guys

Hope you and your loved ones are safe and secure during this tough period. I am home stuck from almost 3 months and hoping that the normality will resume very soon.

So, during the lockdown I’ve decided to take some “risks” by upgrading my production computers/laptop with the forthcoming version of Windows 10 2004 for Windows Subsystem for Linux aka WSL2 using Windows Insider preview ISO.

I work with real Linux enterprise servers at work & throughout last 10 years got myself accustomed with writing simple shell scripts and other Linux specific activities, so that I can handle them as comfortable as I interact with Windows Servers. I usually don’t get in to the silly arguments like which OS is better by comparing the features & other aspects. We never had issues with Windows Servers, neither had issues with Linux servers as we maintained them meticulously.

So, why subsystem for linux is important? Well, not many have the luxury of working with Linux servers. Especially students and developers from small business which depend completely on Windows environments. Subsystem for Linux on Windows opens doors for those who desperately need Linux environment & WSL is their friend. Unlike a virtual machine hosted on Oracle VirtualBox or VMWare, the user don’t have to dedicate hardware resources specifically for WSL & environment is always available. The only feature you may lack should be the ability to start the services automatically. Well, I am sure within a short time Microsoft will figureout a way to.

Okay, let us see how we can start availing WSL2 on Windows 10 already!

Please note, if you are not ready to take the responsibility of what you are going to do, please don’t attempt the below instructions which includes upgrading your Windows 10 version with yet to be officially released version of the same OS.

Once you upgraded your Windows 10 to version 2004

You are all ready to go. Please make sure that you have all the cumulative updates applied before proceeding.

Please note, if you are using Oracle VirtualBox on regular basis, I will suggest that you reconsider proceeding further. Enabling few of the Windows 10 features for WSL2 will completely compromise/degrade the performance of the Virtualizer and you will not even able to start your virtual machines (at times)

In order to avail the WSL2 functionality, you will have to enable few additional features of Windows 10.

I am upgrading my existing WSL to WSL2. If you are trying to configure WSL for the first time, Please refer documents explaining how to thoroughly (I have few posts towards enabling WSL with my blog, you may refer them)

You need to enable “Virtual Machine Platform” and restart the computer before upgrading WSL to WSL2.

Alternatively, you may use powershell as administrator to enable these features.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Please note, if you are using PowerShell, make sure that after enabling the features, you will restart the computer as both shell commands have /norestart switch

Once you restart the computer, you can try to upgrade your existing WSL to WSL2

Either from elevated PowerShell or CMD issue the following command

wsl --set-default-version 2

This is going to take a while, to complete. Once the upgrade has been completed you can start upgrading your existing WSL distros.

Before upgrading your WSL distros, you need to update the existing WSL kernel. Currently, you need to download and manually install the upgraded kernel, and let us hope Microsoft will include the kernel updates for WSL within their update packages.

Please visit the link https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel and follow instructions to download and install the kernel. Post installation, you can start upgrading your existing distros.

Open a command prompt as administrator and issue the following command

wsl --list --verbos

This should list all the distros you already have on your system and the corrsponding WSL version numbers associated

So, my work laptop has 2 distros and both are already upgraded to WSL2. Regardless, let us see how we can upgrade an existing WSL1 distro to WSL2

Consider my distro listing was showing VERSION information as “1” instead of “2”, then I would have issued the following command to upgrade my Ubuntu-18.04 distro

wsl --set-version Ubuntu-18.04 2

That’s all. Your distro will be upgraded to version 2.

My personal takes on WSL2

Well, my interest towards new features are limited to getting them installed and configured. I’ve had very limited handson with the upgraded Ubuntu distro and I was able to have a buttery smooth experiece with XRDP this time. To my utter surprise, Mozilla Firefox loaded without crashing & I felt I was truly interacting with a real Linux machine.

Please refer my previous posts towards WSL about installing XRDP, MySQL and other software those are usually configured on Linux environments.

Guys, almost every other tip and tricks I have listed are coming from many sites and I encourage you to visit those sites for further reading. All I have done was to put them in single place and to post this consolidated thread.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

https://www.bleepingcomputer.com/news/microsoft/windows-10-2004-to-upgrade-wsl2-linux-kernels-via-windows-update/

I will be investing more time for WSL2 once after I get back to Office & hoping to post more interesting stuffs based on my findings. Until then, please stay safe and healthy.

regards,

rajesh

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.