Switching to Windows Subsystem for Linux
Tags: wsl, todayilearned, todayisearched
Published: 2020-11-01 22:57:12

I have bought a pre-installed Windows 10 notebook last year. But earlier this year, I have decided to completely migrate to Fedora Workstation before working on my undergraduate thesis. Indeed, I had some experience in using Linux on my previous notebook while studying at my university—where no one has used single boot Linux even in the computer science education department except just me and a teaching partner of mine under the supervision of the same lecturer—.

After graduating last October, on the 13th to be precise, I was considering to "return" to Windows. That's not what actually happened, as I have been doing some research to find out what WSL2 really is. Is that really worth it to replace my current single boot operating system?

Multi-booting, for me, was painful. There were many problems that I have faced. I have no idea why I could not synchronise the clock time between the two on my UEFI computer. I know, right, that I am so embarrassing! Also, having to reboot into a different OS was very uncomfortable.

I am still in a dilemma today. Even though I could go with Fedora almost entirely as a daily driver, I am still missing some "good" and "professional" software on Windows. As we already know, some of them have no substitutes. Not really, but every software tends to be unique. Even if there is [Wine](https://www.winehq.org/) and [Proton](https://www.protondb.com/) with Steam Play on Linux nowadays, it does not count. Apart from PC desktop, I think, using Nvidia on GNU/Linux-based laptop is still less pleasant. I could not put my laptop into sleep safely without losing control of the Nvidia GPU and Wi-Fi adapter. I have never tried [Bumblebee](https://wiki.archlinux.org/index.php/bumblebee) for Nvidia Optimus before. Do you think Bumblebee can get rid of it?

I have no issue with X.Org using my GPU, since Fedora uses Wayland by default. I hope everyone considers switching to Wayland because I have heard such [sad news](https://www.theregister.com/2020/10/30/x_server_lead_maintainer_declares/).

To be honest, I have no real reason to leave my beloved Fedora. Still, it is perhaps only my ego. Depending on what work I will do in the future, maybe I really have no reason at all to write this article.

## Two Computers

Do not ask me to explain this. That is self-explanatory.

## Dual Booting

As I have mentioned above, I dislike multiple booting for whatsoever reason. Stick with Windows or use Fedora instead. Not so, in reality, the latter is my strong suggestion. Well, it does not have to be Fedora.

In the most common case, you have nothing to lose. But you may run into some problems, if so, please consider to turn off [the fast startup](https://docs.microsoft.com/en-us/windows-hardware/test/weg/delivering-a-great-startup-and-shutdown-experience#fast-startup) in Windows 8+ and/or [the secure boot](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/secure-boot-landing) in UEFI. For the well-known problem of losing Windows boot entry from the GRUB-like menu, this could easily be fixed by recreating the GRUB boot loader configuration.

Perhaps someone out there will yell at you later if it is inefficient or bloated! But this is the only way if you want to run Windows and Fedora natively.

## Virtual Machine

For many reasons, regardless of which OS I am using, I always run multiple Linux distros in virtual machines. But what if running Windows in a virtual machine? What can be expected of that? Well, you could still run Visual Studio to develop Windows native applications, namely Windows Forms (WPF) and Universal Windows Platform (UWP), and other tasks smoothly. But it will require a [special license](https://download.microsoft.com/download/9/8/d/98d6a56c-4d79-40f4-8462-da3ecba2dc2c/licensing_windows_desktop_os_for_virtual_machines.pdf).

There is no need to worry about using the GPU on a virtual machine, you will have the opportunity to perform a [PCI passthrough](https://docs.fedoraproject.org/en-US/Fedora/13/html/Virtualization_Guide/chap-Virtualization-PCI_passthrough.html) if you own multiple dedicated GPUs. Seriously, even if you only have one dedicated GPU, you can still survive but with intermediate skills.

What I like best is that we can easily get snapshots of the entire OS. You only need to pay most attention to sharing resources. Anyway, never ask for too much while using a virtual machine.

## Windows Subsystem for Linux

The last option is using Windows Subsystem for Linux (WSL), right? I have nothing to say about this new technology from having only used it a week. But let me try to tell what I have learned about WSL2.

I am neither into writing a how-to nor a technical details in here, since there are so many awesome articles around. We can install WSL2 just by following a few steps from [the official documentation](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Despite finding it disappointed, there are several distros available in the Microsoft Store. No Fedora unfortunately. However, you can install it yourself by following [a great article](https://dev.to/bowmanjd/install-fedora-on-windows-subsystem-for-linux-wsl-4b26) written by [Bowman](https://dev.to/bowmanjd).

Using [Docker](https://www.docker.com/why-docker) on Windows 10 Home is no longer impossible! You can install [Docker Desktop](https://docs.docker.com/desktop/) on it by following [the official documentation](https://docs.docker.com/docker-for-windows/install-windows-home/#install-docker-desktop-on-windows-10-home). What about Podman/Buildah? It just works out of the box! ~~Note that systemd is not supported in the WSL2 yet. But do not even worry at all, there are certain [little hacks](https://github.com/DamionGans/ubuntu-wsl2-systemd-script) that have been done.~~ Edit: as per September 21st, 2022, systemd support [is now available](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/) officially.

For my sake, I will stick with Docker instead. [It allows me](https://code.visualstudio.com/docs/remote/wsl-tutorial) to easily integrate those containers with Visual Studio Code. I cannot find a way to connect to the Podman's containers running on WSL2 other than using [an SFTP extension](https://marketplace.visualstudio.com/items?itemName=liximomo.sftp) in theory. But why does it have to be a choice?

Working on a machine learning project in WSL2 seems promising, although setup is not so easy at this point. I have to admit that I have not tried it myself, but [it is said](https://docs.microsoft.com/en-us/windows/wsl/tutorials/gpu-compute) that it is perfectly possible!

One thing I have noticed the most is the increasing use of the memory when running some containers in the WSL2. Even though then I stopped it all, I did not get automatic reclaiming to the memory. Yet we can [do it manually](https://devblogs.microsoft.com/commandline/memory-reclaim-in-the-windows-subsystem-for-linux-2/) for sure or just shutdown the WSL2 after using it.

Another one is the poor performance across Windows file system as explained in [the official overview](https://docs.microsoft.com/en-us/windows/wsl/compare-versions). All we need to do is move our project directories into the WSL2 file system.

---

That's all I can write about for now. What do you think about switching to WSL2? Please let me know in the comments below. Thank you so much for being a reader of my first post ever in here! Shhh, I am still learning to write in English.