How to Reinstall WSL2 (Windows Subsystem for Linux 2) – Step-by-Step Guide for Beginners

🔁 Step 1: Uninstall the Current WSL Installation

1.1 Open PowerShell as Administrator

  • Type “PowerShell” in the Start menu.
  • Right-click on Windows PowerShell, then select Run as administrator.


1.2 Check Installed Linux Distributions

Run this command to list all installed Linux distributions:

wsl --list


1.3 Unregister a Specific Distribution

If you want to remove a specific distribution (e.g., Ubuntu), run:

wsl --unregister Ubuntu


1.4 Shut Down WSL and Uninstall Components

First, shut down all running WSL instances:

wsl --shutdown

Then, open Settings > Apps > Installed Apps (or Apps & Features), search for
Windows Subsystem for Linux, and uninstall it.


🔄 Step 2: Reinstall WSL2

2.1 Enable Required Windows Features

Open PowerShell as Administrator again and run the following commands:

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

⚠️ Even if it says “no restart needed,” restart your PC manually before continuing.


2.2 Restart Your Computer


2.3 Download and Install the WSL2 Kernel Update

Download the official WSL2 Linux kernel update package here:

👉 Download WSL2 Kernel Update (wsl_update_x64.msi)

Run the installer after downloading.


⚙️ Step 3: Set WSL2 as the Default and Install a Linux Distribution

3.1 Set WSL2 as the Default Version

wsl --set-default-version 2


3.2 Install Your Preferred Linux Distribution

Option 1: Use Microsoft Store

  • Open the Microsoft Store and search for distributions like Ubuntu or Debian, then install your preferred one.

Option 2: Use a Command (e.g., Ubuntu)

wsl --install -d Ubuntu

📌 Note: This command works only on Windows 10 version 2004 or later, or Windows 11.


🧑‍💻 Step 4: Set Up the New Linux Environment

The first time you launch the newly installed Linux distribution,
you’ll be prompted to create a username and password for your Linux environment.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *