The Sad History of the Microsoft POSIX Subsystem

When Windows NT was first being developed, one of the goals was to make the kernel separate from the programming interface. NT was originally intended to be the successor to OS/2 but Microsoft also wanted to include compatibility to run Windows 3.x applications and to meet 1980s era DoD Orange Book and FIPS specifications to sell to the defense market.  As a result, Windows NT was developed as a multiuser platform with sophisticated discretionary access controls capabilities and it was implemented as a hybrid microkernel 3 userland environments:

  • Windows (Win32)
  • OS/2
  • POSIX

Microsoft had a falling out with IBM over Win32 and the NT project split from OS/2. The team focus shifted to Win32 so much that the Client-Server Runtime Subsystem (CSRSS) that hosts the Win32 API became mandatory and OS/2 and POSIX subsystems were never really completed but they were shipped with the first five versions of Windows NT through Windows 2000. The OS/2 subsystem could only run OS/2 1.0 command-line programs and had no presentation manager support. The POSIX subsystem supported POSIX.1 spec but provided no shells or UNIX-like environment of any kind. With the success of Win32 in the form of Windows 95, the development of the OS/2 and POSIX subsystems ceased. They  were entirely dead and gone from Windows XP and Windows Server 2003.

Meanwhile, around 1996,  Softway Systems developed a UNIX-to-Windows NT porting system called OpenNT. OpenNT was built on the NT POSIX subsystem but fleshed it out into a usable UNIX environment. This was at a time when UNIX systems where hugely expensive. Softway used OpenNT to re-target a number of UNIX applications for US Federal agencies onto Windows NT. In 1998, OpenNT was re-named Interix. Softway Systems also eventually built a full replacement for the NT POSIX subsystem in order to implement system calls that the Microsoft POSIX subsystem didn’t support and to develop a richer libc, single-rooted view of the file system and a functional gcc.

Microsoft acquired Softway and the Interix platform in 1999. Initially Interix 2.2 was made available as a fairly expensive paid add-on to Windows NT 4 and Windows 2000. Later it was incorporated as a component of Services for UNIX 3.0 and 3.5 (SFU) and SFU was made free-of-charge. When Interix became free, Microsoft removed the X11 server component that was previously bundled with Interix because in the wake of U.S. vs Microsoft, they did not want to defend law suits from the entrenched and expensive PC X Server industry but the X11 client libraries remained.

SFU/Interix 3.0 was released in early 2002 followed up with SFU 3.5 less than two years later and cool stuff got implemented like fast pthreads, fork(), setuid, ptys, deaemons with RC scripts including inetd and sendmail among other things. InteropSystems ported OpenSSH and developed a high-performance port of Apache using pthreads and other proof-of-concept ports like GTK and GIMP among many other things. Hotmail even ran on Interix. And enterprising people did cool things like a Linux ELF binary loader on top of Interix.

I got into this stuff and built and donated ports to the SFU/SUA community, including cadaver, ClamAV, GnuMP, libtool, NcFTP, neon, rxvt and gnu whois. My company sponsored the port of OpenSSH to Interix 6.0 for Vista SUA (because it broke backwards compatibility with Interix 3.5 binaries). We ran Interix on all of our workstations and servers. We used it for management, remote access and to interop with clients who used Solaris, Linux and OS X on various projects.

Slowly Going Off the Rails

With Windows Server 2003 R2 (and only R2), Interix became a core operating system component, rebranded as “Subsystem for UNIX Applications” (SUA). Around this time, the core development team was reformed in India rather than Redmond and some of the key Softway developers moved on to other projects like Monad (PowerShell) or left Microsoft. Interix for Windows Server 2003 R2 (aka Interix 5.2) was broken. It shipped with corrupt libraries and a number of new but flawed APIs and broke some previously stable APIs like select(). Also, related to the inclusion of Interix as an OS component, SP2 for Windows Server 2003 clobbers Interix 3.5 installations.

Things have been downhill from there. It’s not just that obvious things didn’t get implemented like a fully-functional poll() or updating binutils and gcc to something reasonably modern. The software suffered from severe bitrot.

One of the consequences of including SUA as an OS component has been that a bifurcation of the “subsystem” from the “tools”. The subsystem consists of just a few files: psxss.exe, psxss.dll, posix.exe and psxrun.exe. This implements the runtime and a terminal environment but nothing else, not even libc. In order to get shells, PTYs and usable programs, you have to install the “Utilities and SDK for UNIX-based Applications”  (aka tools) which is sizable download. Apparently Microsoft has concern about bundling GPL code onto the actual Windows media.

OK. This is a little weird but not a big deal except that the development timeline of the tools is now completely out of whack with Windows releases. The tools for Vista were only available in beta when Vista went gold and the version for Windows Server 2008 and Vista SP1 was not available until about a month after Vista SP1/Win2k8 was released. When Windows 7 was released no tools were available at all in July 2009 when Windows 7 was released. They didn’t become available until 8 months later in March 2010 and contain no new features.

To top things off, while SFU 3.5 ran on all versions of NT 5.x, SUA only runs on Windows Server and the Enterpise and Ultimate client editions. SUA is not available on Vista Business or Home and Windows 7 Professional and Home editions.

Is Interix Dead?

For some reason Microsoft seems to be ambivalent about this technology. On the one hand they bring it into the core of the OS and make it a “premium” feature that only Enterprise and Ultimate customers get to use and on the other they pare back development to almost nothing.

Interix has been supported with support forms and a ports tree maintained by InteropSystems collectively known as SUA Community which operates with supplemental funding from Microsoft. The /Tools ports tree is the source for key packages not provided by Microsoft such as Bash, OpenSSH, BIND, cpio and a ton of libraries that Microsoft does not bundle.  Microsoft has been increasingly reluctant to fund the SUA Community and has survey users on a number of occasions. The latest survey was very pointed and culminated with Microsoft cutting off funding and shuttering the SUA Community site on July 6th, 2010 but a few days later it was back online. I’m not sure how or why.

I have no inside knowledge but my gut says that Interix has lost internal support at Microsoft. It is being kept on life support because of loud complaints from important customers but it is going nowhere. I will be surprised if there is a Subsystem for UNIX-based Applications in Windows 8. I think the ambivalence is ultimately about an API war. At some level, the strategerizers have decided it is better to not dignify UNIX API with support. I think the calculus is that people will still use Windows but it chokes off oxygen for UNIX-like systems if it takes a lot of extra work to write cross-platform code for Windows and UNIX—the premise being that you write for Windows first because that’s where the market is. Furthermore, in a lot of business cases what is needed is Linux support or Red Hat Linux version X support in order to run something. I think Microsoft realizes that it is hard for Interix to beat Linux which is why SUSE and Red Hat Linux can be virtualized under Hyper-V.

I also believe that Microsoft sees C/C++ APIs as “legacy”. I think they want to build an OS that is verifiably secure and more reliable by being based on fully managed code. The enormous library of software built for the Windows API is a huge legacy problem to manage in migrating to such a system. Layering POSIX/UNIX on top of that makes it worse.

Whatever the reason, it seems pretty clear that Interix is dying.

About these ads

19 Responses to The Sad History of the Microsoft POSIX Subsystem

  1. Pingback: » The Sad History of the Microsoft POSIX Subsystem « Thoughtful Code RWPS

  2. yan says:

    Thanks for the historical inside… I tried to use this stuff about 1 year ago, after trying powershell (which is definitively NOT a unix shell and does not target interoperability => useless), without success for both.

    I now understand why: Development in India does not cost a lot… but you usually have, more than with other countries, what you pay for! If Microsoft is reluctant to pay/support… the issue will be a very quick dead.

    So I moved to Cygwin, largely sponsored by Red-Hat… and I found their 1.7 branch very nice: So Microsoft probably want to shutdown unix stuff inside windows, but Red-Hat understood the problem and it’s business implications, filling the gap!

    The result for Microsoft will be another piece of customer needed feature going out of their control… on their OS! So stupid, isn’t it?!

  3. arkanoid says:

    According to debian/interix bug database select(0,..) was a) already broken in 3.5 b) this bug is (as you may check, that’s easy) not that critical, actually there is no sane reason to use select instead of sleep() (and it does not appear if there are real fd’s in any set)

  4. homer says:

    and aparently you hit the nail in the head with this article since win 8 don’t have a posix subsystem anymore. I’m a linux user and linux/windows programmer for 10 years and I didn’t know such thing even existed, I found your article because someone mentioned SUA on a forum when listing the changes for win8 then I went “whaaa? there is posix stuff inside windows?”.

    • Brian Reiter says:

      There is a “Subsystem for UNIX-based Applications [Deprecated]” in Windows Server 2012. I admit that I haven’t bothered to install it and try to get the Tools and SDK working on top. I think it is abandonware at this point.

      • homer says:

        that’s something one need a really good reason to mess with, seems like it’s not fun at all. I’m pretty satisfied using the mingw32 shell that comes along with git on windows plus console2 for tabs and vim. It’s a hundred times better than using that horrible horrible visual studio and that’s all I need to program at work.
        I don’t really know what I’m talking about but it seems that it’s one of those things that have very little use anyway. Isn’t it better to just use Cygwin or something for most uses you would have of a posix kernel?

      • Brian Reiter says:

        There was a lot of really cool stuff in there. It provided a cc script to drive cl.exe with posix semantics. The behavior of pretty much everything was posixally correct. They had fast pthreads and fork() built on top of the kernel APIs. Generally speaking Interix binaries were dramatically faster that Cygwin. It rides on top of the kernel as a parallel subsystem to csrss (win32). It was cool. At one point, it ran Hotmail and Ballmer claimed NT would soon be a better Unix than Linux.

      • homer says:

        Yeah it sounds way better than working with .NET.

    • Comet says:

      http://www.microsoft.com/en-us/download/details.aspx?id=35512

      Utilities and SDK for Subsystem for UNIX-based Applications includes base utilities, software development kits (SDKs), and shells for use with Subsystem for UNIX-based Applications, a feature that is available for installation on Windows 8 Enterprise and Windows Server 2012.

      • Brian Reiter says:

        Go ahead and use it if you want, but it will be a frustrating experience. The APIs and utilities are very old.

        From the Download page you linked:

        “Note that Subsystem for UNIX-based Applications has been deprecated, and will not be available in future releases of Windows or Windows Server.”

        The link there references the following:

        “The Subsystem for UNIX-based Applications (SUA) is deprecated. If you use the SUA POSIX subsystem with this release, use Hyper-V to virtualize the server. If you use the tools provided by SUA, switch to Cygwin’s POSIX emulation, or use either mingw-w64 (available from Sourceforge.net) or MinGW (available from MinGW.org) for doing a native port.”

        I was stunned to see Microsoft is actively, officially advocating Cygwin and MinGW. I don’t expect SUA to still be there in “Blue” because it is a new kernel revision to NT 6.3.

  5. vreejack says:

    Thanks for this. Mingw is broken so I was considering installing cygwin for a nice posix development environment when I realized that my copy of Vista came with SUA. And now, several hours later, I realize why nothing is working properly. Pity. Cygwin it is, then.

  6. David Given says:

    I did some stuff with Interix a while back (I did a Linux binary loader for it, which would run unmodified Linux binaries on top of Interix… it was a scary, fragile pile of hacks, but to my surprise and horror, it worked well enough to run big chunks of Debian and apt). Unix-wise it was pretty old-school, and it didn’t have a lot of the newer Posix APIs, but it actually worked really well.

    It was pretty obvious it was being killed by creative neglect, though — having to manually install multiple hotfixes in order to make it work well was a sure sign. Which is rather sad, as it was a really nice piece of work and very comfortable to use. Much more so than Cygwin.

  7. Bob says:

    Anyone know what happened to the interix sua community website?

  8. Pingback: The Activity Designer

  9. schrepfler says:

    Full disclosure, I think Windows objectively has pretty awesome kernel and development tools available, and the drivers/hardware capabilities are abundant for every pocket.
    As a software engineer however I have to admit that if anything moved my workflow away from Windows it was the UNIX/GNU toolsets available on OSX and Linux. I tried using Cygwin as much as humanly possible but it was just too flakey and broken.
    MS should reconsider. After all, Apple did.

  10. LM says:

    The only reason I bought the Ultimate version of Vista was for SFU/SUA support. At the time, there were promises that Microsoft would continue to support the technology. I am sorry I bought the Ultimate version just for that and would not do so again should a similar choice arise in the future. I do a lot of cross-platform programming and SFU/SUA sounded like a great solution. When it became freely available, I attempted to download it for my XP system. It refused to install. I should have known at that point there would be issues using it. I’ve tried Cygwin and it works much better than SFU/SUA as far as supporting any recent version of Windows and it’s also helpful for porting POSIX compliant programs and libraries. However, there are still several porting issues. There are also license issues if you want to develop programs that are not Open Source. I typically find it’s easier to port applications using MinGW than Cygwin. I have X Windows libraries and server built and working natively with MinGW instead of via Cygwin and its POSIX layer. With the fork of MinGW (now there’s MinGW and a separate MinGW64 project), many Open Source programs work on one or the other version, but not necessarily both. That places further burdens on cross-platform development and porting. Also, the runtime licenses have changed for both versions of MinGW, making it not as suitable for commercial development anymore. llvm is an interesting option, but, for now, it can’t create an executable on Windows without using gcc. I can see why so many developers I come across have switched to Apple, especially when it comes to cross-platform or web development. As a long time Windows user, I’m very discouraged by the current situation. We’ve gone from a number of free C/C++ compilers that were competing to implement the latest standards and technologies to a few free compilers with licenses that may not be that friendly for commercial development and in many cases, little or no interest in Posix compatibility. I’m still looking for solutions. I can no longer continue to use an older version of MinGW with the older, more liberal runtime license. Too many Open Source applications are requiring support for more recent C/C++ standards. There have been various projects over the years that use gcc with more POSIX compatible runtime libraries (including Cygwin). I’m seriously considering continuing to work with gcc, but with different runtime libraries that have more lenient licensing and better POSIX support. It would be nice to find another project or other developers with similar goals. However, even if I have to start with a recent version of gcc, the last public domain version of the MinGW runtime and then start adding in better POSIX support, it’s a better alternative than what I have now. I already have a library of functions that emulate some POSIX capabilities.

    Would be very interested to hear what solutions other developers decide to use for cross-platform support in place of SFU/SUA. I think it’s a great shame these technologies never got the support they needed to succeed. It really was a good concept and I would have been thrilled to place my porting efforts behind it, if it was useable on all the latest versions of Windows and not just certain systems.

    • Brian Reiter says:

      The only thing besides Cygwin and MinGW I can think of is MKS. I haven’t tried that.

      It’s just much easier to use OS X as a host. Windows in a VM for Windows things. Linux and BSD VMs, too. VMs are cheap to run now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 86 other followers

%d bloggers like this: