WSL install will try to automatically change the Ubuntu locale to match the locale of your Windows install. If you do not want this behavior you can run this command to change the Ubuntu locale after install completes. You will have to relaunch your WSL distribution for this change to take effect.
The below example changes the locale to en-US:
sudo update-locale LANG=en_US.UTF8
Why do I not have internet access from WSL?
Some users have reported issues with specific firewall applications blocking internet access in WSL. The firewalls reported are:
Kaspersky
Avast
Symantec Endpoint Protection
F-Secure
In some cases turning off the firewall allows for access. In some cases simply having the firewall installed looks to block access.
How do I access a port from WSL in Windows?
WSL shares the IP address of Windows, as it is running on Windows. As such you can access any ports on localhost e.g. if you had web content on port 1234 you could https://localhost:1234 into your Windows browser.
For more information, see Accessing network applications.
How can I back up my WSL distributions?
The best way to backup or move your distributions is via the export/import commands available in Windows Version 1809 and later. You can export your entire distribution to a tarball using the wsl --export command. You can then import this distribution back into WSL using the wsl --import command, which can name a new drive location for the import, allowing you to backup and save states of (or move) your WSL distributions. To learn more about moving your WSL distributions, see How can I transfer my WSL files from one machine to another?.
Traditional backup services that backup files in your AppData folders (like Windows Backup) will not corrupt your Linux files.
Can I use WSL for production scenarios?
Yes, however WSL has been designed and built to use with inner loop development workflows. There are design features in WSL that make it great for this purpose but may make it challenging for production-related scenarios compared to other products. Our goal is to make clear how WSL differs from a regular VM environment, so you can make the decision on whether it fits your business needs.
The main differences between WSL and a traditional production environment are:
WSL has a lightweight utility VM that starts, stops and manages resources automatically.
If you have no open file handles to Windows processes, the WSL VM will automatically be shut down. This means if you are using it as a web server, SSH into it to run your server and then exit, the VM could shut down because it is detecting that users are finished using it and will clean up its resources.
WSL users have full access to their Linux instances. The lifetime of the VM, the registered WSL distributions, etc., are all accessible by the user and can be modified by the user.
WSL automatically gives file access to Windows files.
Windows paths are appended to your path by default, which could cause unexpected behavior for certain Linux applications compared to a traditional Linux environment.
WSL can run Windows executables from Linux, which could also lead to a different environment than a traditional Linux VM.
The Linux kernel used by WSL is updated automatically.
GPU access in WSL happens through a /dev/dxg device, which routes GPU calls out to the Windows GPU. This setup is different than a traditional Linux set up.
There are other smaller differences compared to bare metal Linux and more differences are expected to arise in the future as the inner loop development workflow is prioritized.
How can I transfer my WSL files from one machine to another?
There are a few ways you can accomplish this task:
The easiest way is to use the wsl --export <Distro> <FileName> --format vhd command to export your WSL distribution to a VHD file. You can then copy this file to another machine, and import it using wsl --import <Distro> <InstallLocation> <FileName> --vhd. See the import and export commands in the WSL basic commands doc for more information.
The implementation above requires a lot of disk space. If you don't have a lot of disk space you can use Linux techniques to move your files over:
Use tar -czf <tarballName> <directory> to create a tarball of your files. You can then copy these specific files over to your new machine and run tar -xzf <tarballName> to extract them.
You can also export a list of installed packages via apt with a command like so: dpkg --get-selections | grep -v deinstall | awk '{print $1}' > package_list.txt and then reinstall those same packages on another machine with a command like sudo apt install -y $(cat package_list.txt) after transferring the file over.
How can I move my WSL distribution to a different drive or location?
You can do this using PowerShell. Below are the necessary commands and explanations for each step. Please open a PowerShell window and adjust the values in between the <> tags to fit your specific use case:
# Export your distro to that folder as a VHD
wsl --export <Distro, e.g: Ubuntu> <FileName, e.g: D:\WSLDistros\Ubuntu\ext4.vhdx> --format vhd
# Unregister your old distro
# Please note this will erase your existing distro's file contents, please ensure the backup file you created in the 2nd step is present at the location and that the export operation completed successfully.
# Please exercise caution when using this command, as it is destructive and could cause data loss.
wsl --unregister <Distro, e.g: Ubuntu>
# Import your VHD backup
wsl --import-in-place <Distro, e.g: Ubuntu> <FileName, e.g: D:\WSLDistros\Ubuntu\ext4.vhdx>
How to set your default user account
You can set up your default user account by setting a wsl.conf value of user.default=<name>
WSL 2
Is WSL 2 available on Windows 10 Home and Windows 11 Home?
Yes. WSL 2 is available on all Desktop SKUs where WSL is available, including Windows 10 Home and Windows 11 Home.
Specifically, WSL2 requires two features to be enabled:
"Virtual Machine Platform" (a subset of Hyper-V)
"Windows Subsystem for Linux"
Does WSL 2 use Hyper-V?
The newest version of WSL uses a subset of Hyper-V architecture to enable its virtualization. This subset is provided as an optional component named "Virtual Machine Platform," available on all Desktop SKUs.
What will happen to WSL 1? Will it be abandoned?
We currently have no plans to deprecate WSL 1. You can run WSL 1 and WSL 2 distros side by side, and can upgrade and downgrade any distro at any time. Adding WSL 2 as a new architecture presents a better platform for the WSL team to deliver features that make WSL an amazing way to run a Linux environment in Windows.