Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Upgraded from WSL1 to WSL2

views
     
TSMatQuasar
post Sep 6 2023, 05:00 PM, updated 2w ago

Getting Started
**
Junior Member
180 posts

Joined: Jun 2023
I have just upgraded my WSL1 to WSL2 (Windows Subsystem Linux)

A screenshot tells thousand words:
user posted image

Reference: Comparing WSL Versions https://learn.microsoft.com/en-us/windows/w...ompare-versions

In short, WSL2 is full Linux kernel, others are same as WSL1. I heard that WSL2 supports GUI app, but I got "Segmentation fault" error when running my own Linux GUI program.

This is how I follow the online tutorial to convert from WSL1 to WSL2:

Start PowerShell and Run as Administrator:

CODE
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform


user posted image
After that need to restart PC....

Then download and install wsl_update_x64.msi ( https://wslstorestorage.blob.core.windows.n..._update_x64.msi )

Finally type:
CODE
wsl --set-default-version 2


CODE
wsl --set-version Ubuntu-22.04 2


....where Ubuntu-22.04.2 may vary depending on what you see on:

CODE
C:\WINDOWS\system32>wsl --list --verbose

NAME STATE VERSION
* Ubuntu-22.04 Stopped 2



anakkk
post Sep 6 2023, 05:12 PM

Regular
******
Senior Member
1,450 posts

Joined: Apr 2013
I am version 2, but still ubuntu 20.04
zemega
post Sep 6 2023, 05:33 PM

On my way
****
Junior Member
681 posts

Joined: Jul 2008
I will advice people that have low RAM, don't use WSL2, stick with WSL1. There's a not apparent overhead of around 2GB RAM when you use WSL2 and at least one distro.

Even worse, if you use laptop that reserved part of your RAM to the onboard graphic.
moiskyrie
post Sep 6 2023, 05:43 PM

Look at all my stars!!
*******
Senior Member
2,941 posts

Joined: Dec 2006
From: City of Neko~~Nyaa~
How to get wsl....
TSMatQuasar
post Sep 6 2023, 06:14 PM

Getting Started
**
Junior Member
180 posts

Joined: Jun 2023
QUOTE(moiskyrie @ Sep 6 2023, 05:43 PM)
How to get wsl....
*
Need to enable "Windows Subsystem for Linux" in Programs & Features first....
user posted image

Then go to Windows Store to download Ubuntu for WSL.

To launch it, open Command Prompt and type "wsl".

You can get more info from online tutorial.
angch
post Sep 6 2023, 09:45 PM

On my way
****
Junior Member
619 posts

Joined: Jul 2006
File I/O is significantly faster, esp if you just keep them inside WSL2. Mounts of the host directory (e.g the C: drive) incurs a performance penalty.

For both WSL1 and WSL2, if you create a lot of small files (e.g. node_modules), it is annoyingly slow. Go compiles are affected as well, as the dang built-in malware scanner gets in the way. Keeping the files within the WSL partition bypasses Windows Defender.

BTW, use Windows Terminal, esp. Windows Terminal Preview. Significantly better than cmd.

This post has been edited by angch: Sep 6 2023, 09:45 PM
TSMatQuasar
post Sep 20 2023, 04:19 PM

Getting Started
**
Junior Member
180 posts

Joined: Jun 2023
New update for WSL:
https://devblogs.microsoft.com/commandline/...er-2023-update/

* Automatic memory reclaim
* Automatic disk space cleanup
....among others.

 

Change to:
| Lo-Fi Version
0.0127sec    0.23    5 queries    GZIP Disabled
Time is now: 29th September 2023 - 02:45 PM