Installing WSL2

Installing WSL2 and an Ubuntu Distribution

WSL2 6 runs a real Linux kernel in a lightweight Hyper-V virtual machine, on Windows 10 version 2004 (build

  1. or later, or Windows 11. In an Administrator PowerShell 55,538 , run wsl --install -d Ubuntu-26.04

(wsl --list --online shows other names), reboot, and check that VERSION reads 2, since WSL 1 has no real kernel and cannot run systemd 142,543 :

Checking WSL and its distributions after the rebootShell
wsl --version; wsl -l -v
Output
WSL version: 2.7.14.0
...
  NAME            STATE           VERSION
* Ubuntu-24.04    Stopped         2
  Ubuntu-26.04    Running         2

Setting up this book's machine hit two errors whose fixes are not obvious:

WSL installation errors met on a real machine, and the fixes that worked
Error message What fixed it
"An error occurred in the secure channel support" msiexec /i wsl.2.7.14.0.x64.msi, from WSL's GitHub 29 releases
"virtualization is not enabled on this machine" bcdedit /set hypervisorlaunchtype auto as Administrator, reboot

The first appeared on a working network (a browser downloaded the same file). The second appeared with virtualization on in the BIOS, because Windows was set not to start its hypervisor. To install offline, download the ubuntu-26.04.1-wsl-amd64.wsl image (418 MB) that Microsoft's DistributionInfo.json (https://raw.githubusercontent.com/microsoft/WSL/master/distributions/DistributionInfo.json 743 ) lists, compare Get-FileHash with the SHA256SUMS file beside it on releases.ubuntu.com, and run wsl --install --from-file .\ubuntu-26.04.1-wsl-amd64.wsl --name Ubuntu-26.04.