ned Productions Consulting

Technology musings by Niall Douglas
ned Productions Consulting
(an expert advice and services company based in Ireland)

Thursday 30th June 2016 11.09pm

I am currently typing to you from a brand new install of Windows 10 bleeding edge Insider edition, installed solely in order to gain access to the new Linux Subsystem for Windows which comes with the very newest Windows 10s (my laptop's Windows 10 had been refusing to upgrade for some months now, so a reinstall was unavoidable). This new subsystem lets you run existing Linux binaries on Windows as if they were native applications, something which FreeBSD of course has been doing for years, but well it's enormously more useful on Windows than on BSD.

For me, this subsystem is by far and away the killer app for Windows 10. If, like me, you write a lot of portable software and you would like to dispense with configuring full heavy VMs containing Linux with shared Samba drives for the source code, and would instead just like to do all your development and initial testing from within Windows, this new feature is a godsend, especially as Visual Studio 2015 can now speak remote GDB over a SSH connection (i.e. yes, you can write, compile and debug everything for your Linux port of your code all in one place now!)

Now, of course this is a very early implementation of the Linux subsystem for Windows, so it's not all roses yet. We'll start with the very good things:

* A full Ubuntu 14.04 LTS x64 userland is present, and runs out of a standard Windows command box which now support ANSI control codes, so yay colour!

* The binaries you run are identical to the Linux ones, totally unmodified.

* Despite the Linux userland, you are still running on the NT kernel via its long forgotten POSIX subsystem which originally came with NT 4.0 and was killed off publicly after Windows 2000. That means you're on the Windows filesystem directly, and yes all your normal Windows files are just there and it all just works (NTFS was originally designed with full POSIX compatibility as a full Unix filing system, so permissions, case sensitivity, all just works). Your root filesystem looks like Linux of course for compatibility, but all your DOS drives are sitting already in /mnt.

* Via the usual apt-get, you can install Ubuntu apt PPAs, GCC 6 and all your usual build tools like GDB. You can even fire up X11 apps so long as you run a X11 server on your Windows system (e.g. Xming).

Sounds superb right? Unfortunately, there are still some unfinished parts:

* /dev/pts is broken :( :( :(. This ruins system logging and more importantly, SSH logins which preclude using VS2015's remote GDB functionality until they fix it.

* cmake's environment probing fails for some reason, and cmake fails quite horribly. I sorely need cmake to work, so I'm probably going to send a pull request fixing this to Kitware.

* The network interface is the Windows kernel one which confuses a lot of the userland tools e.g. netstat, ifconfig. Networking works, but opaquely.

* Whoever configured the default container has bugged it in a fair few places, particularly in the upstart workarounds and there is a weird default package selection installed (I'd prefer standard LXC Ubuntu minimal template).

* /proc and /dev are noticeably thin on entries, and programs which assume they have what they ought to will fail.

* The Linux directory hierarchy is installed under your user account in AppData/Local/lxss which is wasteful of precious C: drive space. If you could put it on some other drive it would be very helpful. My attempt to manually move it and place a junction point there fails because Win32 doesn't understand file hierarchies stored under the POSIX subsystem. Yay.

So, all in all looking very promising for cross platform development exclusively on Windows, especially if they fix the /dev/pts problem.