Notes when I updated a WSL version from 1 to 2

I mostly followed this article to update a WSL version, except that I didn’t enable Hyper-V until then and got an error Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. while I was trying to update the vesrion.

These are steps I did to update the WSL version.

  1. Ran PowerShell as Administrator.
  2. Enabled the Windows Subsystem for Linux by next command.
     PS C:\Windows\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
     Deployment Image Servicing and Management tool
     Version: 10.0.19041.844
    
     Image Version: 10.0.19042.868
    
     Enabling feature(s)
     [==========================100.0%==========================]
     The operation completed successfully.
    
  3. Enabled Virtual Machine Feature by next command.
     PS C:\Windows\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    
     Deployment Image Servicing and Management tool
     Version: 10.0.19041.844
    
     Image Version: 10.0.19042.868
    
     Enabling feature(s)
     [==========================100.0%==========================]
     The operation completed successfully.
    
  4. Tried to set the default vesrion of WSL to 2 and got an error.
     PS C:\Windows\system32> wsl --set-default-version 2
     Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
     For information please visit https://aka.ms/wsl2-install
    
  5. Checked if Hypber-V was enabled on my machine.

    In order to use WSL 2 on Windows 10, a CPU has to support Hyper-V. We can check whether CPU enables it or not on the result of msinfo32, which I found on this article. My result was

    • Hyper-V - VM Monitor Mode Extensions: Yes
    • Hyper-V - Second Level Address Translation Extensions: Yes
    • Hyper-V - Virtualization Enabled in Firmware: No
    • Hyper-V - Data Execution Protection: Yes
  6. Enabled Hyper-V on a BIOS setting.

    Because my CPU was Ryzen 5, I followed this comment. So, I restarted my computer, went to Advanced Frequency Settings > Advanced CPU Settings and enabled on SVM mode. Then restarted my computer again.

  7. Set default version of WSL to 2.

    Now it worked to me.

     PS C:\Windows\system32> wsl --set-default-version 2
     For information on key differences with WSL 2 please visit https://aka.ms/wsl2
    
  8. Updated existing distribution to 2.

    I also updated Ubuntu which I installed before. We can check the version of installed distributions by wsl -l -v and can also update them by wsl --set-version [Name] [Version].

     PS C:\Windows\system32> wsl -l -v
       NAME            STATE           VERSION
       * Ubuntu          Running         1
         Ubuntu-20.04    Stopped         1
     PS C:\Windows\system32> wsl --set-version Ubuntu 2
     Conversion in progress, this may take a few minutes...
     For information on key differences with WSL 2 please visit https://aka.ms/wsl2
     Conversion complete.
     PS C:\Windows\system32> wsl -l -v
       NAME            STATE           VERSION
       * Ubuntu          Stopped         2
         Ubuntu-20.04    Stopped         1
    

Edited

On March 22, 2021 - Very slow network issue

I had an issue of very slow network on WSL 2 and I had to wait for a long time while I was using apt or git. After seeing this comment, I was able to solve the issue by disabling “Large Send Offload”. I did it on Device Manager > Network adapters > Hyper-V Virtual Ethernet Adapter > Properties > Advanced.

2024

Back to Top ↑

2023

Follow Kubernetes the Hard way

4 minute read

This article was written by just following Kelsey Hightower’s Kubernetes Hardway document to understand Kubernetes internal architecture.

Gcp Billing Analyze

less than 1 minute read

There are a few documents to manage billing data in BigQuery Attribution of committed use discount fees and credits How to export to BigQuery Structur...

Prometheus Metrics Overview on Grafana

1 minute read

In this post, some variables defined in Grafana are used for Prometheus metrics, including $__rate_interval: This article describes the benefit of this va...

Use Google Secret Manager in a GKE cluster

3 minute read

There are an awesome article about the options to use the Google Secret Manager and their pros and cons. In this article, use Secrets Store CSI Driver by fol...

Working around MySQL lock metadata

2 minute read

There are multiple documents about innodb locks on MySQL 5.7: InnoDB locking Locks Set by Different SQL Statements in InnoDB Using InnoDB Transaction ...

Upgrade Windows 10 to Windows 11

3 minute read

I used to use Windows 11, but for some reasons, the OS stopped working and I needed to clean-install it from Windows 10 from windows recovery environment.

Back to Top ↑

2022

MySQL backup and restore

1 minute read

In this article, explain how to backup MySQL database using Percona Xtrabackup. There are two binaries, innobackupex and xtrabackup. innobackupex is a wrappe...

tmux

1 minute read

Basic configuration

Back to Top ↑

2021

MySQL Replication

1 minute read

This configuration is for the version 5.7 and it’s minimum configuration in the official document.

jq cheetsheet

less than 1 minute read

jq is used to parse JSON result, format and output on the cli.

Compare static site generator

less than 1 minute read

There are many web sites to compare static site generator, but they miss some explanations that require to me. For some people, these features are important ...

Back to Top ↑

2020

Getting Started with Kubernetes Deployment

less than 1 minute read

The deployment is many use cases and in this page, they’re not described. For the details for those use cases or the concept of deployment, see official page.

Overview about MySQL Lock

2 minute read

This document is written for MySQL 5.7, so these contents may be not correct for other versions.

MySQL Performance

2 minute read

This document is written for MySQL 5.7, so these contents may be not correct for other versions. In this page, performance_schema is mainly discussed.

Git hooks

less than 1 minute read

Configurations

gitHub pages

3 minute read

Getting Started See Official tutorial for detail steps.

Gitconfig

1 minute read

Configuration The detail for gitconfig is written in official page.

git cli

less than 1 minute read

Written in March 2020.

MySQL Tuner

less than 1 minute read

MySQL Tuner tool This is a tool to review a configuration for MySQL server.

kubectl cheetsheet

less than 1 minute read

Collect recent error logs If the logs are outputted by zap, error messages are aggregated by checking level = error. This log does not work very well if the ...

Introduction to GCP Cloud endpoints

less than 1 minute read

The Cloud endpoint is actually the NGINX proxy which offers the following features on GCP. Authentication and validation Logging and monitoring in GCP

HTTP/2 for Go

1 minute read

http package in golang supports HTTP/2 protocols. It’s automatically configured.

Back to Top ↑

2019

Terraform overview

1 minute read

Basic concepts There are some basic components for terraform.

Protocol Buffers for Go with Gadgets

less than 1 minute read

gogo/protobuf is the library to store some extensions from golang/protobuf in this repository. There are some useful packages that golang/protobuf does not p...

Introduction to GCP Cloud CDN

less than 1 minute read

Target upstream services Cloud CDN can have only GCP load balancer as the upstream services. And GCP load balancer can configure one of followings for backen...

Getting Started with Google closure library

less than 1 minute read

Some JavaScript library depends on Google Closure. If you need to understand the behavior of such a library, you have to know closure. The official document ...

Back to Top ↑