topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 9:33 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Run Bash on Ubuntu on Windows  (Read 8243 times)

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,747
    • View Profile
    • Read more about this member.
    • Donate to Member
Run Bash on Ubuntu on Windows
« on: April 01, 2016, 03:52 PM »
You can now run Bash scripts, Linux command-line tools like sed, awk, grep, and you can even try Linux-first tools like Ruby, Git, Python, etc. directly on Windows. You can also access your Windows filesystem from within Bash allowing you to work on the same set of files using your preferred Windows tools or Linux command-line tools

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #1 on: April 01, 2016, 06:28 PM »
Thanks!  Good news!

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #2 on: April 01, 2016, 08:12 PM »
Just keep in mind that this sounds like it's running a lightweight VM of some sort - the bash window cannot run or interact with Windows programs.  The programs you run in the bash window are actually linux binaries, not something that runs on an emulation layer like Cygwin or that run in the old Posix subsystem (I think MS has removed that from Windows some time back).

That's not to say that it won't be useful, just that it might not act the way some people might think it would.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #3 on: April 01, 2016, 09:08 PM »
* Edvard drops in with his obligatory link to gnuwin32 tools

Nope, it's not an environment like Cygwin, not in a Ubuntu VM, it's actual binaries that behave just like any command-line tools, it's been around for a while, and still (relatively) actively developed.  I have no idea why Microsoft took the route it did when these tools are readily available.
http://gnuwin32.sourceforge.net/

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #4 on: April 01, 2016, 09:47 PM »
Probably because they wanted to integrate it with powershell and have control of that integration.

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #5 on: April 02, 2016, 08:01 AM »
Using Bash, etc. directly in Windows with Windows was already possible in 2009, though portable Ubuntu only worked in 32-bit editions of Windows.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #6 on: April 04, 2016, 04:41 PM »
Just keep in mind that this sounds like it's running a lightweight VM of some sort - the bash window cannot run or interact with Windows programs.
I wonder what the technical reason behind this is - as far as I understand their approach, this is more of a syscall translation thingamajig than a lightweight VM like CoLinux. There's probably still some kernel object translation going on as well (like file handles) which might complicate windows<>linux communication, and probably some security concerns as well.

Would be interesting with some more implementation details, as well as a comparison to existing stuff like CoLinux.

I have no idea why Microsoft took the route it did when these tools are readily available.
Perhaps because it might be an easier route to running stuff than porting? Perhaps to be able to support closed-source linux binaries?

I personally can't think of any use cases where this would be better than using the MinGW binaries, but it's cool tech :)
- carpe noctem

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #7 on: April 05, 2016, 10:17 AM »
Just keep in mind that this sounds like it's running a lightweight VM of some sort - the bash window cannot run or interact with Windows programs.
I wonder what the technical reason behind this is - as far as I understand their approach, this is more of a syscall translation thingamajig than a lightweight VM like CoLinux. There's probably still some kernel object translation going on as well (like file handles) which might complicate windows<>linux communication, and probably some security concerns as well.

From this article: (emphasis mine)
http://www.zdnet.com...indows-how-it-works/
How the heck did they do that? First, Ubuntu parent company Canonical and Microsoft will be running it not on Linux in a container or virtual machine (VM), but on Windows native libraries and programs: Windows Subsystem for Linux (WSL).

WSL was quietly placed in the Windows 10 (build 14251) code in late January. A few days later, a developer worked out that two new subsystems lxcore.sys and lxss.sys, could be bridges for Windows programmers to develop Linux applications. The developer was half right.
...
"A team of sharp developers at Microsoft has been hard at work adapting some Microsoft research technology to basically perform real time translation of Linux syscalls into Windows OS syscalls. Linux geeks can think of it sort of the inverse of "WINE" -- Ubuntu binaries running natively in Windows. Microsoft calls it a "Windows Subsystem for Linux".

Recall that Wine is a recursive acronym for "Wine Is Not an Emulator", so no, it's not a VM sort of thingy, but definitely a translation layer.  I was wondering why they targeted specifically Ubuntu, I mean you gotta start somewhere, but...  :huh:
Looks like the article mentions that it's to provide maximum compatibility with their Azure cloud services, upon which the most popular Linux distribution is Ubuntu.
« Last Edit: April 05, 2016, 10:22 AM by Edvard »

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: Run Bash on Ubuntu on Windows
« Reply #8 on: April 05, 2016, 01:26 PM »
Well, that's interesting.  If it's just a translation of syscalls handled by those two driver files, this should be *very* lightweight.  I currently use a Mint VM to do some Linux-based things (including Android builds - which are pretty resource intensive).  This might be a way to do those things with some better performance.

I've been avoiding upgrading to Win10 from Win7 because of a combination of not seeing much benefit and hearing too much about invasive behavior by the system.  This might be enough for me to reconsider the free Win10 upgrade.  I wonder if there's any hope of a hack that gets this support onto Win7?