Getting Started with WSL in Windows 11

- by

I wanted to access several EXT4 partitions on a dual-boot Fedora/Windows system from Windows to share storage space. One option I came across was to boot into Windows, then use WSL to mount these partitions and use them as if they were native drives. Did it work? I’ll leave that for another article (it got complicated). For now, here’s a little cheat sheet of how to get started with WSL in Windows 11.

What is WSL?

The Windows Subsystem for Linux (WSL) is a native Microsoft way to use Linux features directly from Windows. Technically I guess it should be called the “Linux Subsystem for Windows”, since that’s more what’s really happening, but who am I to argue?

WSL works natively in Windows 11 and works a bit like a virtual Linux machine, without the overheads of a fully fledged hypervisor. It needs to be installed though, and the processor needs to support virtualization.

Installing WSL

From an elevated command prompt, we can install all components with a single line:

wsl --install

This will add the components for WSL, including a default Ubuntu installation, but a restart is required before first launch. If you don’t do this, an error message appears and WSL can’t launch Linux.

To launch Linux, take a look at the Start menu and search for “Ubuntu”, then click on it and a familiar command line window should come up. This will prompt you to setup a Linux user name and password. That’s it! Now you’re rocking Ubuntu.

Several other distros are available from the regular command prompt, including Debian and Suse, and now even Fedora! This is the one I prefer, but it wasn’t available when I first tried WSL. Thankfully some nice people had made it available from the Microsoft Store for free or a small free (called “Fedora WSL” by Vineel Sai, and the “Fedora Remix” by Whitewater Foundry).

You can also install a distro via the command line by using

wsl --install --DistroName

where DistroName is something from the list of available images you can list with

wsl --list --online

If you have a preferred distro, you can make it the default with

wsl --set-default DistroName

Launching WSL

One option is to use the Start menu and pick a distro from there. This will open up a terminal window, with your chosen distro running. Alternatively, we can launch WSL directly from Powershell. To launch the default distro, simply type this:

wsl

To launch a particular distro that isn’t the default, we can use this syntax (using Ubuntu as an example):

wsl --distribution Ubuntu

Shutting Down and Removing WLS

When we’re done working with WSL, we can shut it down with

wsl --shutdown

Should that not work, we can also forcefully terminate our arrangement with

wsl --terminate

When we’re done playing with a distribution (or if we’ve accidentally ruined it), it’s easy to remove it with

wsl --unregister DistroName

WSL Troubleshooting

On my laptop all of this worked as described on the first try, but on my HP Z840 workstation I had some issues and WSL didn’t want to launch. Turns out although my CPUs are Hyper-V compatible, the option was disabled in the security menu of the BIOS. Once enabled, all components installed fine.

I’ve diagnosed this by going into the “Turn Windows Features on and off” section, where one of the Hyper-V components was greyed out with the messages that the feature is disabled on my hardware. There’s a nice troubleshooting section on the official Microsoft Website for other issues.

Further Reading



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.