Photo by Gabriel Heinzer on Unsplash

WSL for newbies like me

Ahmad Syarif
3 min readMar 8, 2023

--

I’ve been working on Linux for quite some time and was exposed to a lot of stuff and technology around this operating system. But one cannot say they know Linux without knowing the WSL.

What is WSL?

for a very long time, a Windows user like me was given 2 options to use Linux. Use dual boot or use virtualization software like Virtual box. Oh wait, there is the third option, buy another machine just for the Linux

But since 2016, in the spirit of changing its public image, Microsoft announced a new feature in Windows, called Windows Subsystem for Linux Distribution, hence the abbreviation WSL (or WSFL, I guess). It’s basically a tool that allows you to run Linux OS natively on top of Windows, without needing additional software such as Virtual Box.

Windows claims with WSL you can run Linux faster with fewer resources.

In principle, I think what VM such as Virtual Box and WSL does is pretty similar. They both try to virtualize Linux. However, the way they do it is a bit different. Windows use lightweight virtualization software called Windows Hypervisor Platform while I guess VirtualBox uses heavy-weight virtualization. But as far as Hypervisor is concerned, each of them will in the end call the same POSIX interface in the Windows kernel. The WSL is faster, perhaps because windows provide a different POSIX interface dedicated to WSL, or the WSL is just more efficient because it’s built specifically to virtualize Linux. I have not found a detailed article explaining the difference between WSL and Traditional VM. if you find something, please share it with me.

But as everyone says, WSL is faster. Btw, just before you lost, in this article, I mainly refer to WSL version 2.

Getting Started

it’s actually very simple to use WSL. you just need to open the command prompt and type wsl --install and it will install the default Linux distribution, which is Ubuntu, and launch it for you.

Btw, make sure your Windows OS support WSL, because it drives me crazy last time.

I already installed the Linux before this screenshot so you will see more things when you call wsl

Just a very important point, you may see an error like this when you launch the WSL

The error message is below

The attempted operation is not supported for the type of object referenced.
Error code: Wsl/Service/0x8007273d

here is what I do to resolve it.

  1. open command prompt as administrator
  2. type netsh winsock reset. At this point, several articles or the message from this command ask you to restart your PC. well, I tell you here, you don't need to restart your PC.
  3. then type wsl --installagain

This error basically appears because there is some conflict of network port between WSL and some other application running on your machine. You can see people discussing this issue here https://github.com/microsoft/WSL/issues/9331

That’s it

well, that’s it really. Now you can play with the Linux terminal in your command prompt, and you can start saving the world, or fix some more issues you will face along the way.

Consider following me :)

--

--