11 ms·
Some additional details from Scott Hanselman: http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx http://www.
by hobs 11y ago
Some additional details from Scott Hanselman:
http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx 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.
"
- drinchev 11y ago> This is a real native Bash Linux binary running on Windows itself. How does it work without VM? I'm super curious!
- nickysielicki 11y agoThe same way Wine works for Windows binaries. Translate system calls.
- vetinari 11y agoWine 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.
- nickysielicki 11y agoHuh, TIL. That explains why Wine always seemed so buggy, though.
- pionar 11y agoThey added a subsystem in Windows that responds to Linux APIs.
- tkubacki 11y agoLol "linux is a cancer" has new meaning now :)
- stcredzero 11y agoIs 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?
- tripzilch 11y agoe.coli isn't a gut bacterium, ... is it?
- fla 11y agoThink of it as Wine, reversed.
- darkr 11y agoEniw?
- unclenoriega 11y agoEmulator Not In Windows Sorry it's not recursive.
- stcredzero 11y agoEnterprise Networked Internet Workstation?
- ant6n 11y agoENIW is 'Nix In Windows
- 0x0 11y agoI 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 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.
- johnhattan 11y agoApparently they re-implemented the Linux API's along with the ability to run Linux executables directly.
- teamhappy 11y agoHave 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-linuxulator-explained-for-developers-basics/ http://www.leidinger.net/blog/2010/10/27/the-freebsd-linuxul...
- stormbrew 11y agoIs 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.
- kybernetikos 11y agoA 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.
- stormbrew 11y agoYeah 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.
- kuma4 11y agoI feel it is related to Windows Server container. Maybe Ubuntu works like a Docker container on Windows.
- yulaow 11y agowait wait wait, will I have access to the whole repositories of ubuntu via apt-get or just to a windows repository made on purpose? In any way, for me, this is a great news. The fact was really hard to work with python/ruby/node/etc under windows and the fact I hate powershell were the two main things about why I work on a linux os all the time.
- TheOsiris 11y agoExactly. I mean did we really just jump straight from the worst shell in history (the windows command prompt) to one that supports tmux? However, I don't know if this is the case. I remember in the livestream Meyers saying that they will enable you to choose any shell you want "powershell, dos, bash, and more coming soon". If they just supported _any_ ubuntu binary natively, I don't know why he would've said "more coming soon"
- signal11 11y agoscreen and tmux don't appear to be supported yet due to issues with terminal emulation. But they're working on it.
- T-A 11y agoWith some luck they'll work with Conemu. BTW, it's 3-clause BSD, so you can peek, Microsoft. :) https://github.com/Maximus5/ConEmu https://github.com/Maximus5/ConEmu
- PatentTroll 11y agoWindows has had powershell for a while, and there is a good argument that its better than the *nix shell because it supports strongly typed objects. Many will disagree, of course, but keep in mind that cmd.exe hasn't been the windows shell of choice for many years now.
- jonathonf 11y ago> will I have access to the whole repositories of ubuntu via apt-get Yes; full, standard, repo access [1]. > With full access to all of Ubuntu user space > Yes, that means apt, ssh, rsync, find, grep, awk, sed, sort, xargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, php, gcc, tar, vim, emacs, diff, patch... > And most of the tens of thousands binary packages available in the Ubuntu archives! [1] http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html?m=1 http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.htm...
- troels 11y agoThey must be 2 days early.
- Gratsby 11y agoThis doees sound pretty funny when you think about it. "Our latest improvement to Windows is... Adding Linux"
- swalsh 11y agoThis is such a big deal though, this really shows Microsoft's commitment to the new .net Core initiative, and their push for linux support
- simplemath 11y agoHonestly, seems like all roads here lead to Microsoft swallowing Linux userbase whole. What's next, RedHat on Server?
- bitcrazed 11y agoSwallowing? No. Supporting, yes! We want Windows to be your home - the best place to build apps for all the platforms and all the devices. Period. In case you've not noticed, this is a very, VERY different Microsoft, one I re-joined recently precisely to work on this very feature! :D
- niutech 11y agoIf you want Windows to be Linux users' home, then how isn't it swallowing them and dragging them from an open source environment to a closed source one? More questions: Will it be backported to Windows 8.1? How does it differ from CoLinux and andLinux?
- asp_hornet 11y ago>If you want Windows to be Linux users' home, then how isn't it swallowing them and dragging them from an open source environment to a closed source one? because no one is forcing linux users to do anything. can you really not see the difference between giving an option to developers and "dragging linux users"
- umanwizard 11y agoWhat's "Linux" about this and "not Linux" about Cygwin?
- bboreham 11y agoCygwin requires a recompile. This is running Ubuntu binaries.
- umanwizard 11y agoSo it's cygwin + ELF support in the kernel. I guess ability to run GNU tools + supporting ELF is being called "Linux". The latter piece seems pretty minor, especially since most things that run on ubuntu are open-source anyway.
- monocasa 11y agoNo, it's supporting all of the linux system calls in the Windows kernel. Epoll, fork, exec, etc. It's a totally different implementation than cygwin.
- umanwizard 11y agoGot it, thanks.
- bitcrazed 11y agoYes - Cygwin is essentially the GNU tools recompiled as Win32 apps using a helper library for shared code etc. Windows Subsystem for Linux (WSL) which underpins Ubuntu on Windows is new Windows kernel infrastructure that exposes a LINUX-compatible syscall API layer to userland and a loader that binds the two. This means you can run real, native, unmodified Linux command-line tools directly on Windows.
- Delmania 11y agoCygwin translates calls to Windows via cygwin.dll. It works well for the most part, but in some corner cases, it doesn't work so well.
- legohead 11y agoIt sounds cool, but even though his remarks are clear, I'm still confused! I got a Mac primarily because of its linux side, but it is actually Linux. This is still Windows, but with a Linux "side" to it? If I apt-get install redis, do I make it startup like I would in linux, or do I use windows services? In the screenshot there's a /mnt directory, is that behaving the same as it does in linux? This is so confusing... but if it's legit, then I would actually look at switching back to windows.
- umanwizard 11y ago> I got a Mac primarily because of its linux side, but it is actually Linux. No part of Mac OS comes from Linux at all. Also, most of the standard tools are from BSD, not GNU. Maybe you meant "it's a UNIX-like system" but those predate Linux by 30 years or so, and at any rate Windows + Cygwin was already a UNIX-like system to a similar extent, so that's not really relevant to what was accomplished here.
- nathos 11y agoTo be more accurate, your Mac isn't Linux, it's BSD. Luckily that *NIX underpinning is often enough to make it a solid development platform even when deploying to Linux.
- umanwizard 11y agoIt's not really BSD either; it's a mix of a bunch of stuff. The kernel XNU is a hybrid between Mach and BSD. I think there are also a few GNU utilities in the base system but I could be wrong about that (?)
- gpvos 11y ago$ uname Darwin $ /usr/bin/cmp --version cmp (GNU diffutils) 2.8.1 [...]
- umanwizard 11y agoRight! I though there was still some GNU stuff floating around ;). Thanks for the example.
- reidrac 11y agoMSYS is not Cygwin and IMHO is way better. Yes, is not Linux, but is a native binary without emulation (translation?) layer. It's been around for ages, before I did cross-compiling from Linux to Windows, that's what I used in Windows. http://www.mingw.org/wiki/msys http://www.mingw.org/wiki/msys
- JonathonW 11y agoMSYS and MSYS2 actually are Cygwin-- the original MSYS being a (horribly out of date) fork of Cygwin that never really pulled much from upstream, and MSYS2 attempting to track upstream Cygwin more closely. You're getting confused with MinGW, which uses MSYS to build native Windows executables. They need MSYS (as a Cygwin-derived emulation layer) because tools like GCC or Bash expect the system to support POSIX APIs and have POSIX semantics-- for example, Windows has no equivalent to a POSIX fork() call. The code you're compiling under MinGW has no MSYS or Cygwin dependencies, but the compiler and tools themselves (gcc, bash, the linker, etc.) do.
- reidrac 11y agoMSYS (as part of MinGW project) doesn't use Cygwin AFAIK; with the licensing implications that it has, because Windows programs written with Cygwin run on top of a copylefted compatibility DLL that must be distributed with the program, along with the program's source code (quoting Wikipedia). In fact the binaries, that are compiled with MinGW, link with MSVCRT by default (Microsoft Visual C Run-Time DLL). So no compatibility layer, and they don't rely on Cygwin.
- gpvos 11y agoPlease distinguish carefully between MSYS and MinGW. MSYS (or MSYS2) programs runs on top of a copylefted compatibility DLL that is suspiciously similar to Cygwin. They must be GPL-compatible. MinGW programs link with MSVCRT. They are compiled by GCC toolchain programs, most of which are MSYS programs.
- vram22 11y ago>MSYS and MSYS2 actually are Cygwin Not the person you're replying to, but interesting ... >tools like GCC or Bash expect the system to support POSIX APIs and have POSIX semantics-- for example, Windows has no equivalent to a POSIX fork() call. So do Cygwin and/or MSYS emulate the fork() call on Windows? and if so, do you have any idea how that is done? Just interested, since I have a Unix background - not at deep OS level, but at app level and also at the level of the interface between apps and the OS (using system calls, etc.).
- bitwize 11y agoNo. It may be Ubuntu, but it's not Linux. It isn't Linux, anymore than running a Linux userland on NetBSD's Linux "kernel personality" is Linux.
- jhall1468 11y agoThat's being pedantic, honestly. Yes, technically Linux is only the kernel and technically running the Ubuntu run-time on a different kernel isn't running Linux. However, "Linux" is almost always a reference to GNU tools and the Linux Kernel. It may not be semantically accurate, but take that up with the same people that made literally mean both itself and its opposite.
- bitwize 11y agoThat's being pedantic, honestly. Let's try the opposite. Say someone got Wine working to the point where it was very nearly, perfectly indistiguishable from Windows and they put up a blog post saying "Everything works just as it should under Windows, because it is Windows." Microsoft's lawyers would come around with a C&D, and calling them pedants wouldn't invalidate their case. He could have said "it's just like Linux, right down to the kernel interface" or "Everything works just like Ubuntu, because the userland is Ubuntu". Succinct and correct. Precision matters.
- bitcrazed 11y agoYour points are fair, but color with the fact that the Windows Subsystem for Linux (WSL) is build to be distro-agnostic. We picked Ubuntu in this first version due to its popularity with developers, but there are few technical reasons (other than us fully and accurately implementing the necessary syscalls) why it shouldn't support other distro's userland environments in the future. Knowing this, what should we call it? Windows Subsystem for Running POSIX + Linux Syscall API Compatible Userland Tools? WSRPLSACUMT? :) I'm genuinely interested on what you all feel would be a good way to think about naming moving forward.
- 11y ago
- vram22 11y agoThere was another choice like Cygwin, though not as comprehensive - UWin - by David Korn, creator of the Korn shell (ksh): https://en.wikipedia.org/wiki/UWIN https://en.wikipedia.org/wiki/UWIN I've used it some on Windows earlier, and it worked pretty well. Might still available if anyone wants to try it. The only small issue I had was that the process to download it from the (AT&T) web site was slightly involved, for no good reason, as far as I could see. But not difficult.
- jupiter2 11y agoGave this a long look and I couldn't possibly do anything on a Windows Machine in its' current state. Linux isn't just about running apps - there's a philosophy behind the system. Users first! As long as Microsoft continues to disrespect the rights of users in regard to privacy, data-collection, data-sharing with unnamed sources, tracking, uncontrollable OS operations (updates, etc) - I will never go near it. I expect some flack for my position... don't care. I find it especially offensive that ex-open source and ex-Linux users (working for Microsoft) have the audacity to come on here and try to sell this as a 'Linux on Windows' system when most of what makes Linux special (respect for the user) has been stripped away. It's like giving a man who is dying of thirst sea water. Most comments here appear to be positive and that's fine... whatever. Please don't sell your souls and the future of software technology for ease of use and abusive business practices. /rant
- rkda 11y ago"Embrace, extend, extinguish."