Skip to content

Instantly share code, notes, and snippets.

@coopbri
Last active August 22, 2020 04:43
Show Gist options
  • Save coopbri/75a3b981b94d5346c6a82199bb6a847a to your computer and use it in GitHub Desktop.
Save coopbri/75a3b981b94d5346c6a82199bb6a847a to your computer and use it in GitHub Desktop.
Convert an existing WSL1 Arch Linux to WSL2

Converting Arch Linux on WSL 1 to WSL 2

Currently (and probably in the future), the official Microsoft documentation for upgrading from WSL1 to WSL 2 does not suggest Arch Linux as a distribution. This may be due to the fact that it was removed from the Windows Store. However, it is still possible to use Arch Linux on WSL 2. The steps for converting Arch Linux from WSL 1 to WSL 2 are outlined below.

Prerequisite Version Check

  • Make sure Windows 10 version 2004, build 19041 or higher is installed. This can be verified by executing winver in the Run dialog (Meta + R).

Install WSL 2

  1. Install the Windows Subsystem for Linux optional feature:
PowerShell (Admin)
------------------

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. Install the Virtual Machine Platform optional feature:
PowerShell (Admin)
------------------

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart before continuing.

(Optional) Set WSL 2 as Default for New Distributions

Note that this is not required for the task at hand here since this is only for new distributions, but I recommend it.

PowerShell
----------

wsl --set-default-version 2

If the above command does not work, you may need to update the WSL 2 Linux kernel.

Convert Existing Arch Linux on WSL 1 to WSL 2

Verify your existing (installed) WSL distributions:

wsl --list --verbose

Example output:

  NAME      STATE           VERSION
* Arch      Stopped         1
  Ubuntu    Stopped         1

If an Arch Linux instance is listed in the output, use that name for the below command (I don't think it's case-sensitive; I was able to use arch):

wsl --set-version $DISTRO_TO_CONVERT 2

For example,

wsl --set-version arch 2

You may get ouput similar to below when it is finished.

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.

If you try to access the distribution before the conversion is complete, there is a security measure that prevents access:

An install, uninstall, or conversion is in progress for this distribution.

Noice.

Verify Conversion

Verify the conversion with wsl --list --verbose:

  NAME      STATE           VERSION
* Arch      Stopped         2
  Ubuntu    Stopped         1

As you can see, the WSL 1 Arch instance has been converted to WSL 2 as indicated by the version number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment