
File System Improvements to the Windows Subsystem for Linux - jackhammons
https://blogs.msdn.microsoft.com/wsl/2017/04/18/file-system-improvements-to-the-windows-subsystem-for-linux/
======
corysama
I haven't dug deep into it yet. But, I'll say that I've been having fun
compiling (command line) Linux apps with Clang and visually debugging them
with GDB all through the UI of VStudio Community Ed and without a VM. /shill
mode

Linux is not a target for the code I'm working on. But, I like to keep my code
as cross-platform as possible. Between this setup and prototyping code on
several compilers via goldbolt.org, staying standard-compliant and compiler-
agnostic is much easier than ever before.

~~~
jhgorrell
[https://godbolt.org/](https://godbolt.org/) ? Goldbolt.org seems to be fax
sw.

~~~
corysama
Yep. Typo.

------
NelsonMinar
Network filesystems! That's the last big feature I've been needing for regular
use of WSL for light tasks. There's still enough weird behavior I wouldn't
look at WSL as a complete Linux replacement, but it sure is a lot nicer than
Cygwin/msys2.

They don't say anything about FUSE, I wonder if this work is at all related?

~~~
eVeechu7
I am pretty sure this update does not add FUSE support. FUSE would add the
ability to use SSHFS, which is the network file system support I'm interested
in.

If FUSE would be useful to you, please vote for it at
[https://wpdev.uservoice.com/forums/266908-command-prompt-
con...](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-
on-ubuntu-on-windo/suggestions/13522845-add-fuse-filesystem-in-userspace-
support-in-wsl)

~~~
laumars
There is a Windows-native SSHFS client[1]. I have it installed on a Win10 VM
so can confirm it "works" albeit I haven't needed to use it for anything so
cannot confirm how well it works.

[1] [https://github.com/Foreveryone-cz/win-
sshfs](https://github.com/Foreveryone-cz/win-sshfs) I think is the currently
maintained version but you're welcome to confirm that independently.

~~~
noen
I helped resurrect this to support Windows 10 a year or so ago. It works, but
because of its reliance on Dokany (a FUSE-like usermode file system library),
there are a lot of ways it still doesn't work perfectly.

It was a lifesaver for me when I was doing development on embedded Linux
devices (Pi/Edison et al). But if you're not tied to remote hardware, WSL is
an infinitely better, faster, much more reliable dev process.

The biggest issue I ran into with win-sshfs was its tendency to bodge git repo
status if you maintained the repo on the mapped folder.

~~~
Rondom
What do you mean by "bodge git repo status"? One thing I noticed is that, git
gets confused if you clone under Linux and then try to access it via win-sshfs
from Windows. The other way it works fine, i.e. clone from Windows, then other
actions work fine on both sides.

------
simonh
WSL is really interesting. I switched to the Mac in 2006 but I’ve never really
used the fact it’s built on Unix much because it’s so different and frankly
outdated comparede to the Linux systems I work on. When I want to do ‘Unixy’
stuff at home I run a Linux VM in VirtualBox. But WSL seems to offer the best
of both worlds – a solid mature desktop environment with plenty of well
supported professional level apps and an approaching first class Linux
environment baked right in. I’m still very happy on the Mac and would miss a
lot of Mac specific features and applications, but this is the first thing to
happen in Windows Land that’s made me even think of the possibility of wanting
to run Windows at home for over 10 years.

Edit: What would be the nearest thing to WSL on a Mac? VirtualBox is a bit
heavy-weight. Maybe something based on Hyperkit and Docker?

[https://github.com/moby/hyperkit](https://github.com/moby/hyperkit)

[https://docs.docker.com/docker-for-mac/](https://docs.docker.com/docker-for-
mac/)

~~~
ghshephard
Likewise - except for me it's been 15 years. Switched over in 2001, and didn't
look back. Running WSL creators edition is really a delight. It's not _quite_
there yet - still has a year or two to bake - but the progress is great. They
just added serial support yesterday (which is important for a bunch of the
linux binaries I run). For the very first time I'm honestly considering
sitting down to a Windows System to do work - I never thought I would have
said that - I've got * nix in my finger DNA, so powershell, despite being
incredibly powerful, just never managed to get into my workflow.

But now - It's best of both worlds - solid User Environment + Solid Unix CLI.
Even better, it's a _linux_ CLI, which means I get all the apt-get goodness
that I've been missing on OS X (which admittedly has a pretty good brew
install infrastructure).

~~~
chx
For me at least the big problem is malware. Running Arch Linux means I do not
need to worry about malware. Ransomware. Crap like that. Yes, I am a
reasonably experienced computer user and it's quite unlikely I would click
anything "wrong" but not having to worry about a single bad click causing
hours of recovery is a big plus.

Edit: while I understand downvotes I would be much happier if you'd educate me
where I am wrong.

~~~
danieldk
_Running Arch Linux means I do not need to worry about malware. Ransomware.
Crap like that._

I didn't downvote you and understand your concern. However, keep in mind that
X11 has no GUI isolation. So, an attacker could snoop all your keyboard and
mouse events, make screengrabs, etc. through a compromised web browser.

Wayland provides GUI isolation, but is not widely deployed yet. Most X11 users
are only safe because the X11 desktop is not a large target group, but it is
probably less secure than Windows, which does GUI isolation between processes
of different privilege levels, sandboxing for Store apps, etc.

~~~
beagle3
That's true, but it only matters once the attacker manages to run code - which
is significantly harder to achieve on Linux, due to diversity (opposite of win
monoculture) and mostly sane defaults (no local directory in executable or dll
search directory; file name not enough for execute permission).

Buffer overflows and targeted attacks are comparable in ease, but if you are
not targeted, you are way safer on Linux.

------
ungzd
Does it suffer from similar quirks as Cygwin (.exe suffix removal, symlinks,
permissions mapping)?

\- [https://cygwin.com/cygwin-ug-net/using-
specialnames.html](https://cygwin.com/cygwin-ug-net/using-specialnames.html)

\- [https://cygwin.com/cygwin-ug-net/using.html#pathnames-
symlin...](https://cygwin.com/cygwin-ug-net/using.html#pathnames-symlinks)

~~~
sengork
Cygwin (64bit) didn't work for me in the latest creators update (actually I
think it broke even before that). Now I am trying things using WSL itself, so
far it has been a productive move.

File permissions and security descriptors proved to be quite a hassle when
removing Cygwin requiring multiple takeown and cacls hacks to remove some of
the files.

On the flip side I saved some disk space too.

~~~
barrkel
OTOH when I wanted to have pretty pictures on my lock screen but without the
Microsoft ads, I needed to rely on Cygwin to blow away the folder that caches
the pictures deep in ProgramData/.../SystemData/*/ReadOnly - the lock screen
image setting API has a lot of bugs. Without Cygwin, I was fiddling with cacls
and takeown in an elevated prompt trying to blow away the folder. An elevated
Cygwin prompt and it was just rm -rf.

(Bugs:
[https://www.google.co.uk/search?q=lock+screen+windows+10+ima...](https://www.google.co.uk/search?q=lock+screen+windows+10+images+broken))

~~~
mkup
Sometimes elevated command prompt is not powerful enough and you need command
prompt running from "SYSTEM" user account (Windows NT equivalent of Unix
"root"). You can get that one with psexec tool from Microsoft SysInternals:
psexec.exe -i -s -d %WINDIR%\System32\cmd.exe

~~~
barrkel
There's no real equivalent of root on Windows. Accounts can have capabilities
(pronounced 'privilege' [1]), and securable objects have ACLs and ownerships.
Owners can replace ACLs, and a capability can give the ability to unilaterally
change ownership[2]. And some of the more recent changes (to increase security
for naive users) have been to disempower users and relinquish capabilities.

Accounts like SYSTEM may be functionally similar to root in so far as they may
have the grant option on capabilities and thus have the keys to unlock powers,
but good privilege separation design suggests that capabilities shouldn't be
idly taken up.

Functionally, an elevated prompt had enough power to blow away the directory I
wanted to delete - that is, the account had the capability to take ownership,
replace ACLs, and then delete the objects - but following all the steps is
fiddly. Cygwin abstracts all that away to the simplified POSIX system.

Something like SYSTEM may have been enough for different reasons; the existing
ACLs may have permitted deletion to SYSTEM. But that doesn't mean SYSTEM had
more intrinsic abilities (though I believe it does have more capabilities
[2]).

[1] [https://msdn.microsoft.com/en-
us/library/windows/desktop/bb5...](https://msdn.microsoft.com/en-
us/library/windows/desktop/bb530716\(v=vs.85\).aspx)

[2] SE_TAKE_OWNERSHIP_NAME in [1]

[3] Things like SE_TCB_NAME in [1], I think.

------
revelation
I wonder if they have plans to add other emulation features, most importantly
the ability to passthrough USB devices (or even graphic cards?).

I don't need or want the Linux graphical interface of my VM, it's pretty much
redundant, but I do need to make devices available to the Linux software.
Otherwise it's a bit like emulating a microcontroller - sure, Turing says the
thing can compute everything, but in a very practical sense it can do
absolutely nothing without it's outside inputs and periphery. I need the damn
side-effects!

~~~
ajross
Seems like you might be better served with a linux desktop and windows in a VM
then.

The use case for WSL right now is someone like a web developer. They can
develop and debug node apps locally in their native environment.

~~~
revelation
That only works because they provide emulation for AF_INET, AF_UNIX and
AF_NETLINK sockets. It's not an automatic freebie.

~~~
ajross
I understand. Nonetheless they did to the work to enable straightforward
client networking (which works because Windows' own networking layer is
basically Berkeley sockets under the hood).

Writing an emulation of the Linux USB sysfs and device node API on top of
Windows' very different USB driver layer is a rather bigger task. I'm sure
they'll get to it eventually, but it's not something you can demand as an
"obvious" feature.

------
skrebbel
I wish there was a way to get lxss updates without being a Windows Insider.

I turned on Insider on my brand new laptop last summer and it immediately
overwrote some vendor-supplied drivers by newer-but-broken ones. Result: no
sound. I didn't manage to fix it except through a full reinstall. Now that's
exactly the sort of problem you need to prepared for when doing the Insider
thing, but it sortof ruins the point. I want to beta test lxss, not Paint 3D
or some fancy new device driver release schedule.

~~~
ghshephard
I'm pretty certain I had WSL running on my system without being a member of
Windows Insider. You just need to turn that on if you want to be on the Fast
Track...

~~~
JorgeGT
Parent said WSL updates. You can get WSL but in order to get updates like this
one you need Insider builds.

~~~
ghshephard
I thought this WSL update came with creators edition? Unless you mean the fast
track WSL Updates, but not the other windows updates - which yes, I agree,
would be nice.

~~~
JorgeGT
No, this update comes with Build 16176. Creators Update is Build 15046:
[https://msdn.microsoft.com/en-
us/commandline/wsl/release_not...](https://msdn.microsoft.com/en-
us/commandline/wsl/release_notes#build-16176)

So in order to get it you would need to join the Fast Insider ring...

------
nialv7
Windows subsystem for Linux? Or the Linux subsystem for Windows?

These names are confusing...

~~~
masklinn
It's a Windows subsystem[0] for [running] Linux [applications].

The terminology is "Windows subsystem for [target environment]" so "Windows
subsystem for OS/2" lets you run OS/2 application on NT, "Windows subsystem
for Win32" lets you run Win32 applications on NT, and "Windows subsystem for
Linux" lets you run Linux applications on NT.

[0] "The interface between user mode applications and operating system kernel
functions […] There are four main environment subsystems: the Win32 subsystem,
an OS/2 subsystem, the Windows Subsystem for Linux and a POSIX subsystem."

~~~
joombaga
Yet they chose different terminology for WoW64 (Windows 32-bit on Windows
64-bit), and chose to store 32-bit binaries in the WoW64 directory.

~~~
masklinn
I don't know that Win64/WoW64 is a separate subsystem. I think it's a subset
of the 64b version of the Win32 subsystem.

------
Filligree
What would be a good X11 server to use? Are there any that support the full
stack? (shm, glx, etc.)

~~~
josteink
> What would be a good X11 server to use? Are there any that support the full
> stack? (shm, glx, etc.)

I recall using exodus in the past (at uni), but it's commercial (pricey). Not
to mention these days it seems to be Mac only.

From similar threads I've seen recently, and quick searching, it seems Xming
is the preferred Windows-option these days:

[https://sourceforge.net/projects/xming/](https://sourceforge.net/projects/xming/)

~~~
saboot
The free version of Xming does not implement several things properly. Not sure
which but some applications haven't run properly. There is a charityware
version but I can't find my license for it.

MobaXterm is another free version, It's a term emulator with an X11 server,
but you can just turn it on and ignore the term. It runs all the applications
Ive found that the free Xming cant.

------
rebootthesystem
Is it at the point where one can, for example, use PyCharm to develop
Python/Django sites residing in the Windowns file system (say,
z:/sites/project_099) while hosting from WSL?

Or would it be treated more like a VM that you simply deploy to?

We currently run one or more Ubuntu server VM's per machine as needed for
local testing. If needs go beyond that, we have physical (virtualized) servers
on our network (for example, web and database servers).

I can see WSL possibly being good for local development if it can somehow
integrate seamlessly with the Windows file system and various tools (PyCharm)
can be setup to run on Windows yet talk to WSL. I guess this might be
equivalent to running a remote interpreter.

Need to think about this a bit. Running a server or two on VMs is pretty clean
and painless. On machines with 64 GB of memory you don't even know they are
running (from a performance/resource perspective).

~~~
WorldMaker
You can cd to /mnt/z/sites/project_099 and work there directly in WSL. Open
the same files in a Windows-based text editor. Even use Visual Studio to drive
gdb debugging of the Linux process in WSL.

I've not done that last bit, but I definitely have moved all my ruby/Jekyll
work into WSL and use VSCode to edit.

------
mjevans
I was going to make another comment, but just found out while searching that
WSL is //supposed// to be based on Ubuntu (20)16.04 now (instead of 14.04) I
guess the next time I work with those systems I'll have to run down some
upgrade / re-install directions.

I wonder if that will fix the issue where I was unable to mv folders around
the c:\ drive within the /mnt/c FS. (It more or less locked up to the point
that I had to restart to clear the issue.)

~~~
JoBrad
FWIW, I haven't had any issues moving files before or after upgrading from
14.04 -> 16.04. I use Git in WSL, but interact with the files in both Windows
and WSL without any special considerations.

~~~
mjevans
With the updated WSL version out I probably won't ever run across the issue
again. I can't remember the exact circumstances, I may have had the folder
open in a window or something (thinking of it, Windows doesn't let you rename
files out from under processes, which may have been the reason).

However I do recall that trying to ctrl+c kill it didn't work. I don't recall
what else I had/hadn't tried; I was rather busy at the time and couldn't stop
to make a proper bug report.

All that mattered to me was that it completely stalled for no transparent
reason and my best option was to just not even try to do real file management
from the WSL environment.

------
neves
Last time I tried to use the Windows Subsystem for Linux it was a mess. I
thought I could access my files from windows and messed all the filesystem.

Now it looks like I can freely exchange my files between the WSL and Windows.
Is it true?

Do I finally have a linux inside a windows machine where I can install things
using apt-get (instead of cygwin setup.exe)?

When will it goes into the official Windows 10 version?

~~~
Stubb
Your Windows drives appear under /mnt/c, /mnt/d, etc. in WSL. So your Windows
home directory is /mnt/c/Users/ffoobar.

You can easily read/write Windows files from Linux, but I don't think you can
do the opposite. I've used git within WSL to drive a repo on my Windows drive.

WSL gives you full-blown Ubuntu 16.04 where you manage packages with apt-get.
You have to look close to the bare metal to see differences. Until the
creator's update, for example, ifconfig didn't work.

Earlier today, I compiled and ran some OpenMP-based code in WSL and it happily
detected all the cores on my dev machine and kept them busy with worker
threads. Pretty cool!

~~~
neves
I thought it would give me total interoperability. That I could edit an movie
in a windows app, run it through ffmepg, and go back to editing.

Cygwin is still useful.

~~~
wvenable
It does but you have to do that from the Windows file system not the Linux
one. So from Linux you are accessing /mnt/c/Users/you/somedocument and from
Windows it's C:\Users\you\somedocument.

~~~
neves
But isn't this a new thing? I believe you couldn't do it in the initial
versions.

~~~
wvenable
No, it's always been that way from the initial release. It's literally the
only file system interopt that exists.

You're not supposed to access the Linux filesystem from Windows -- it's in a
system hidden area of your profile but some people still tried to mess with it
with unfortunate consequences.

------
p2t2p
Java still doesn't work properly though =(. "mvn clean package" on one of
corporate projects takes about 5 to 8 minutes in native java on Windows or Mac
and it takes more than one hour in WSL. I had so much hope for WSL that I
would finally have only ONE device (surface), but no, we're not there yet.

~~~
kristianp
Sorry, I have to ask. Why do you need to use Java with WSL? Native methods?

~~~
hiram112
I would love this because I still want a 'real' shell when dealing with Java -
things like emacs, grep, find, etc.

Cygwin and using shared VM directories has too many glitches with things like
npm, links, file system endings, etc. As Docker becomes more important, this
gets even worse.

Really, developing on a Mac is just so much better than both Windows and
Linux, even for Java.

------
emptyfile
With the Creators update, can you now actually run a postgres service or
apache in the linux subsystem?

~~~
ghshephard
See: [https://blogs.msdn.microsoft.com/wsl/2017/04/11/testing-
the-...](https://blogs.msdn.microsoft.com/wsl/2017/04/11/testing-the-windows-
subsystem-for-linux/)

In particular, they run Nginx 1.4.6 with 100% test coverage and
postgresql-9.5.3 with 100% test coverage.

Oddly (very), they have a few projects, Cassandra, Coffescript that show
_better_ test pass rates with WSL than Native Ubuntu.

------
tkubacki
In a way Balmer was right -"Cancer" is eating Windows :)

~~~
tempay
I assume this is a reference to something?

~~~
eugeneionesco
[https://www.theregister.co.uk/2001/06/02/ballmer_linux_is_a_...](https://www.theregister.co.uk/2001/06/02/ballmer_linux_is_a_cancer/)

Unbelievable how much M$ changed for better in the last years!

~~~
oblio
16 years is quite a few "last years" :)

------
egl2018
Does WSL work on Windows Home, or does it require Pro? Is this an accident or
by design?

~~~
hungys
The screenshots in official installation guide are Windows 10 Home edition.

[https://msdn.microsoft.com/zh-
tw/commandline/wsl/install_gui...](https://msdn.microsoft.com/zh-
tw/commandline/wsl/install_guide)

