How to update and maintain your WSL2 installation
wsl --update, wsl --version, Linux package manager apt, apt update vs apt upgrade, keeping kernel current, WSL2 shutdown command
Keeping WSL2 Up to Date
WSL2 has two independent update surfaces: the WSL kernel (managed by Windows/PowerShell) and the Linux packages inside your distro (managed by apt). You need to maintain both.
Updating the WSL kernel
# Run in PowerShell
wsl --update
# Check current WSL version
wsl --versionMicrosoft pushes kernel updates through Windows Update, but wsl --update lets you pull them immediately without waiting for a patch cycle.
Updating packages inside Ubuntu
# Run inside your WSL2 terminal
sudo apt update # refreshes package index
sudo apt upgrade -y # installs all available upgradesRun this regularly — at minimum before starting a new project. apt update alone does nothing to your installed software; it only refreshes the list of available versions. apt upgrade is what actually installs updates.
Full shutdown of WSL2
# Shuts down all running distros and the WSL2 VM
wsl --shutdownWSL2 does not fully shut down when you close the terminal window — it idles in the background. Use wsl --shutdown before updating the kernel or when troubleshooting memory usage. The VM restarts automatically the next time you open a distro.
