Using WSL for non-obvious tasks

  • WSL 2 offers a nearly complete Linux environment within Windows, with good performance, high compatibility, and a relatively limited impact on the host system.
  • The main headaches for WSL usually come from the network (DNS, VPN, corporate firewall) and virtualization, but almost all of them have known solutions.
  • WSL is ideal for developing and testing projects designed for Linux (Docker, servers, databases) while maintaining the classic Windows workflow.
  • When WSL is no longer needed, it is possible to uninstall distros and optional features to leave Windows virtually as it was before.

Using WSL for non-obvious tasks

WSL, Docker, Linux, and virtual machines… It seems like a complex world for those working on Windows development projects. Many developers hear wonderful things about the Windows Subsystem for Linux , but when they sit down at their PCs, they're not clear on what real problems it will solve, what risks it carries, or how to clean everything up afterward.

In this article, we'll take a closer look at what WSL is, its uses beyond the obvious, and, most importantly, how to use it in a way that minimizes disruption to your Windows installation . We'll also explore when you might want to switch things up and use Linux as your primary operating system, leaving Windows in a virtual machine.

What exactly is WSL and why are so many people talking about it?

WSL stands for Windows Subsystem for Linux, the Windows subsystem for running Linux distributions integrated within Windows 10 and 11. Microsoft's idea is simple: to give you a "real" Linux environment without forcing you to use dual boot or set up a classic virtual machine with VirtualBox or VMware.

In practice, with WSL you can have a Linux distribution like Ubuntu, Debian, or Kali running alongside Windows, share files between both environments, and launch typical Linux tools (bash, ssh, apt, Python, Node, Docker, etc.) without leaving your usual desktop. All this with a high degree of integration with the host system.

Since its launch, WSL has generated highly polarized opinions. Some developers consider it an absolute success and a compelling reason to remain on Windows. Others, especially from the more purist Linux community, see it as an "adopt-extend-extinguish" strategy to maintain Microsoft's desktop hegemony . Beyond the controversy, the reality is that WSL has changed the way many developers work.

The current recommended version is WSL 2 , which is no longer just a compatibility layer but uses a lightweight virtual machine with a real Linux kernel. Microsoft insists that "it's not a traditional VM" because it creates, configures, and optimizes it for you, but underneath it's virtualization with technologies like Hyper-V.

WSL

WSL 1 vs WSL 2 and requirements you should keep in mind

Today it's important to understand the difference between WSL 1 and WSL 2, especially regarding performance, compatibility, and hardware requirements . WSL 1 translated Linux system calls to Windows; it worked well for many things, but lacked compatibility with more advanced tools.

With WSL 2, Microsoft changed its approach: it runs a complete Linux kernel inside a highly optimized virtual machine . This greatly improves compatibility (Docker, typical Linux file systems, etc.), and most software that works on a "real" Linux system also works within WSL 2.

The downside is that WSL 2 has more dependencies. It requires CPU virtualization support and SLAT (Second Level Address Translation) , which is present in relatively modern processors (Intel Nehalem and later, AMD Opteron and successors). Older CPUs, such as some Core 2 Duo processors, simply won't be able to use WSL 2 even if you enable all the features.

Furthermore, to use WSL 2 you need a sufficiently recent version of Windows: Windows 10 1903 (build 18362) or later, or Windows 11. On earlier systems, you'll have to stick with WSL 1, with its limitations. This means that, in a way, you're still subject to Windows requirements and lifecycles : if your machine becomes unsupported, WSL will too.

Quick WSL setup and first decisions

In current versions of Windows, Microsoft has greatly simplified the process. From a PowerShell console with administrator privileges, simply run the command `wsl --install` to install WSL and a default Ubuntu distribution . The system itself downloads the necessary components and the distribution from the Microsoft Store.

During the first boot of the distro, you will be asked to create a username and password for the Linux system . This user is your main account within the distro, completely separate from your Windows account, which helps maintain a degree of isolation.

If you want to go a step further, you can list all available distributions with `wsl --list --online` and choose, for example, Debian, Kali, openSUSE, or other Ubuntu variants. Installation is done with `wsl --install -d DISTRIBUTION_NAME` , and each distribution lives in its own isolated "box".

By default, on new systems the wsl --install command itself configures WSL 2 as the base version , but you can ensure this with wsl --set-default-version 2. If you already have distributions created with WSL 1, you can migrate them individually with wsl --set-version DISTRIBUTION_NAME 2 , at the cost of a small conversion time.

WSL

How WSL affects your Windows system and where it stores things

One of your main concerns is probably how much WSL "clutters" your Windows system and where everything you install on Linux ends up. Essentially, each WSL distribution is stored in a user data folder within %LocalAppData%\Packages , and if you prefer to manage files outside of the classic Explorer, you can use alternative file managers . It doesn't scatter files all over the disk like a traditional Linux installation would.

Inside that folder is a LocalState directory with a virtual disk (VHDX) containing the entire Linux file system: /, /home, /var, etc. This means the web server, Docker, databases, project code—everything resides within that container. As long as you don't touch anything outside of it, the impact on typical Windows paths is minimal.

However, WSL requires enabling certain system features: "Windows Subsystem for Linux" and, for WSL 2, "Virtual Machine Platform." This can be done via PowerShell (Enable-WindowsOptionalFeature) or from the "Turn Windows features on or off" GUI. The Linux kernel for WSL is also installed in %SystemRoot%\System32\lxss\tools.

These components become part of Windows once activated, so if you ever want to restore your system to its original state, as if you'd never used WSL , you'll need to uninstall the distributions, disable optional features, and, if necessary, remove the kernel package. It's not a simple "just delete a folder and you're done" process, but it's not particularly complicated either.

Also note that WSL creates a virtual network interface, configures firewall rules, and, in the case of WSL 2, relies on services like ICS (Internet Connection Sharing) and HNS to manage internal NAT, DNS, and DHCP . All of this is transparent in day-to-day operations, but it explains why certain VPNs or corporate firewalls sometimes conflict with WSL.

Using WSL for web development and less obvious tasks

Beyond the typical "I want to have bash on Windows," WSL shines when you need to replicate production Linux environments without leaving your Windows desktop . For example, the case you mentioned: a FOSS project that uses Docker, Flask, ArangoDB, and other backend services.

Instead of struggling with obscure Windows versions or native Docker Desktop on Windows (which has historically been quite a hassle), you can install the entire stack directly within your WSL distribution. Docker runs naturally on the WSL 2 kernel , Linux services function as they would on a real server, and you can continue using VS Code or other graphical tools from within Windows.

There are also less obvious advantages. You can run administrative scripts, Linux-specific command-line tools, good versions of Node and NVM, package managers like apt , and generally the entire ecosystem of utilities that server developers are used to.

Thanks to file system integration, WSL mounts your Windows disks under /mnt (for example, /mnt/c for drive C:). This allows you to edit code with your Windows editor and run it within Linux without duplicating projects.

Another interesting feature is the interoperability in the other direction: from the Linux shell, you can call Windows executables like notepad.exe, powershell.exe, or any .exe file on the system . If your PATH variable includes Win32 paths like /mnt/c/Windows/System32, you only need to type the executable's name to launch it, unless your shell has accidentally overwritten the PATH.

WSL

Windows Terminal: the perfect partner for WSL

To make your WSL experience more convenient, Microsoft recommends using Windows Terminal . It's a modern application that lets you open tabs for different shells: PowerShell, CMD, and, very importantly, each of your WSL distributions.

With Windows Terminal, you can create Ubuntu, Debian, or Kali sessions from a single program, complete with tabs and panels, configure keyboard shortcuts, and customize fonts, colors, and profiles without having to maintain multiple separate cmd.exe windows. Furthermore, it eliminates the need for outdated tools like PuTTY for SSH connections, allowing you to connect to remote servers directly from a WSL distribution.

The typical workflow for many Windows developers today is: code in VS Code, main terminal in Windows Terminal, and backend and tools within WSL . This combination offers an experience very similar to working on macOS or directly on a desktop Linux distribution.

Network, DNS, VPN and other headaches in WSL

Where WSL 2 usually causes the most trouble is on the network: when using a lightweight VM, it depends on a virtual adapter, firewall rules and a small internal NAT that sometimes clash with corporate configurations, VPNs, antivirus with firewalls or strict security policies.

A common problem is that WSL lacks internet access on corporate computers . In many Active Directory domains, organization-defined firewall rules block local rules. Because the exception HNS creates to allow DNS traffic from the WSL vNIC is local, it is overridden. If `AllowLocalFirewallRules` or `AllowInboundRules` are set to `False` in the corresponding profile (using `Get-NetFirewallProfile`), WSL will be unable to resolve names.

The solution involves the administrator defining an appropriate corporate rule. Alternatively, WSL DNS tunneling can be enabled using the experimental dnsTunneling option in the .wslconfig file. This feature directs DNS queries from the internal Linux system to the Windows resolver through the virtualization layer, eliminating the need for traditional network packets that could conflict with the firewall.

Some VPNs also cause problems. There are known cases with Cisco AnyConnect, OpenVPN clients, and solutions like ZScaler, McAfee Safe Connect, or Bitdefender that manipulate routes, NRPT, or proxies in a way that breaks NAT or interferes with WSL traffic. Sometimes the solution is to enable `networkMode=mirrored`, other times to disable `dnsTunneling`, or even to tweak the autoProxy settings so that the HTTP_PROXY/HTTPS_PROXY mirroring within Linux is tailored to your specific situation.

In classic NAT mode, there are limitations such as only being able to define three DNS servers in `/etc/resolv.conf` , which dnsTunneling also helps resolve: Linux uses all the DNS servers configured by Windows. Furthermore, DNS suffixes are handled differently depending on whether you are in pure NAT, NAT with DNS tunneling, or mirrored mode. In the latter, all Windows DNS suffixes are reflected in the `resolv.conf` search and are automatically updated when they change on the host.

Docker and container compatibility within WSL

One of the main reasons for adopting WSL 2 has been to drastically improve the Docker experience. Microsoft and Docker's official plan is for Docker Desktop to use WSL 2 as its backend , instead of direct Hyper-V or its older engine.

However, it's not all perfect. Problems have been detected, for example, when using mirrored network mode (networkingMode=mirrored) and running containers with published ports . In these cases, Docker Desktop may fail to create these containers if you use the default network namespace. The temporary workaround is to launch the containers with `--network host` or add the problematic ports to `ignoredPorts` in `.wslconfig`.

There are also issues with containers running Network Manager or other complex network services . These can prevent WSL's network configuration from working correctly, especially for return connections to the host. Microsoft recommends disabling these types of daemons when they are not strictly necessary.

If your corporate environment also includes HTTP/S proxies and you enable autoProxy in WSL, variables such as HTTP_PROXY, HTTPS_PROXY, NO_PROXY, and WSL_PAC_URL will be populated . Note that user-defined variables take precedence over automatically generated ones. Linux does not natively support PACs, so you may need to adapt scripts or disable the feature.

Common errors within the Linux distro and how to solve them

Once inside the distro, typical Linux problems can also appear, some exacerbated by WSL's peculiarities. A classic example is that Windows commands like powershell.exe or notepad.exe won't be found when invoked from bash, displaying a "command not found" message.

In most cases, this is because a startup script (like /etc/profile in Debian) redefines the PATH without considering the value passed by WSL , losing paths like /mnt/c/Windows and similar locations. The correct approach is to either expand the PATH or remove the problematic lines, rather than overwriting it. It's also advisable to check that /etc/wsl.conf doesn't contain appendWindowsPath=false.

Another recurring problem is apt-get upgrade errors related to udev and system services that aren't supported within WSL, as it's not a complete system with traditional init. The usual solution is to install a policy-rc.d script in /usr/sbin that returns exit 101 to prevent services from starting, add execute permissions, and use dpkg-divert to redirect /sbin/initctl to /bin/true.

SSH also has its own peculiarities. If, when trying to connect to a remote server, you encounter warnings like “UNPROTECTED PRIVATE KEY FILE!” and permissions of 0777, it's most likely because you're storing keys in a directory mounted from Windows with overly lax permissions. For WSL to properly manage POSIX permissions on Windows files, it's recommended to add a section to /etc/wsl.conf with options like metadata,uid=1000,gid=1000,umask=0022.

Conversely, if you set up an OpenSSH server within your WSL distribution and when connecting from Windows you see "Connection closed by 127.0.0.1 port 22", check the logs by running sshd in debug mode and verify that there are host keys in /etc/ssh and that they haven't been deleted . If they are missing, they can be regenerated or, more simply, you can purge and reinstall the openssh-server package.

Using WSL in older versions of Windows and the legacy variant

On very old Windows 10 systems (Creators Update, Anniversary Update), WSL support is considerably more limited. These systems used bash.exe, lxrun, and a less mature implementation. Commands and paths were different. Linux commands were passed with bash -c, distributions were stored in %LocalAppData%\lxss, and interoperability with Windows was more rudimentary.

If you're coming from that era and still have the "legacy version" of WSL, Microsoft recommends migrating your data to a modern distribution from the Store and uninstalling the old one. You can do this with `wsl --unregister Legacy` or by manually deleting the `%LocalAppData%\lxss` folder (be careful, this will delete all your old Linux files).

On those systems, features like WSL 2, official support for graphical Linux applications, Docker Desktop integration, and the simplified `wsl --install` command are unavailable. If your hardware allows it, the best option is to upgrade to a recent build. Or, you could upgrade directly to Windows 11 to take advantage of the current version of the subsystem.

In any case, if your primary goal is to minimize the impact on Windows, or if your computer is falling behind in terms of requirements, there's an increasingly viable alternative: using Linux as your main operating system and relegating Windows to a virtual machine (for example, with VirtualBox, VMware, or GNOME Box). This way, you avoid relying on the ever-increasing requirements of Windows 11 and keep your hardware running longer.

Schedule tasks in Linux using Crontab
Related article:
Schedule tasks in Linux using Crontab

Add as preferred source in Google