Most active commenters
  • stormbrew(4)
  • vram22(3)
  • bitcrazed(3)

←back to thread

535 points raddad | 49 comments | | HN request time: 0.001s | source | bottom
Show context
hobs ◴[] No.11390553[source]
Some additional details from Scott Hanselman:

http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUs...

"This is a real native Bash Linux binary running on Windows itself. It's fast and lightweight and it's the real binaries. This is an genuine Ubuntu image on top of Windows with all the Linux tools I use like awk, sed, grep, vi, etc. It's fast and it's lightweight. The binaries are downloaded by you - using apt-get - just as on Linux, because it is Linux. You can apt-get and download other tools like Ruby, Redis, emacs, and on and on. This is brilliant for developers that use a diverse set of tools like me."

"This runs on 64-bit Windows and doesn't use virtual machines. Where does bash on Windows fit in to your life as a developer?

If you want to run Bash on Windows, you've historically had a few choices.

Cygwin - GNU command line utilities compiled for Win32 with great native Windows integration. But it's not Linux. HyperV and Ubuntu - Run an entire Linux VM (dedicating x gigs of RAM, and x gigs of disk) and then remote into it (RDP, VNC, ssh) Docker is also an option to run a Linux container, under a HyperV VM Running bash on Windows hits in the sweet spot. It behaves like Linux because it executes real Linux binaries. Just hit the Windows Key and type bash. "

replies(11): >>11390574 #>>11390626 #>>11390693 #>>11390705 #>>11390731 #>>11390748 #>>11390890 #>>11391364 #>>11392443 #>>11393237 #>>11402098 #
1. drinchev ◴[] No.11390574[source]
> This is a real native Bash Linux binary running on Windows itself.

How does it work without VM? I'm super curious!

replies(5): >>11390600 #>>11390601 #>>11390609 #>>11390641 #>>11390652 #
2. nickysielicki ◴[] No.11390600[source]
The same way Wine works for Windows binaries. Translate system calls.
replies(1): >>11390787 #
3. pionar ◴[] No.11390601[source]
They added a subsystem in Windows that responds to Linux APIs.
replies(6): >>11390766 #>>11390868 #>>11390922 #>>11390934 #>>11391230 #>>11391370 #
4. 0x0 ◴[] No.11390609[source]
I wonder too. I think that even the win32-native msys2 ships with a bash that uses cygwin's dll. Apparently some POSIX/Linux system calls are extremely hard to emulate under win32, such as fork: https://cygwin.com/cygwin-ug-net/highlights.html (search for "Process creation"), which I'd imagine would be critical in a shell for handling redirections, pipes, and job control.
5. johnhattan ◴[] No.11390641[source]
Apparently they re-implemented the Linux API's along with the ability to run Linux executables directly.
6. teamhappy ◴[] No.11390652[source]
Have a look at FreeBSD's linuxulator. It basically maps syscalls (and a bunch of other stuff) from one OS to another. Alexander Leidinger has written a whole lot of blog posts about it - this one's a good start: http://www.leidinger.net/blog/2010/10/27/the-freebsd-linuxul...
replies(1): >>11390723 #
7. stormbrew ◴[] No.11390723[source]
Is there a source for this being a syscall emulation layer and not some kind of colocation of the linux kernel in a subsystem somehow?

The latter would be much more interesting to me, since what I really want out of "running linux on my desktop" is for it to actually act like the linux machines my code is targeting, and I'm dubious that a syscall layer will achieve that to the degree I want.

replies(5): >>11390830 #>>11391008 #>>11391062 #>>11391170 #>>11391173 #
8. tkubacki ◴[] No.11390766[source]
Lol "linux is a cancer" has new meaning now :)
replies(1): >>11391277 #
9. vetinari ◴[] No.11390787[source]
Wine has it easier - it does not translate system calls, it needs "only" dll loader and a set of dlls exporting the right symbols.

NT system calls are not exposed to userspace; only system-supplied dlls can use them. It is done by changing syscall codes for every build, so non-system app would never know, which syscall number to use.

replies(1): >>11390839 #
10. kybernetikos ◴[] No.11390830{3}[source]
A good few years ago now I used to use a project called cooperative Linux that was like what you describe - a user mode Linux kernel running as a service in windows.
replies(2): >>11391024 #>>11391092 #
11. nickysielicki ◴[] No.11390839{3}[source]
Huh, TIL.

That explains why Wine always seemed so buggy, though.

12. fla ◴[] No.11390868[source]
Think of it as Wine, reversed.
replies(3): >>11390954 #>>11391586 #>>11392823 #
13. PeCaN ◴[] No.11390922[source]
They've had a POSIX subsystem (SUA) for a while, but it's kind of ancient. I assume they resurrected it and implemented some Linux-specific APIs, which would actually be SO COOL.
replies(2): >>11391841 #>>11392031 #
14. drinchev ◴[] No.11390934[source]
Curious to see what's the support of the Windows API then.

Follow up questions would be if it will support kernel-dependent utils like tcpdump, ifconfig, etc.

15. darkr ◴[] No.11390954{3}[source]
Eniw?
replies(1): >>11391093 #
16. joshumax ◴[] No.11391008{3}[source]
There was also another project I worked with a while back called LBW (http://cowlark.com/lbw/) which allowed some unmodified Linux binaries to run on windows using Internix and some really neat syscall handler trickery.
replies(1): >>11392534 #
17. stormbrew ◴[] No.11391024{4}[source]
Yeah there were actually a couple of projects along this line at various points, but they always suffered in various ways from not being well integrated into the system. What you really want is for the colocated kernel to have first class access to some basic things about the primary kernel (like file systems -- including page caching and networking) so they're not going through an expensive and awkward translation layer.

Cygwin and things like colinux exist on opposite ends of that awkward divide, but something officially supported by the OS could maybe straddle it better.

18. xenadu02 ◴[] No.11391062{3}[source]
One of my coworkers is from MS and worked on the Android apps on Windows project. This comes out of that cancelled work: It's a full implementation of Linux syscalls in user mode that registers a driver to perform kernel-mode tasks on behalf of the subsystem. The NT kernel has always been fairly agnostic and not tied specifically to Win32; it originally had an OS/2 text-mode and POSIX subsystem in addition to Win32. The NT kernel even uses a Unix-like "\\?\" root filesystem where disks, kernel objects, sockets, etc are mounted.

From what I can gather Microsoft is paying Canonical to help with a few user-mode bits and the Windows apt-get stuff uses the official Canonical sources.

As I said to him: "NT is the only major OS I know of that has always had personality subsystems. Cutler’s vision finally pays off after 3 decades of waiting"

replies(6): >>11391247 #>>11391274 #>>11391860 #>>11392212 #>>11392526 #>>11416392 #
19. kuma4 ◴[] No.11391092{4}[source]
I feel it is related to Windows Server container. Maybe Ubuntu works like a Docker container on Windows.
20. unclenoriega ◴[] No.11391093{4}[source]
Emulator Not In Windows

Sorry it's not recursive.

replies(2): >>11391302 #>>11391648 #
21. teamhappy ◴[] No.11391170{3}[source]
From linux(4):

     The linux module provides limited Linux ABI (application binary inter-
     face) compatibility for userland applications.  The module	provides the
     following significant facilities:

     +o	 An image activator for	correctly branded elf(5) executable images

     +o	 Special signal	handling for activated images

     +o	 Linux to native system	call translation

     It	is important to	note that the Linux ABI	support	it not provided
     through an	emulator.  Rather, a true (albeit limited) ABI implementation
     is	provided.
https://www.freebsd.org/cgi/man.cgi?query=linux&apropos=0&se...

"Mapping syscalls from one OS to another" was really just an example to give the OP an idea of how this sort of thing works without a VM.

Edit: Nevermind then

replies(1): >>11391542 #
22. ashitlerferad ◴[] No.11391173{3}[source]
http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.htm...
replies(1): >>11391582 #
23. keithpeter ◴[] No.11391230[source]
So LINE on Windows like WINE on Linux?

Seriously:shows an appreciation of where a lot of the workload for computer programmers is these days.

replies(1): >>11391898 #
24. nbevans ◴[] No.11391247{4}[source]
I love your last paragraph. Exactly what I was thinking. NT Subsystems were its party trick and its taken far too long for them to be introduced on the grand stage. I bet Dave Cutler is smiling his face off!
25. keithpeter ◴[] No.11391274{4}[source]
Thankyou for this concise summary. Much clearer now.
26. stcredzero ◴[] No.11391277{3}[source]
Is it a cancer if it doesn't kill you, but actually helps you be stronger? Maybe Linux is more like gut bacteria now. Linux is E.Coli?
replies(1): >>11398274 #
27. stcredzero ◴[] No.11391302{5}[source]
Enterprise Networked Internet Workstation?
28. jdcarter ◴[] No.11391370[source]
In other words, they're not using "Linux" at all. It's an Ubuntu userland on top of the Windows kernel, similar to how Nexenta was an Ubuntu userland on top of the OpenSolaris kernel.
replies(1): >>11391814 #
29. stormbrew ◴[] No.11391542{4}[source]
I wasn't asking about freebsd (I've used that, even!), I was asking about this new thing on Windows and whether there's been official word that it is indeed the same sort of thing. Looks like it is indeed this sort of thing, though.
30. stormbrew ◴[] No.11391582{4}[source]
Thanks, this is what I was actually looking for. :)
31. vram22 ◴[] No.11391586{3}[source]
Vinegar?
32. ant6n ◴[] No.11391648{5}[source]
ENIW is 'Nix In Windows
33. bitcrazed ◴[] No.11391814{3}[source]
You pretty much nailed it :)
34. bitcrazed ◴[] No.11391841{3}[source]
No - this is a whole new thing.

The Windows POSIX subsystem which shipped in NT 3.5.1 was a minimal implementation of POSIX syscall API plus a userland toolset. That was replaced with Interix which was renamed Services for Unix (SFU) which had a more comprehensive kernel implementation and more up to date userland. However that tech was not resurrected to build the Windows Subsystem for Linux (WSL).

Importantly, WSL doesn't ship with a distro - we download a genuine Ubuntu userland image at install-time and then run binaries within it.

replies(2): >>11392548 #>>11416488 #
35. bitcrazed ◴[] No.11391860{4}[source]
Close, except ...

There is NO Windows "apt-get stuff" - it's just apt-get. From Ubuntu.

36. igravious ◴[] No.11391898{3}[source]
Came here to say that. It'd be nice if they open-sourced it so it wasn't yanked away from under our feet one day :) But maybe they are? I shouldn't presume they are not.
37. brobinson ◴[] No.11392031{3}[source]
Does Windows 10 still ship with the OS/2 subsystem? (os2ss.exe)
replies(1): >>11392238 #
38. beagle3 ◴[] No.11392212{4}[source]
> "NT is the only major OS I know of that has always had personality subsystems."

In what way is a "subsystem" different than a "library" or a "process" or a "driver" (if it runs in kernel space)?

Any process can use the native API. What's special about a "subsystem"?

39. gpvos ◴[] No.11392238{4}[source]
It was dropped with Windows XP. https://en.wikipedia.org/wiki/Architecture_of_Windows_NT#Use...
replies(1): >>11399167 #
40. vram22 ◴[] No.11392526{4}[source]
What was his vision?

I know that Dave Cutler was heavily involved in designing NT, and was earlier the same with DEC VMS. (Had read the book Inside Windows NT.)

But don't know what vision you refer to. Was it about the personality subsystems?

replies(1): >>11447245 #
41. tavert ◴[] No.11392534{4}[source]
Also the more recent https://github.com/wishstudio/flinux
42. tavert ◴[] No.11392548{4}[source]
> Importantly, WSL doesn't ship with a distro - we download a genuine Ubuntu userland image at install-time and then run binaries within it.

So can we use WSL by itself and pick a different distro, if we'd rather use say Alpine or openSUSE or Arch's userland?

43. vram22 ◴[] No.11392823{3}[source]
Everywhere Now Is Windows
44. tripzilch ◴[] No.11398274{4}[source]
e.coli isn't a gut bacterium, ... is it?
45. brobinson ◴[] No.11399167{5}[source]
Thanks!
46. JdeBP ◴[] No.11416392{4}[source]
> "Cutler’s vision finally pays off after 3 decades of waiting."

Quite!

But only because the Interix-derived POSIX subsytem was, and is, little-known and vastly underappreciated. Had it been better known, the payoff might have come a decade or more sooner. There are a fair number of questions being asked now, about the new Linux subsystem, where the answer is "No; but the old POSIX subsystem had that.".

* Does it support pseudo-terminals? No, according to the demonstration video; but the old POSIX subsystem did. (https://news.ycombinator.com/item?id=11415843)

* Does it let you kill Win32 processes? No; but the old POSIX subsystem did. (https://news.ycombinator.com/item?id=11415872)

* Does it support managing daemons? No; but the old POSIX subsystem did. (https://news.ycombinator.com/item?id=11416376)

* Does it support GUI programs? No (say the people behind it themselves, although I suspect that it could run X clients); but the old POSIX subsystem did. (https://news.ycombinator.com/item?id=11391961) (https://technet.microsoft.com/en-gb/library/bb463223.aspx)

replies(1): >>11453556 #
47. JdeBP ◴[] No.11416488{4}[source]
> However that tech was not resurrected ...

I, for one, would like to see it resurrected. It's exceedingly useful, and is one major reason that I am not, nor will be, using Windows 10. This new subsystem does not have the things that I use SFU/SFUA for. Nor does it have the BSD-style toolset of SFU/SFUA.

48. ch_123 ◴[] No.11447245{5}[source]
Before leaving for MS, Cutler worked on an OS codenamed "Mica" which ran on top of an architecture named PRISM (which was a predecessor to the Alpha). The idea behind Mica was that it was a microkernel which hosted VMS and Unix personalities on top.

It is widely claimed and believed that when he moved with his team to MS that he reimplemented Mica as the NT kernel. http://www.textfiles.com/bitsavers/pdf/dec/prism/mica/

49. dwm ◴[] No.11453556{5}[source]
I remember having a Microsoft developer (I'm afraid I forget her name — Six?) come and visit us several years ago to demonstrate the then-new SFU 3.0.

Seeing her send SIGSTOP to a running MSWORD.EXE process and observe it stop updating its window in response to expose events was splendid. :-)