Why Would WSL Use the Wrong Distro from the Command Line on Occasion?

Abstract: Resolve WSL launching the incorrect distribution by checking wsl --list --verbose and setting the correct default with wsl --set-default.

Created: 2026-09-30 by

WSL uses the wrong distro because a specific distribution is set as the default via wsl --set-default, or because you are launching a session with an explicit name like wsl -d Ubuntu-20.04. To fix this, check your current default with wsl --list --verbose and reset it using the --set-default flag followed by the correct distribution name.

Understanding WSL Default Behavior

When you open a terminal in Windows, whether it is Command Prompt, PowerShell, or Git Bash, the system needs to know which Linux environment to launch if you simply type wsl without arguments. By design, WSL will always attempt to start the distribution that has been marked as the "default." This behavior is consistent across all command-line interfaces on Windows. If you have multiple distributions installed, such as Ubuntu, Debian, and Kali Linux, only one can hold this default status at any given time. The confusion often arises when users install a new distribution but find that their old habits persist. For instance, if you previously used Ubuntu 18.04 as your primary workhorse and later installed Ubuntu 22.04, typing wsl might still drop you into the older version. This happens because the installation process does not automatically change the global default setting. You must explicitly tell WSL which distribution should be the entry point for future sessions. Another common scenario involves mixing different types of shells. If you are accustomed to using bash directly from Windows Command Prompt, you might expect it to behave identically to typing wsl. However, bash may invoke a different subsystem or fallback mechanism depending on how Windows is configured. The most reliable way to ensure you are interacting with WSL specifically is to use the wsl executable provided by Microsoft. Understanding this distinction helps isolate whether the issue is with the distribution selection or the shell invocation method.

Checking Your Current Configuration

Before making changes, you need to see what WSL currently thinks the default is. The command wsl --list --verbose (or its shorthand wsl -l -v) provides a comprehensive list of all installed distributions along with their states (Running, Stopped, etc.) and their assigned versions. Look at the output carefully. There isn't a column explicitly labeled "Default," but the system implicitly treats the first one listed in some contexts, or more accurately, the one specified by the internal registry key. However, the most direct way to verify the active default is to run wsl and then check inside the Linux environment. Once inside, you can look at the prompt or run cat /etc/os-release to confirm which distribution you are actually using. If the output does not match what you intended, then the default setting is indeed incorrect. This diagnostic step confirms that the problem is not a corrupted installation but a configuration mismatch.

Changing the Default Distribution

Resolving the issue requires updating the default setting. This is done using the wsl --set-default command. You need to specify the exact name of the distribution you want to become the default. These names are case-sensitive and must match exactly what appears in the wsl --list output. For example, if you want Ubuntu 22.04 to be the default, you would run:
wsl --set-default Ubuntu-22.04
After executing this command, there is no confirmation message, but the change takes effect immediately for subsequent launches. Close your current WSL session and open a new one by simply typing wsl in your Windows terminal. You should now find yourself in the correct distribution. This method is permanent until you change it again, so choose wisely based on your daily workflow needs. If you frequently switch between distributions for different projects, relying solely on the default might become cumbersome. In such cases, you might prefer to launch specific distributions by name. This approach bypasses the default setting entirely and ensures you always get the environment you requested.

Launching Specific Distributions

Instead of changing the global default, you can launch a specific distribution directly from the command line. This is useful when you need to perform tasks in a non-default environment. Use the -d or --distribution flag followed by the distribution name. For example:
wsl -d Debian
This command will open a shell session within the Debian distribution, regardless of what is set as the default. You can also combine this with other flags, such as running a specific command inside that distribution:
wsl -d Ubuntu-20.04 ls /home/user
This technique is particularly helpful for automation scripts or when you need to quickly verify something in a secondary distribution without switching your main workspace. It provides flexibility and reduces the cognitive load of remembering which distribution is currently set as the default.

Troubleshooting Persistent Issues

In rare cases, even after setting the default correctly, you might still encounter issues. One potential cause is conflicting configurations in user profile scripts. If your .bashrc or .profile contains commands that redirect execution or alter the environment unexpectedly, it might create the illusion that the wrong distro is running. Check these files for any unusual aliases or exec commands. Another factor to consider is the integration level of WSL. Ensure that your Windows Subsystem for Linux feature is fully enabled and up to date. Sometimes, partial updates or glitches in the WSL kernel can lead to unpredictable behavior. Running wsl --update in an elevated Command Prompt or PowerShell can refresh the WSL components to their latest stable versions. This step often resolves underlying bugs that manifest as distribution selection errors. For those managing complex setups, such as transferring installations to external drives, ensure that the paths and symlinks are correctly maintained. Issues like those described in guides for transferring WSL Ubuntu installation to USB can sometimes lead to path resolution problems that affect distro selection. Always verify that the storage location for your default distro is accessible and not corrupted. Additionally, permission issues can sometimes masquerade as distro errors. If you encounter lock errors or file access denied messages, it might indicate that the distro is running in a restricted state. Referencing solutions for fixing WSL 'Failed to take /etc/passwd lock' errors can help resolve underlying system integrity issues that prevent proper initialization. Finally, remember that GUI applications launched from WSL, such as those needed for tools like Burp Suite, rely on the correct distro being active. If your GUI apps fail to launch, double-check that your CLI is pointing to the right distribution, as compatibility layers differ between distros. See our guide on using Burp Suite within WSL for insights into maintaining consistent environments for graphical tools.

Frequently Asked Questions

How do I remove a WSL distribution?

You can uninstall a distribution using the wsl --unregister command followed by the distribution name. This removes the filesystem and settings, freeing up disk space, but it does not delete the WSL feature itself. Be aware that this action is irreversible without reinstalling the distribution.

Can I have two distributions as defaults?

No, WSL only supports one default distribution at a time. The wsl command without arguments will always launch this single default. If you need to use another distribution, you must either change the default or explicitly specify the distribution name using the -d flag.

Why does my WSL distro keep reverting to the old one?

This usually happens if you are not using the wsl command but instead invoking bash directly from Windows CMD or PowerShell. These shells may have their own legacy configurations. Always use the wsl executable to respect the WSL default setting.

Is it safe to change the default distro while others are running?

Yes, changing the default distribution does not affect currently running instances. You can have multiple distros running simultaneously in separate windows. The default setting only influences new sessions launched without explicit parameters.

What if I forget the exact name of my distribution?

Run wsl --list --verbose to see a complete list of all installed distributions. The names displayed there are the ones you should use with the --set-default or -d flags. Copying the name directly from this list prevents typos.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More