News for hackers. Stuff that matters.
Re:Ubuntu on Windows by barrkel on Wednesday March 30, 2016 @01:38PM (#11391240)
I expect they implemented a subsystem for Linux at the syscall level - i.e. they implemented the Linux kernel's interface at the ABI level. No headers would need to intermingle with open source; compile on Linux, run on Windows.
Re:Ubuntu on Windows by whatever_dude on Wednesday March 30, 2016 @01:53PM (#11391417)
I've read comments where people wrote that NT always had some kind of POSIX subsystem, and it has probably just now been completed and expanded.

Can't find any substantial writings on this, but it seems likely.

Re:Ubuntu on Windows by barrkel on Wednesday March 30, 2016 @02:02PM (#11391513)
Not only did NT have a POSIX subsystem, but once upon a time I used it (when it was packaged as SFU, Services for Unix). It wasn't a pleasant experience.

This will have been quite a bit more work than just a POSIX layer, IMO; POSIX defines a bunch of low-level functions that lie just under the C runtime library, but Linux defines a bunch more that expect a certain view of the world - things like clone(2), which lets you selectively choose what the forked process gets to inherit. POSIX only specifies fork(2). Linux implements fork(2) in terms of clone(2). And POSIX defines the API at the level of C; this will have had to implement the Linux ABI, where it differs from Win64. A minor detail of a bunch of assembly stubs, but work nonetheless.

Re:Ubuntu on Windows by JdeBP on Sunday April 03, 2016 @06:32PM (#11418098)
> It wasn't a pleasant experience.

In my experience the differing perception of pleasure, certainly with the Interix-derived Windows NT POSIX subsystem rather than the original one, is usually a result of the toolset being BSD rather than GNU. I don't have much trouble with the BSD toolset, myself, especially when switching between Windows and an actual BSD. (-:

In addition to the fact that a number of the "Does this new subsystem ...?" questions are answerable as "No; but the old POSIX subsystem did." (https://news.ycombinator.com/item?id=11416392) the POSIX subsystem has some stuff that we're simply not going to get with a Linux subsystem that has vanilla Linux binaries including libraries right down to the system call level. There are things that only come by adjusting libraries and binaries, because they are above the raw system call level. The POSIX subsystem integrates the user account database access library routines with the Windows SAM, for example. So "ls -l" shows the actual Windows usernames. The POSIX subsystem also comes with a "service" command that understands and can work with the SCM, for another example.

I'd like to see the POSIX subsystem reintroduced. It's a major reason not to use Windows 10.

Re:Ubuntu on Windows by LukeShu on Wednesday March 30, 2016 @04:09PM (#11392546)
To nitpick: On Linux, glibc implements fork(3) in terms of clone(2). Linux still has an independent fork(2), but nothing uses it.
Re:Ubuntu on Windows by alwaysdownvoted on Wednesday March 30, 2016 @11:21PM (#11394779)
I still use SUA every day when I'm forced to use Windows. (I also run Linux binaries on BSD.)

SUA is based on an old version of BSD, not GNU. tcsh, csh and sh. The compiler works. There is an old version of lex. For some of the userland, Windows binaries are provided, such as vi. It's better than nothing.

Why did MS remove SUA from Windows 10? What harm would it do to remain an optional add-in as it was in Windows 7?

Why do users have to upgrade to Windows 10 to use Linux binaries? Seems like Microsoft will do _anything_ to get users to upgrade. What are the privacy implications of Windows 10? Microsoft is very untrustworthy.

Will users be able to run their own Linux binaries on Windows?

Windows has never been a "pleasant experience". It's the unpleasantness of it that makes the alternative, UNIX, so appealing.

Re:Ubuntu on Windows by JdeBP on Sunday April 03, 2016 @06:44PM (#11418162)
> The compiler works.

... but is too outdated to be capable of bootstrapping clang. There's very probably a long chain of bootstraps that would achieve it, but there's not a direct route.

> Will users be able to run their own Linux binaries on Windows?

The answer to that is easily determined from the demo video that Microsoft published. In it, Russ Alexander compiles a program with (Ubuntu binary) GCC and and runs it.

Its implicit int in the declaration of main() was jarring. (-:

Re:Ubuntu on Windows by EvanAnderson on Wednesday March 30, 2016 @02:23PM (#11391676)
NT shipped w/ a POSIX subsystem. Later, Microsoft acquired Interix (https://en.wikipedia.org/wiki/Interix), a more fully-featured POSIX subsystem. I have fond memories, in the late 1990's, of running GNU tools on NT under Interix.
Re:Ubuntu on Windows by TeMPOraL on Wednesday March 30, 2016 @02:58PM (#11391955)
Same here. It's like everyone forgot there was such a thing as SFU/SUA. I found it much more pleasant to work with than Cygwin.
Re:Ubuntu on Windows by krylon on Wednesday March 30, 2016 @03:14PM (#11392099)
> It's like everyone forgot there was such a thing as SFU/SUA

Well, it's not like Microsoft made much of an effort to remind people. It was discontinued as a separate project after about Windows XP. It continued to be part of Windows Server[1], but AFAIK, it was no longer present in the client versions.

[1] at least until 2008 or 2008 R2, I didn't check later versions.

Re:Ubuntu on Windows by SSLy on Wednesday March 30, 2016 @03:28PM (#11392222)
last it was avaiable in windows 8 enterprise
Re:Ubuntu on Windows by krylon on Wednesday March 30, 2016 @11:55PM (#11394875)
I stand corrected.

Thanks for the info!

Re:Ubuntu on Windows by nradov on Wednesday March 30, 2016 @03:48PM (#11392369)
Microsoft implemented a minimal POSIX subsystem in Windows NT 3.1 as a checklist feature because at the time some government procurement rules required POSIX compatibility. They didn't expect anyone to actually use it and it was so limited that you couldn't really use it for much in practice.
Re:Ubuntu on Windows by dboreham on Wednesday March 30, 2016 @03:32PM (#11392248)
It was documented in the original NT manuals in 1992 which I still have on the bookshelf in pristine condition.
Re:Ubuntu on Windows by captainmuon on Wednesday March 30, 2016 @04:35PM (#11392769)
From the screenshots, it seems there is a full kernel in there - e.g. you have /proc/cpuinfo, and it identifies as Linux 3.4.0.

If they just implemented all Linux syscalls on top of NT, that would replace a Linux kernel. There would be no Linux kernel running on top. But in that case they would also need to emulate stuff like /proc. (This is the "reverse Wine" scenario.)

So I personally think it is either: - There is no new subsystem, this is just a linux.exe running the Linux kernel as a process, like CoLinux does or - There is a new subsystem. One way to do this is to port Linux to a new "architecture", namely the NT HAL. You'd call into the NT native API from the linux kernel, which would mean you'd have to put the headers with the native APIs you use under the GPL.

Armchair kernel development is fun :-)

Re:Ubuntu on Windows by jclulow on Wednesday March 30, 2016 @05:05PM (#11393006)
Speaking from experience working on the LX brand (the Linux emulation layer for Joyent SmartOS), we would not have gotten very far with our emulation layer if we did not also faithfully emulate quite a lot of /proc. For example:

    $ grep DESC /etc/lsb-release
    DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
    $ uname -a
    Linux kappa 3.13.0 BrandZ virtual linux x86_64 x86_64 x86_64 GNU/Linux
    $ wc -l /proc/cpuinfo
    608 /proc/cpuinfo
    $ /native/usr/bin/uname -a
    SunOS kappa 5.11 joyent_20160204T173314Z i86pc i386 i86pc
Re:Ubuntu on Windows by zzzcpan on Wednesday March 30, 2016 @05:35PM (#11393220)
There is a link to a full demo someone posted here [1].

They don't run the linux kernel at all. That /proc/cpuinfo is a part of a limited subset from what procfs usually offers. They enter their linux compatible "subsystem" via a bash binary, which could probably be any linux elf binary, since they run them unmodified. So, it looks like they actually implemented most of the syscalls with some of them emulating necessary parts of linux environment, like procfs.

[1] https://sec.ch9.ms/ch9/5db6/8ee786b7-9fc5-45bf-94d0-16ea9176...

Re:Ubuntu on Windows by teacup50 on Wednesday March 30, 2016 @05:52PM (#11393332)
FreeBSD's linux compatibility layer does exactly this; it reports as "Linux", there's a linprocfs implementation that provides a Linux /proc, etc.

It's a lot easier to emulate syscalls than it is to do something like CoLinux. Additionally, I can't imagine Microsoft would EVER let GPL'd Linux code into their kernel.

Re:Ubuntu on Windows by xorblurb on Wednesday March 30, 2016 @05:14PM (#11393062)
There is no need to use actual Linux code to implement its interface, so no GPL'ing of NT, and implementing /proc is not a big deal compared to other things.

And this seems to be implemented as an NT subsystem, which makes tons of sense.

Re:Ubuntu on Windows by blinkingled on Wednesday March 30, 2016 @03:42PM (#11392330)
They actually do syscall translation on the fly from Linux to Windows. I suppose they had to add some calls to Windows for things in Linux that did not exist on Windows (various console ioctls for e.g.) but it is still a one to one translation.
Re:Ubuntu on Windows by jychang on Wednesday March 30, 2016 @03:57PM (#11392436)
This isn't really easy to implement for some syscalls in NT, like fork(2) for example.
Re:Ubuntu on Windows by willtim on Thursday March 31, 2016 @03:39AM (#11395586)
It's not possible to implement fork efficiently on Win32/64 which cygwin uses, but are you sure this is the case when using the NT native APIs?
Re:Ubuntu on Windows by blinkingled on Wednesday March 30, 2016 @03:58PM (#11392444)
Yeah, it was a MS Research project that did the work.
Re:Ubuntu on Windows by hughw on Wednesday March 30, 2016 @04:01PM (#11392474)
They could call it ENIW.