How swappable are WSL2 and Multipass?
February 9, 2020 2:54 PM   Subscribe

I've been using doing Linux development on Windows using WSL2. I have no need for Windows development or containers. Unfortunately WSL2 broke on the latest "fast ring" update. I'm confused by how WSL2/Multipass work but I liked how native and fast WSL2 seemed and integrated with VSCode for debugging. Specifics are inside but I am often on a laptop, "only" have 16GB of RAM and battery-life are big. I'd rather not spend a week figuring out Multipass and redo my dev environment, only to find out it has a weird set of limitations. or

Right now there's a weird WSL2 bug in the latest Windows update that crashes if your environment path has basically anything in it. But there are also some other weird WSL2 things that I've had to deal with. The nice thing is that it is fast, lets me debug inside containers, doesn't seem to be sluggish (I'm not stopping/starting VMs). Also the rest of the team that likes OS X doesn't seem to complain or even be aware I'm using WSL2, so that's a big thing too. Here's my setup:

1. I love Windows Terminal and usually drop down into the distro/project I'm working on. Multipass is Ubuntu only, usually I have containers that eventually compile down to a small Alpine distro but do the debugging in a multi-stage container and never really actually needed to debug in Alpine so I'm willing to let that go.
2. Using WSL2 I'm running my Docker context in Ubuntu and it just works with the Docker Desktop beta. I'm guessing I'd have to set that up myself manually with Multipass, but I'm sure there's guides out there.
3. Big drawback to WSL2 is that it currently doesn't support systemd as PID 1, which I don't really know what they're doing there, but if I run microk8s or k3s I have to do some work arounds. Not a big deal but WSL2 does seem to have some oddness to not being a quite real Linux distro that's apparently going to be solved some day.
4. Again my dev toolkit current consists of VSCode and some JetBrains products. JetBrains is way behind on WSL2 integration. VSCode "just works" but does support debugging over SSH, again I don't know if it'd "just work" with Multipass or a lot of setup.
5. Launching my apps in WSL2 with containers or Kubernetes looks and acts like localhost.
6. Multipass is cross-platform so while it hasn't been an issue yet since I use containers heavily, it looks like I can share my "host" with other people if needed.
7. I consider my Linux FS to be transient except for using powerline-go and some other things that I have a custom image for. I do everything inside Linux, meaning I don't use /mnt/c ... so my system is setup to expect Linux line endings. I think if you're in WSL with /mnt/c there's some translation magic for line endings and stuff but it also is a lot slower.

In any case, before I go down a total rabbit hole, I don't mind setting up some stuff up that's done magically by the Windows Docker Desktop GUI or WSL, but given my above setup would Multipass be a more stable option? I'm guessing in the long-term WSL2 will have matured and no longer need workarounds but I'm also guessing "long-term" could mean who knows, but I can't have it breaking. Both are betas, I know, and from my understanding Multipass is more of a true VM but takes advantage of the same hyperv stuff that WSL2 does and WSL2 isn't really a true VM. I don't care about that I don't want to go back to heavy VirtualBox style VMs that run docker containers inside that.

FYI the breaking bug for WSL2 is here, the workarounds kind of aren't the best and in general I'm just wondering if anyone has a similar setup and has given Multipass a go.
posted by geoff. to Technology (4 answers total) 1 user marked this as a favorite
 
Response by poster: I answered my own question I guess after spending a couple hours on this:

1. "Ubuntu's WSL2" alternative is wrong, I saw a lot of articles promoting it that way. It is a full fledged VM and I'm assuming it doesn't have the same fancy Windows kernel calls, memory management and things that only Microsoft can do. You also have to specify disk and memory, but to be fair I had to do some memory things with Elasticsearch to get it to work on WSL so I'm guessing if I'm outside the /mnt/c directory then the vhdx file that's created will maybe grow or not grow and need to be specified?
2. Based on my laptop burning my lap and looking at cpu/memory usage, even doing nothing the VM is definitely a lot heavier.
3. Definitely going to have to do a bit of work to make this work seamlessly with VSCode.
4. See my previous questions but Docker Desktop for Windows hides a bunch of things behind a pretty GUI, which I knew, but it keeps creeping up on me when things break.
5. Multipass looks like it is hiding a bunch of things too but not as much.
6. I'll probably be not customizing WSL2 and actually use Multipass as a "real" Linux box. WSL2 only breaks down because of how it does the init for this distro without systemd as PID 1.
7. I've learned more about how low level operating system interops work in the last 6 mos then I ever did before.

Edit: If there's anything anyone would like to add please do. Linux used to feel like a safe space where marketing didn't make things confusing. It is no longer that, or at least with Ubuntu it isn't.
posted by geoff. at 5:36 PM on February 9, 2020 [1 favorite]


Since we're here.. you're doing so much real Linux work, why not run a full real Linux box on hardware? Or if you can't get a second machine, spin up a full VM in Windows and run a persistent Linux there? I'm amazed you can make WSL2 so productive, I'm a fan of WSL myself. But I would never dream of using WSL2 as a host for so many subordinate containers and VM systems.
posted by Nelson at 8:28 AM on February 10, 2020


Response by poster: I'm amazed you can make WSL2 so productive, I'm a fan of WSL myself. But I would never dream of using WSL2 as a host for so many subordinate containers and VM systems.

Yeah it is a huge pain in the ass. For example I borked my /etc/bash.bashrc and found out the hard way anything outside of /mnt/c isn't editable. I even tried to boot a VM and attach the vhdx to a linux vm but it is a non-standard ext4 with some NTFS extensions. Since there's no "recovery" option or way to enter a session without invoking bash or skipping the profile load, e.g., "--no-profile --no-rc" would I think skip it normally ... I had to do this:

C:\WINDOWS\System32\wsl.exe -d Ubuntu-19.10 -e sh -c "cp -rf bash.bashrc /etc/bash.bashrc"

Only way I figured out that was to look at how the hell the VSCode extensions were able to execute and realized I could skip bash by running -e sh, which is what I was wanting to do but is not documented anywhere.

Anyway yeah I kinda went down the "just one hack" rabbit hole in WSL2. I think the true Linux VM/bare metal machine is the way to go at this point.
posted by geoff. at 8:35 PM on February 10, 2020 [1 favorite]


I haven't used WSL2 but my understanding is that it's a full VM with extra integration with Windows. Like, it takes the place of a headless VM in VMware or VirtualBox that starts on boot with shared folders and has a lot of secret integration with Windows that only Microsoft can do.

It sounds like you're living a nightmare. Unless you like tinkering with this or are trailblazing for your organization, I recommend either putting everything in native Windows without WSL1 or WSL2 or everything in a full graphical Linux environment. A Linux VM with 8GB should be enough for a basic setup with JetBrains, a browser etc. However, I've found that graphical Ubuntu is weirdly slow in Hyper-V, see this issue, so if you take that route then I suggest VMware or VirtualBox.

I wouldn't consider Multipass at all, it's too new, but here is a recent Hacker News discussion about it.
posted by bright flowers at 8:21 AM on February 16, 2020


« Older Yet another work backpack question   |   Expand my collection of sensory experiences Newer »
This thread is closed to new comments.