3 min read

WSL is cool, but "Enhanced Session" is cooler!

It seems almost like every time that I have to put WSL to the test, it really is lacking; Enhanced Mode sessions on Windows are the way to go for the most satisfactory Linux experience which exists under Hyper-V more than WSL.
WSL is cool, but  "Enhanced Session" is cooler!

The homie Kevin asked me about WSL as he started using a Windows machine for a project as he primarily uses a Macbook...

and I recalled that I made the transition from OSX to Windows in 2009 due to a drunk incident at a party and a surly boss being unwilling to shell out company money to replace my laptop. He took it a step further to try and 'punish' me with the worst one we had that came back from a refresh that was so slow I couldn't even do my job... so, I used it as a dumb terminal to our new fancy Windows Server 2008R2 box and learned that pretty much everything that made me loathe Windows XP had been fixed in 2k8r2. I was vehemently anti-Microsoft like any self-respecting Unixbeard CURSE M$$$$ THEY'RE THE ENEMY!!! type bullshit - so I never expected that Microsoft would catch up to Apple in any way. Honestly, today you couldn't even catch me dead with an Apple product and if someone gave me an MBP for Christmas or something I would sell it to get two HP Elitebooks with better specs and still have enough money left over to buy a bicycle or something.

After the nostalgia faded, then I was brought vividly back to a much more recent incident and I had a retrospective of an entire day being wasted as WSL is good enough to get you into trouble... but not really good enough to replace an actual Linux instance or VM. I spent soooooo much time trying to build something straightforward on WSL - creating a Netboot ISO for Ubuntu 18.04.03 - and everything went great like four hours into my project. Then, when I went to author the ISO I had meticulously crafted, I found out the fun way that you cannot mount at all, even if it is just a filesystem via loop or FUSE devices that isn't a physical (virtualized) disk. It just won't work under WSL and it doesn't look like they ever intend for it to: https://github.com/microsoft/WSL/issues/131

I don't want to detract from the fact that I think WSL is super cool and is its own kind of miracle that Satya's Microsoft makes this a priority - 2008 me would think that hell had frozen over and Jesus returned to know what I know now, lol - but it really is not super practical for a lot of use cases beyond just running a binary or single command. It seems almost like every time that I have to put WSL to the test, it really is lacking - because I imagine it is super difficult to integrate wholly different systems calls and ways of doing things.

I found this really cool article from Microsoft engineer Jessie Fraz when I was trying to do some IaC stuff with Server 2016 and it bumped into some of the technical details with WSL which are super intriguing to me, however, I am not really savvy enough to take much advantage of this information aside from an ah, that's how it works! type satisfaction.

This article from Scott Hanselman is where the real meat and potatoes lie, however - Enhanced Mode sessions on Windows are the way to go for the most satisfactory Linux experience which exists under Hyper-V more than WSL. He explains on this post how to automate the process of creating enhanced sessions with a handy bash script located here but when I was trying to automate and script this stuff out myself with Power Shell/bash (probably won't write a post about that as that rabbit trail went wayyyy off track) I found that this one actually worked better. Ultimately, just using the Hyper-V Quick Create tool is going to get you where you want to be in the quickest manner.

I really kind of rambled a lot demonstrating what the finished product looked like, but I think it would be helpful to see just a few examples of why the Enhanced XRDP Sessions beat out WSL, but also, WSL has a lot of great applications in its own right; I try to use native applications (a good example is Terraform) wherever possible, but if you are just trying to run a Linux ELF binary without having the hassle or overhead of an entire virtualized machine - that might be the way to go. I also know that Visual Studio Code has some cool tie-ins but if I need to do Linux stuff on my Windows workstation I will certainly prefer this route above any others.