Epic Development Environment using Windows Subsystem for Linux

John Woodruff on April 13, 2018

Cross-posted from Epic Development Environment using Windows Subsystem for Linux on Medium Like many other developers, I have a handful of side pr... [Read Full]
markdown guide
 

Docker for Windows is often a very bad idea, as it requires Hyper-V and Windows can't support Hyper-V and whatever other emulation Virtualbox and VMWare use at the same time. This is an issue for a lot of devs who use e.g. Vagrant boxes to work in multiple projects, such as me. There is Docker Toolbox, but it's mostly a mess, old, and probably completely unsupported.

Annoyingly also the WSL has massive limitations, there are some hacks around some of the limitations but mostly it's useless for my needs.

Symlinks between the different filesystems have ended up creating some very peculiar situations, Windows drive always has 0777 perms so e.g. SSH keys won't be trusted, you can't actually launch VMs directly from WSL without some hack to make them actually use Vagrant/Docker/similar on Windows side, which has it's own issues again. No sound, no built-in X support, no 32-bit compatibility, ...

In short, there's a massive list of issues that can easily block someone from using these tools effectively, and annoyingly Microsoft's official answer to many of these complaints on their uservoice has been that they don't plan to fix them. They clearly plan to keep the WSL a 2nd class citizen in their world, with mostly an advertising value to be able to say "hey developers, you can totally work on Windows with your *nix tools".

 

Interesting, I haven't run into any issues with Docker for Windows yet, but I'll now keep my eye out. It might be a good reason to install docker from the Ubuntu PPA instead of aliasing Docker for Windows. Thanks for the tip!

I'm sure with some use cases WSL has some serious roadblocks. Thankfully for web and OSS development, I haven't run into any limitations as of yet with their latest release. I definitely had lots of issues in the past, as I've been messing around with it ever since they released their first technical preview of it. It just keeps getting better, though, and their latest update closed all the gaps I had personally come across.

 

Have you actually checked if you can run native Docker in WSL? I would assume you cannot, as much of the "exotic" parts of the kernel are just disabled, and you can't e.g. launch normal Virtualbox VMs from it, quite likely that containers don't work either.

Also blogs.msdn.microsoft.com/commandli... etc. seem to hint at it not being an option.

 

Totally agree with you. I face all of what you mentioned about virtual machines, Docker and filesystems. Now I use Docker Toolbox with Nanobox for my developments and to be honest It kills me everytime I work with it. The best solution for me was to get two machines. One for Windows related developments and the other for Web developments. This way I don't care about support for Windows.

 

I agree. Please don't think that WSL is an actual replacement for a full linux distro. For advanced kernel requirements, just use a VM or a dual boot.

 
 

Hello John,

Great article - loved the comic strip. I switched from Windows 7 to Ubuntu Linux several years ago and now run Win 7 in Virtual Box.

I do have a Win 10 laptop and with Virtualization support in BIOS - I use Virtualbox (and guest additions for Shared Folders/clipboard) and guest OS Ubuntu Server/Desktop (and other OS's)

Why would WSL be better on the laptop?

 

So personally, I like to avoid VMs wherever possible. I used to code in an Ubuntu VirtualBox VM, and it was just not my favorite, since I never felt truly "native". Not to mention interop with Windows programs was difficult if not impossible. That's why I love WSL so much, is because it's all "native". Obviously we're not running the entire Ubuntu (or the distro of choice) operating system and kernel, but it's the closest thing natively on Windows.

In my opinion though, you should definitely use whatever you're most comfortable with. I happen to dislike VMs enough that this WSL setup is a joy for me to use. If you like your VM setup though, then I would say that's the best option for your situation. :) I'd never presume to tell anyone that my setup is better than theirs haha.

Thanks so much for reading my article! :)

 

Thanks for your reply!

I agree - I think it is a choice/requirement between what one feels "native" is

But I will try WSL....sometime!

 

Hey, you just made me love zsh after so many years struggling to try it! Oh, and "terminal.integrated.windowsExec" preference key in VisualStudio gives me an "Unknown configuration setting", maybe you were trying to say "terminal.integrated.shell.windows"?

 

Thanks! :D Also good noticing! Looks like the key changed since I posted the original article to Medium, I'll update it to reflect that!

 

I have been using WSL for over a year now. I love it. My setup is almost same as yours.

As good as the WSL is, it is still quite buggy. I use CMD along with Ubuntu.

Do you know how WSL gets update? Is it via Microsoft Store? If so, where is the changelog?

 

The subsystem itself updates along with Windows updates. I believe bug fixes occur regularly with regular windows bug fix updates. Redstone 4, coming very soon, has a bunch of updates/new features and a number of bug fixes. Some of them are listed in this blog post.

The distros you install through the Windows Store are the user spaces for those distros, and I imagine those get occasional updates, although I've never specifically noticed/checked.

 

I think that having options is always a good idea, but I can't deal with Windows clunky UI. I'm a Mac user right now, but I think my next laptop purchase will be a blank canvas so I can just install Linux and be done with it-- I spend more time in that environment than I do anywhere else.

Until then, I've been using Parallels (or VMWare, depending on need) for the past several years. I've never had any serious issues with a VM, and I haven't experienced the "I'm not a real boy" issue you've mentioned.

I have tried Visual Studio Code on the Mac. It's not overwhelming. Not enough to make me switch from vim.

 

I'm not clear on how you installed Hyper. Is it the Linux version or the MS Windows version? In the former case, one needs to install gdebi first, correct?

And its plugins cannot be installed until npm has been installed, right?

 

So this is actually a Windows app. You can download it from here: hyper.is/

Since it's a GUI application you won't be able to install the Linux version.

 

Hi John,

Thanks for your elaboration!

I already thought you used the Window version (it wouldn't make sense starting hyper from cmd), but further down the article you mention in the Docker section that Docker is the one thing you did not install through WSL, hence I became unsure about your installation procedure for Hyper (and VSCode) since they are cross-platform.

BTW: if you install MobaXterm or XMing (both can start an X Window server in Windows) and add DISPLAY=:0 to your .bashrc, you can start GUI applications in WSL (e.g. gitk)

 

WSL is a good start, but that's about it. I wasted a few days to make a real setup for a real project and it doesn't work. it lacks some basic features like file watcher. I had many issues with it, google searched resulted in "WSL doesn't support this ...yet" or this library/framework doesn't support WSL yet. I'll give it a try again, maybe, in a few years.
Also running the IDE in windows and the file system being Linux sounds like asking for trouble.

 

I've found that the last Creators Update fixed a vast majority of the issues I had with WSL previously. With regards to your file watching support, looks like this is supported according to this blog post by Rich Turner.

As for your last comment, you're absolutely right, if you try to modify files in the linux filesystem with Windows programs, you're gonna have issues. Hence the Do not change Linux files using Windows apps and tools post by Rich, with a lot of red and bold text. ;) Personally, I have my files reside in a project folder on my C:// drive and symlink it to my home folder in WSL. That way it's easy to access, but I don't mess stuff up.

Thanks a bunch for your comments, I appreciate you reading my post! :)

 

Excellent article. Perhaps this little and very important tip about not changing Linux
Files from Windows should also go in the article?

 

About terminal theming, it's really epic. Using hyperjs + oh-my-zsh w/ Powerlevel9K + hack font complete.

Powerlevel9K + Hack Font Complete

 

Interesting. Thanks!

I use WSL too and I really like mintty terminal: github.com/mintty/wsltty (It's far more stable than hyper, but I have to admit that hyper is probably the future)

About Docker, it simply does not work inside WSL. ( :'( ) We still need to run it inside a VM.

 

Given WSL limitations and assuming that the laptop is to be used solely for software development on those personal projects, what's stopping you from going all in and running a Linux distro directly?

 

So personally the limitations with WSL are such that they haven't affected me in the stuff I use it for. I've definitely gone full Linux before, I used it as my primary driver for something like 4 years. However I only used it to the extent that I can do with WSL, and I MUCH prefer the stability and application quality of Windows 10. With WSL I get both things with no compromise! (again, in terms of my stuff I use it for) I absolutely acknowledge that there are many people for whom a full linux distro is absolutely the better option.

 

Fair enough. I must admit that I haven't used WSL for about a year (and I must admit that even then it was a begrudging compromise because Win10 was a company policy at a former employer).

I ran into multiple issues with symlinks and filesystem access from Windows to Linux and vice versa, various networking problems and also, some software simply did not run.

Containers (and on my dev boxes I run both Docker and LXC, the latter as low cost VM hosting for Ops/networking related emulated setups) simply weren't an option.

Very happy to be back on Linux. Also software stability isn't, in my experience, better on Win10, I'd actually put it the other way around. Admittedly that greatly depends on what software we are talking about.

But then, I have not been that happy with Mac either, especially Python situation on it though my experience with homebrew was overall better than with WSL. Still, nothing beats the real thing.

I do understand people have issues with incompatible hardware but I select my hardware with Linux compatibility in mind (which is kinda what Apple does).

All valid concerns! I'm a Mac user at work and I personally love the stability, along with the unix shell. I don't do much Python on my Mac so I can't speak much to that.

In terms of symlinks back and forth between the WSL and Windows filesystems, they absolutely were not well supported 1+ years ago. The anniversary update fixed all those issues, and I personally am using symlinks with no issue.

I should say that I do really enjoy using a full Linux distro. I just hate switching back and forth between my Windows and Linux partitions, so the marriage between the two works great for my needs. :)

 

I loved the zsh and hyper tips. They will definitely be part of my setup from now on. Thank you very much

 

I'm so glad it was helpful! Thanks for reading!

 
 

For MacOS switchers, there is a homebrew for wsl/linux called surprisingly linuxbrew

 

Cool! Never seen this project before! I'll have to check it out and see how well it works!

 

Thanks for writing this up John. I've had the subsystem installed for over a year, but had no idea how to get it integrated with my tools. Super helpful!

 

Thanks so much, I'm glad it was helpful to you! :D

 

what is the advantage of this feature over cygwin/babun?

 

Cygwin runs modified linux binaries, whereas WSL simply provides a layer in between a full Ubuntu user space and the Windows Kernel, so that WSL can run any unmodified linux binary. Simply install it from apt-get and you're good to go. Cygwin also provides only a specific set of packages, whereas with WSL you can install anything available from a PPA.

 

I prefer just to install ubuntu and erase windows 😊

 

Always an option for those who prefer that! :)

 

Hmm.. Interesting article. But NVM does support/is supported on windows... Nevertheless, will give it a try someday.

 

Thanks! In terms of nvm, the actual nvm library doesn't support Windows, as is called out in their README under Important Notes. However there are two alternatives they mention, which are separate projects maintained by other people. So while there are alternatives, I wanted the actual nvm library, not a port or a clone. Hence using it in WSL.

 

With all the anti virus and IDS apps monitoring files on windows running on my laptop, the performance of files operations are 60 times slower than a linux VM running on the same laptop.

code of conduct - report abuse