Live data from Hacker News

Ubuntu on Windows

blog.dustinkirkland.com

901–910 of 933 posts

Re: Ubuntu on Windows

#901
post #820

I'm not being deliberately obtuse: I don't really understand how this helps anyone particularly much. (OK, I assume there's a small number of developers who develop, or at least debug, for both systems and prefer windows as a development environment, but I assume that number is small, at least on Microsoft's scale). If you're developing to deploy on Linux but are more of a Windows dev, this helps you, but that doesn'…

One of the things that excited me most about this is the ability to ssh. I have a feeling that is going to be incredibly useful instead of having to use PuTTY or some other client.

ssh is, itself, just "some other client".

I suspect that you meant some other graphical user interface SSH client, as opposed to a TUI client like ssh. Yes, a TUI SSH client is useful. I've been using one with SFU/SFUA on a Windows 7 Ultimate machine for some years.

Re: Ubuntu on Windows

#902

So wait... you still get the "cmd.exe console"? After all these decades Microsoft Windows still does not provide a decent terminal out of the box?

Of course, one could phrase the question the opposite way. Many people have, over the years.

> After all these decades, Unix and Linux people are still limited and encumbered by the antique typewriter-mode way of interacting with a computer?

This sword cuts both ways, remember. In many people's minds, the typewriter-oriented way of interacting with computers -- with all of its concomitant problems of multiple incompatible escape code sequence sets, control sequence tearing, terminal mode enquiry from the host end, modal character encodings, modal display, 8-bitness, 7-bitness (!), and of course all of the modem and serial line hoops to jump through -- is something that the world got away from in the 1980s and early 1990s.

The console subsystems in Windows NT, and in OS/2 1.x before it, provided simple manipulation of cursor and attributes without worrying about which escape sequence set to use or without danger of escape sequence tearing. They provided simple enquiry mechanisms for reading characters and attributes back out of the display, and for reading the cursor. There were no worries about "having bit #7 set", or accidentally dropping into "great runes mode". One could use full UCS-2 (this was pre-Unicode 1.1, remember) if one wanted to avoid worrying about code pages. The kernel didn't impose a fixed number of devices or (at least in Windows NT) a low limit on the total number of consoles. The input stream included both keyboard and mouse events in a single machine-readable form, and application softwares didn't have to decode human-readable (sic) protocols for the latter. Keyboard events comprised key press and release information. There were no worries about BPS settings and carrier detect.

* http://homepage.ntlworld.com./jonathan.deboynepollard/Softwa...

* http://homepage.ntlworld.com./jonathan.deboynepollard/Softwa...

All of these were 1980s advances on the state of the art with respect to typewriter-oriented interfaces, and from them in the same decade we got a whole range of TUI programs (even on MS/PC/DR-DOS) whose textual user interfaces did things like incorporate the mouse, draw UI widgets with actual box/line/arrow glyphs, react to modifier keys as they were pressed and released (the most memorable perhaps being a press and release of the [ALT] key activating the menu bar), and save and restore what was displayed "behind" a window/dialogue box. So one should understand the non-Unix non-Linux world's amazement at people who bemoan the lack of systems inferior to even that.

And after that in the 1980s, they will tell you, we gave you the ability to have graphics with the text, multiple fonts, more than 16 colours, a cross-application clipboard, a unified message queue, message passing between different programs, and so forth.

There's another "after all these decades" question that could be shot back, as well.

> After all these decades, it's only in 2011 that the Unix and Linux worlds finally got a workable mouse event protocol for their typewriter user interface? The OS/2 MOU subsystem could handle 16-bit row and column positions, without any of these problems and in the same recognition that consoles were no longer 80 by 25, in 1987!

* http://www.edm2.com/index.php/OS2_API:DataType:MOUEVENTINFO

* http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Ex...

* http://superuser.com/a/413835/38062

* https://groups.google.com/d/msg/vim_use/lo6PLRUu2Gg/MDcpLf1P...

* http://leonerds-code.blogspot.co.uk/2012/04/wide-mouse-suppo...

There is no "Microsoft cannot do a decent terminal (like we can)" high ground for you to claim.

Re: Ubuntu on Windows

#903
post #465

I'm failing to see the difference between this, and any other VM? Is WOW in the cpu identifiers "windows-on-windows", the shim they use for "xp mode"? If everything's mounted under /mnt(/c..), and the screenshot shows nothing mounted there - Can this run just like a VM without the host fs mounted? I'd be really curious to see; if linux attempts to access raw block devices in /dev/, what's actually there. in the proce…

> I'm failing to see the difference between this, and any other VM?

Then you've failed to take in the point, copiously made in pretty much all of the coverage of this (and often right at the start), that this is not a virtual machine.

This is Windows NT, the operating system designed with "personality subsystems" right from the start, gaining another subsystem that lets it run ELF64 binaries that were compiled to run on top of the Linux kernel.

Re: Ubuntu on Windows

#904
post #77

Earlier quoted context omitted.

Yes, as mentioned in the article, / on the Linux side maps to C:\Users\...\AppData\Local\Lxss\rootfs\, and C:\ on the Windows side maps to /mnt/c/ on the Linux side. Think of it as an Ubuntu chroot on Windows, with C:\ bind-mounted into the chroot.

I get the impression that it's a new filesystem, so C:\Users\Kirkland\AppData\Local\Lxss\rootfs is a file containing a linuxy file system that's mounted onto / in the Linux subsystem and onto C:\Users\Kirkland\AppData\Local\Lxss\rootfs\ on the Windows subsystem.

It's not, though.

Windows NT was designed with multiple "personality" subsystems right from the start. The filesystem that any given "personality" sees is not the underlying system that is seen via the "Native API". They are all reinterpreted views of the NT Object Manager's namespace.

* The Win32 subsystem presents a view where C:\ in a Win32 name is mapped to \DosDevices\C:\ in a Native NT name.

* The POSIX subsystem (at least in the later SFU/SFUA) presents a view where /dev/fs/c/ in a POSIX name is mapped to \DosDevices\C:\ in a Native NT name.

* This Linux subsystem (reportedly) presents a view where /mnt/c/ in a Linux name is mapped to \DosDevices\C:\ in a Native NT name.

\DosDevices\C: is, in turn, a Object Manager symbolic link that points to somewhere else in the Object Manager namespace. (There's also a whole mechanism of "per-login" and "global" symbolic links that I'm glossing over.)

Win32 names relative to \ , D:., and . , and POSIX names relative to \ and . , are also things that are handled within the subsystem (sometimes within a set of conspirator language runtime libraries, in fact) that are mapped by that to the NT Object Manager's namespace.

* The Win32 subsystem itself only supports one current directory, the current directory on the current drive. The Win32 subsystem keeps a handle to that current directory open per Win32 process (and stores the handle value in the Process Environment Block in the process' address space) and remembers what string, including drive letter, it was set to.

* The current directory on another drive is a fiction maintained by conspiring Win32 language runtime libraries, using a set of otherwise hidden environment variables. A Win32 name with D:. is mapped using the value of an "=D:" environment variable. See http://unix.stackexchange.com/a/251215/5132 for how this can make a mess with the (Win32) Bourne Again shell running on Cygwin.

* Win32 names relative to a driveless \ use a Win32-subsystem-maintained idea of a current drive letter, derived from the Win32 "current directory" string that is set, and then go through the mapping to \DosDevices\C:\ (or whatever drive letter).

* The (SFU/SFUA) POSIX subsystem doesn't need such conspiracy, as the POSIX model is to have only one current directory, too. So the POSIX subsystem keeps a handle to the current directory open per POSIX process.

* This Linux subsystem (reportedly) presents a view where / in a Linux name is mapped to \DosDevices\C:\Users\Kirkland\AppData\Local\Lxss\rootfs\ in a Native NT name.

* Presumably, this Linux subsystem similarly keeps a handle to the current directory open per Linux process, and remembers its string. After all, it has to present /proc/self/cwd to Linux programs.

Every Windows NT subsystem has filename mapping mechanisms, and they all present their own "views" of the actual native namespace of the NT operating system kernel. This is not a new filesystem. It's another NT subsystem with its own view of the NT Object Manager's namespace, just as the other subsystems have.

Re: Ubuntu on Windows

#905

Apparently I wasn't the first one to think of this: 2016, the year that Linux finally takes off on the desktop. https://twitter.com/search?q=year+linux+desktop

... except that:

* Linux is the part that's being replaced, with the Windows NT kernel and this subsystem.

* The people promoting this are not aiming it at GUI programs. (https://news.ycombinator.com/item?id=11391961)

* The desktop seen on the screen will still be Windows Explorer.

So it's "Linux on the desktop", except in every particular. (-:

Re: Ubuntu on Windows

#906

TL;DR if you don't support the Linux API/ABI you are out of business. The reality is software defined everything and it's based on Linux.

Apple is hardly out of business and they don't support the Linux API or ABI.

Maybe jwildeboer talks about Cloud Native/micro-services/12 factor apps, not client apps.

Re: Ubuntu on Windows

#907
post #159
post #4

"Linux geeks can think of it sort of the inverse of "wine" -- Ubuntu binaries running natively in Windows. Microsoft calls it their "Windows Subsystem for Linux"." I find it amazing that you can have such a functional Ubuntu environment by translating system calls. Microsoft does have the advantage of Linux being open-source I suppose, while the Wine project had to reverse engineer DLLs. Or have you supply them on yo…

Some long term thoughts: 1) Linux has won the server (web) market. Developers would like to use a Unix box to work on their server code so they typically move to OS X. This could prevent that switch because they can still use Windows to developer their Linux server software. 2) Many projects start out as Linux and stay Linux and are only ported after much time and effort to Windows. Enterprises when faced with a tool…

> This feels eerily similar to the OS2 story and no doubt in the next week I expect to see more than a few articles discussing this very thing.

Although, as others have already pointed out, it differs in some very significant ways.

OS/2 2.x providing Win16 binary compatibility was an after-market system providing binary compatibility with applications made for the operating system that shipped "out of the box". Whereas this is the operating system that ships "out of the box" providing binary compatibility with applications made for an after-market operating system.

(Yes, yes. One could buy OS/2 pre-installed, and one can buy Ubuntu Linux pre-installed. The scale of that, in both cases, is nowhere near significant enough to change the basic fact that overall the two situations are the reverse of each other.)

Also: There was not the extent of existing tools available natively on both platforms, in the OS/2 case. The examples being waved around in the news now are things like Apache, Ruby, Node, and so forth. There wasn't the OS/2-and-Win16 analogue of (say) the Ruby developers deciding in the months to come that a Win32 port is too hard to maintain, and dropping it in favour of just running the Linux Ruby on the Windows NT Linux subsystem. Today's analogue of the OS/2 case would be a universe where there was no Win32 Ruby at all, and the Ruby developers deciding not to start making a Win32 version because the Linux one "is good enough for the few Windows users".

I suspect that drawing parallels based upon what happened with OS/2 2.x and Win16 is a mistake, and those thinking that this will mean an outflux of Windows development "because it happened with OS/2 2.x" (which was more like an influx of development that failed to happen) are indulging in wishful thinking.

There's also the minor matter that, during the OS/2 2.x and Win16 time, there was this little thing called Windows NT lying around, promising a route for OS/2 1.x, where the existing tools were, with its OS/2 subsystem. (It is ironic that we are once again looking at a Windows NT subsystem.) That has no equivalent this time around at all; unless one mis-casts UbuntuBSD (https://news.ycombinator.com/item?id=11326457) in that rôle. It doesn't really fit, though. "Look, all you people with Ubuntu Linux application softwares. Forget that minority Windows thing that you ported to a couple of years ago. Come bring your applications to this new FreeBSD instead." (-:

Re: Ubuntu on Windows

#908

Earlier quoted context omitted.

He says it mostly works in cmd.exe, and they're working on getting things like screen/tmux working too. If a fully-compatible terminal emulator doesn't exist yet (I have no idea) I bet there will be one within a year.

conhost (the black box that typically runs cmd.exe) is a terribly shitty terminal emulator. My biggest gripe with Windows has been the lack of a decent pseudoconsome system that would allow an ecosystem of terminal emulators to developer, as one has for POSIX-ish systems.

> My biggest gripe with Windows has been the lack of a decent pseudoconsome system that would allow an ecosystem of terminal emulators to developer, as one has for POSIX-ish systems.

This has been up since the turn of the century:

* http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/ca...

The demonstrators in the Microsoft video do warn that they will be avoiding some of the holes of the system in their demonstration. One is very briefly visible at 08'13", before the demonstrator rapidly clears the screen (again), when they run apt-get to install git:

  E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
The new Windows NT Linux subsystem apparently doesn't have pseudo-terminals.

The old Windows NT POSIX subsystem (the Interix-derived SFU/SFUA one) has pseudo-terminals with both BSD and System 5 access semantics, in comparison.

* https://technet.microsoft.com/en-gb/library/bb497016.aspx

* https://technet.microsoft.com/en-gb/library/bb463219.aspx

Moreover, a Windows console window that is the controlling TTY of a POSIX program in that subsystem has the POSIX cooked input mode with local echo, and generates escape sequences for extended keys.

Re: Ubuntu on Windows

#909
post #642
post #623

Earlier quoted context omitted.

"The hardest part of running bash and other posix things under windows is filesystem access. Windows uses drive letters and backslashes, unix has a root filesystem with forward slashes. It seems they are taking the same route as cygwin by "mounting" windows drives in /mnt/c (or /cygdrive/c)." How do these ubuntu tools interact with the rest of the windows system that they are running on ? Can I 'kill -9 explorer.exe'…

PIDs from Windows are not exposed when looking at /proc, so I am guessing you will not be able to `kill -9 explorer.exe` unless there is some real voodoo going on (and then it would not be POSIX compatible, anyways). I think the command that you meant to say was killall :) `kill` will only kill pids, not process names.

This was one of the selling points of the old Windows NT POSIX subsystem (the Interix-derived SFU/SFUA one) over its predecessor. Programs such as "ps" and "kill" can "see" Win32 processes, with POSIX process IDs.

* https://technet.microsoft.com/en-gb/library/bb463219.aspx#EH...

* https://technet.microsoft.com/en-gb/magazine/2005.05.interop...

Re: Ubuntu on Windows

#910

Earlier quoted context omitted.

I believe there will be many hoops to jump through to use this as a development environment too, and the limitations of this ABI will be plenty.

The thing I'm wondering is how it will handle launching daemons. It doesn't look like there's systemd or upstart integration, and without something like screen it quickly becomes a hot mess.

It is, quite simply, not aimed at launching daemons in the first place.

* https://news.ycombinator.com/item?id=11391961

* https://blogs.windows.com/buildingapps/2016/03/30/run-bash-o...

I strongly suspect that you will never see systemd working on the Windows NT kernel. Getting systemd to work doesn't just involve supporting the Linux kernel system calls, but also involves getting what those system calls do to work as well. It's all very well supporting open(2), but if one cannot open (say) /proc/self/mountinfo or all of the stuff under /sys or many other things (some listed at http://0pointer.de/blog/projects/the-biggest-myths.html), then systemd might load but it won't run and work.

The same goes for upstart. For example: upstart uses pseudo-terminals for logging. The Windows NT Linux subsystem, according to the Microsoft demo video, doesn't implement pseudo-terminals and returns ENOENT when a program attempts to obtain one.

* http://upstart.ubuntu.com/cookbook/#console

* https://news.ycombinator.com/item?id=11415843

Then there's the fact that the Windows NT Linux subsystem doesn't run Linux programs as the first process in the entire system. That honour goes, of course, to Windows NT's own Session Manager. Both systemd and upstart have "Am I process #1?" checks, and operate in a non-system mode if they aren't process #1.

Which brings us on to the fact that Windows NT already has a mechanism for launching daemons. It already has a Service Control Manager that supervises daemons and that talks LPC to control utilities. It already has a Session Manager that handles initialization, shutdown, and sessions. Ironically, it has had some of the things that are "new" in systemd for roughly a quarter of a century. (But some of those "new" things aren't even new in the Linux and Unix worlds, really.)

It's worth observing that the approach taken by the old Windows NT POSIX subsystem (the Interix-derived SFU/SFUA one) is to run daemons under Windows NT's own Service Control Manager. There is a small shim (psxrun.exe) for ensuring that the Service Manager could run and control the POSIX program, doco on what environment a POSIX program should expect when run under the Service Manager, and an Interix version of the service(1) command that understands Windows NT service management and how to speak to it.

* https://technet.microsoft.com/en-us/library/bb463219.aspx#EH...

* http://systemmanager.ru/svcsunix.en/extfile/portapps/service...

It would be interesting to see how some of the daemontools family of service management toolsets -- such as nosh, runit, perp, daemontools-encore, and s6 -- fared on the Windows NT Linux subsystem. I suspect that one would trip over unexpected holes in the Windows NT Linux subsystem (like setuidgid not working because the underlying system calls return EPERM, perhaps). But I also suspect for several reasons that quite a lot would work. The daemontools family uses FIFOs and ordinary files as the control/status API; is composable and loosely coupled and so doesn't lock everything in to Linux-specific stuff (like specific files in /proc, /dev, or /sys) even if one tool in a toolset might need such stuff and permits that one tool to be replaced or otherwise worked around; and can do service management without demanding to be process #1.

So one could spin up svscan, or service-manager, or perpd, or runsvdir; stub out or comment out invocations of setuidgid or runuid with a dummy program if the Windows NT Linux subsystem didn't support that; similarly stub out or comment out invocations of jexec (for nosh service bundles that use BSD jails) and whatever of ionice, chrt, and numactl (for nosh service bundles that use those) don't work; and probably get quite far.

But the big deal would be spinning service management up outwith a Windows NT login session, so that daemons are actually daemonized. The old Windows NT POSIX subsystem actually has an init process (and an inetd) that can spin up other stuff. I strongly doubt, given the very clearly stated aims, that the new Windows NT Linux subsystem has (or will have) anything similar.

Post reply on HN