WSL Registry Key for Default Linux Distributions
The Windows Subsystem for Linux (WSL) manages its configurations and installed distributions through specific entries in the Windows Registry. This article identifies the exact registry key used by Windows to store WSL distribution data, details how the default distribution is tracked, and explains the primary configuration values contained within the registry.
The WSL Registry Location
The configuration data for WSL and its installed distributions is stored under the following Registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss
How the Default Distribution is Configured
Within the Lxss key, Windows manages the default
distribution using a specific string value:
- Value Name:
DefaultDistribution - Type:
REG_SZ - Data: A Unique GUID representing the default Linux
distribution (for example,
{a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d}).
The GUID stored in DefaultDistribution corresponds to
one of the subkeys directly beneath the Lxss folder.
Distribution Configuration Subkeys
Each installed distribution has its own subkey under
Lxss named after its assigned GUID. Inside each GUID
subkey, you will find the following configuration values:
- DistributionName: The user-facing name of the
distribution (e.g.,
Ubuntu,Debian,openSUSE). - BasePath: The local file system path pointing to
the virtual hard disk (
ext4.vhdx) or root filesystem directory. - DefaultUid: The default user ID used when launching
the shell (typically
1000for the standard user or0for root). - Version: Indicates whether the distribution is running on WSL 1 or WSL 2.
- State: The current operational state of the distribution.
- Flags: Bitmask flags defining behavior, such as automatic mounting of Windows drives and interop support.
Viewing and Managing the Keys
To inspect these settings manually:
- Press
Win + R, typeregedit, and press Enter. - Navigate to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss. - Select the
Lxsskey to view theDefaultDistributionGUID, or select individual GUID subkeys to view the configuration of specific distributions.
While you can modify these values directly in the Registry Editor, the recommended way to change the default distribution is via the command line using:
wsl --set-default <DistributionName>