The Flat Earth Society

Other Discussion Boards => Technology & Information => Topic started by: xasop on February 15, 2017, 08:32:08 AM

Title: Windows Subsystem for Linux
Post by: xasop on February 15, 2017, 08:32:08 AM
Let me start out by saying that the name "Windows Subsystem for Linux" is terribly misleading. It is not a subsystem for Linux at all, but a subsystem for Windows. It allows running unmodified Linux applications on Windows 10.

Now that that's out of the way, this looks very promising. Microsoft have made this feature available following an announcement (https://blogs.msdn.microsoft.com/wsl/2016/04/22/windows-subsystem-for-linux-overview/) in April 2016. Windows NT has always been designed to allow the development of different subsystems for executing different kinds of applications, but this is the first time it's been taken to the point of allowing unmodified Linux binaries to run directly on the NT kernel.

As someone who boots into Windows only to play a couple of games, I find the continual reboot cycle between Windows and operating systems that let me actually do useful work very tedious. I was curious if this subsystem was featureful enough to allow me to use a Windows system as if it were Linux, but with the ability to launch Windows-only applications as desired.

It turns out that someone has successfully gotten my window manager to run on Windows (https://brianketelsen.com/blog/i3-windows/), complete with all the normal applications you'd expect from a Linux desktop. The main caveat there appears to be that i3 is confined to a window within the Windows desktop, rather than taking over the role of the Windows shell, but it's a start.

What I would really like is for i3 to manage the desktop itself and also be able to display Windows applications within X. That might be a bit much to ask, but this is intriguing enough that I'm going to give it a try and report back here.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 15, 2017, 05:24:19 PM
This actually works really well. I'm impressed.

I did spend a little time fucking around with Xming, which has the really annoying behaviour of randomly not starting a font server properly sometimes. I'm now using VcXsrv instead, which is working flawlessly. I wrote a batch script to start everything up on login, and now I can't believe it's not Linux!

There are a couple of caveats, though.

First, I tried upgrading from Ubuntu 14.04 to the latest Debian. The upgrade worked, but the Linux emulation in Windows doesn't support all the features expected by a newer distribution, so some things just don't work right. I've reinstalled on Ubuntu 14.04 now, with the i3 package repo (http://i3wm.org/docs/repositories.html) and this backports PPA (https://launchpad.net/~jonathonf/+archive/ubuntu/backports) so I get modern versions of i3 and HexChat, and that seems to work ok.

Second, some programs simply don't work. Iridium is one (and probably also Chromium/Chrome, though I haven't tested those), because the Linux sandboxing mechanism isn't implemented. i3status from the i3 package repo segfaults, but the (older) version from the Ubuntu repo works fine.

Third, I had to do some messing around to get i3 set up the way I like it, since by default the Windows key is intercepted by Windows and brings up the Start menu. By carefully remapping things around a bit in Windows, I now have that functioning as a meta key in i3, with F12 bringing up the Start menu if I need it.

All things considered, I can now use my Windows system as though it were Linux, with very few signs that it's not. The main thing I'm still a little irked about is not being able to use Iridium, as I much prefer that to Firefox, but any browser will browse.
Title: Re: Windows Subsystem for Linux
Post by: Pongo on February 15, 2017, 05:31:55 PM
Was all this effort made so that you can get scammed into buying space polygons?
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 15, 2017, 06:10:37 PM
Confirmed that Chromium also does not work. Sad!

Also, my usual behaviour with i3 is for WinKey+L to run xlock, which locks the machine. Since that would only lock the X server here, which can easily be escaped by Alt+Tabbing back to Windows, I just configured AutoHotKey to make that key combination lock the computer in Windows itself. Everything works as intended, even from within Linux.
Title: Re: Windows Subsystem for Linux
Post by: Particle Person on February 15, 2017, 07:19:11 PM
How's that download coming
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 15, 2017, 09:56:42 PM
The main thing I'm still a little irked about is not being able to use Iridium, as I much prefer that to Firefox, but any browser will browse.
Perhaps I'm missing something, but is there any reason why you wouldn't just use the Windows build of Iridium?
Title: Re: Windows Subsystem for Linux
Post by: juner on February 15, 2017, 11:00:44 PM
"Windows Subsystem for Linux" is terribly misleading. It is not a subsystem for Linux at all, but a subsystem for Windows.

>"terribly misleading"
>"not a subsystem for Linux at all, but a subsystem for Windows."
>literally called Windows Subsystem...
>tfw


First, I tried upgrading from Ubuntu 14.04 to the latest Debian. The upgrade worked, but the Linux emulation in Windows doesn't support all the features expected by a newer distribution, so some things just don't work right. I've reinstalled on Ubuntu 14.04 now...

Did you try Ubuntu 16.04? It can be installed using the 'lxrun' command from Windows. Not sure if it would yield any different results for what you are trying to do.


Perhaps I'm missing something, but is there any reason why you wouldn't just use the Windows build of Iridium?

Do you even Parsifal bro?
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 16, 2017, 12:22:47 AM
The main thing I'm still a little irked about is not being able to use Iridium, as I much prefer that to Firefox, but any browser will browse.
Perhaps I'm missing something, but is there any reason why you wouldn't just use the Windows build of Iridium?

I cannot use Windows applications within my Linux window manager (only vice versa, which would lose me all the benefits of i3), so that would require continually switching between Linux and Windows desktops. Using Firefox is less inconvenient.

Edit: It looks like SeamlessRDP may offer a solution. I don't know what kind of performance penalty I can expect, though.

"Windows Subsystem for Linux" is terribly misleading. It is not a subsystem for Linux at all, but a subsystem for Windows.

>"terribly misleading"
>"not a subsystem for Linux at all, but a subsystem for Windows."
>literally called Windows Subsystem...
>tfw

That name would make perfect sense if it did the opposite of what it actually does. It should be called "Linux Subsystem for Windows".

First, I tried upgrading from Ubuntu 14.04 to the latest Debian. The upgrade worked, but the Linux emulation in Windows doesn't support all the features expected by a newer distribution, so some things just don't work right. I've reinstalled on Ubuntu 14.04 now...

Did you try Ubuntu 16.04? It can be installed using the 'lxrun' command from Windows. Not sure if it would yield any different results for what you are trying to do.

I wasn't aware you could do that. Microsoft's installation instructions just walk you through installing 14.04. That sounds a lot better.

Edit: It turns out doing that would require updating my version of Windows. While I don't mind doing so, Windows is incapable of installing updates (it inevitably gets to 99% done and then says "we couldn't apply changes" and undoes everything), so I have no way of getting 16.04.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 16, 2017, 01:48:35 AM
I have signed up to the Windows Insider Programme to get the Ubuntu 16.04 goodness. Let's see if that update will install.
Title: Re: Windows Subsystem for Linux
Post by: juner on February 16, 2017, 04:14:06 AM
I have signed up to the Windows Insider Programme...

This is the darkest timeline.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 16, 2017, 07:31:58 AM
So as it turns out, my Windows system not only won't let me select a "ring" for the Insider Program, but is still failing to apply updates even after nuking all the previously-downloaded updates and trying again. I'm also finding that the "Subsystem for Linux" [sic] gets a little unstable running for more than an hour or so at a time, with odd crashes and freezes.

I'm going to try a fresh new install of the Insider preview version of Windows this weekend, and will then set up Ubuntu 16.04 from scratch. That will also give me the opportunity to document the process in a blog post.
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 16, 2017, 01:17:46 PM
Let's see if that update will install.
Windows Update is a bag of dicks. Sometimes it fails horrendously and won't unfail until you've cleared its cache (http://ccm.net/faq/2471-how-to-purge-the-windows-update-cache). I don't know if that's what you were referring to when you said you "nuked all the previously-downloaded updates", but if not, that link is worth trying.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 16, 2017, 01:30:03 PM
Let's see if that update will install.
Windows Update is a bag of dicks. Sometimes it fails horrendously and won't unfail until you've cleared its cache (http://ccm.net/faq/2471-how-to-purge-the-windows-update-cache). I don't know if that's what you were referring to when you said you "nuked all the previously-downloaded updates", but if not, that link is worth trying.

Yes, that is what I tried.

I'm wondering if Windows is throwing a hissy fit because I replaced its MBR with GRUB.
Title: Re: Windows Subsystem for Linux
Post by: Lord Dave on February 16, 2017, 04:32:48 PM
So as it turns out, my Windows system not only won't let me select a "ring" for the Insider Program, but is still failing to apply updates even after nuking all the previously-downloaded updates and trying again. I'm also finding that the "Subsystem for Linux" [sic] gets a little unstable running for more than an hour or so at a time, with odd crashes and freezes.

I'm going to try a fresh new install of the Insider preview version of Windows this weekend, and will then set up Ubuntu 16.04 from scratch. That will also give me the opportunity to document the process in a blog post.
Yeah, I had that too.

Did you install the anniversary version?  Cause apparently it sometimes fails to install that and thus any update after will auto-fail.
I had to backtrack to the last update, manually download the anniversary update, apply that, then apply the cumulative update.  Manually.
Title: Re: Windows Subsystem for Linux
Post by: Fortuna on February 17, 2017, 07:13:00 AM
I have signed up to the Windows Insider Programme...

This is the darkest timeline.

For his computer and the free software movement.
https://www.youtube.com/watch?v=79icKrdgMzI

Title: Re: Windows Subsystem for Linux
Post by: xasop on February 18, 2017, 04:17:14 PM
After some amount of fucking around getting a usable installation medium, I am now installing Windows 10 Insider Preview Build 15002 from scratch. This time I'm going to take note of all the steps involved in setting up Ubuntu so I can write a blog post or something about it.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 18, 2017, 05:32:55 PM
And after all that, great success:

Code: [Select]
steven@DESKTOP-08HTROC:/mnt/c/Users/steve$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial
Title: Re: Windows Subsystem for Linux
Post by: juner on February 18, 2017, 07:16:37 PM
You're welcome for the 16.04 advice.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 18, 2017, 07:25:41 PM
You're welcome for the 16.04 advice.

Well the test release of Windows I had to install to get 16.04 has now broken to the point that I can't even bring up the Start menu, so don't take credit for everything just yet.
Title: Windows Subsystem for Linux
Post by: juner on February 18, 2017, 07:45:15 PM
You're welcome for the 16.04 advice.

Well the test release of Windows I had to install to get 16.04 has now broken to the point that I can't even bring up the Start menu, so don't take credit for everything just yet.

Start menu broken... welcome to Windows 10. An incredibly common occurrence.

Make sure the firewall service is running and then run from an elevated powershell prompt:
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

EDIT- added the thing which I think will break bash on ubuntu on windows anyway.

Welcome to Windows
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 18, 2017, 08:12:46 PM
Make sure the firewall service is running and then run from an elevated powershell prompt:
Get-AppXPackage -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Already tried that, no luck.

It's not only the Start Menu that's broken, but the entire taskbar. The clock doesn't even update, it just keeps showing the time that explorer.exe was started at.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 18, 2017, 08:24:22 PM
After going through a series of futile troubleshooting steps on IRC, I have determined that things are absolutely fucked and it's best to just reinstall. It might help if I knew what went wrong so I could avoid it next time, but oh well.
Title: Re: Windows Subsystem for Linux
Post by: Lord Dave on February 19, 2017, 07:10:15 AM
After going through a series of futile troubleshooting steps on IRC, I have determined that things are absolutely fucked and it's best to just reinstall. It might help if I knew what went wrong so I could avoid it next time, but oh well.

Can you get into task manager, run the admin log, and see what errors pop up?
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 19, 2017, 08:33:59 PM
So after a lot of messing around, I have established that the problem is caused by the driver for my graphics card. The card is old enough that AMD no longer supports it, and neither version of the driver I can download from AMD's website works, so I'm going to guess there is some incompatibility between that version and this Insider Preview release.

I will try a newer build (I was going to stick to the Slow ring, but if the current Slow build is broken I might as well go Fast), but if that still doesn't work I'll reinstall plain old Windows 10.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 25, 2017, 01:08:00 PM
Following an upgrade to build 15025, my graphics driver works properly again. Somewhat annoyingly, though, Windows throws a tantrum and refuses to boot if it sees that its precious MBR has been switched out for a different bootloader, so I now have to use the Windows bootloader instead of GRUB to boot into OpenBSD and Debian.

At least I now have a Windows system with a modern Linux subsystem that actually works, though. Progress!
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 25, 2017, 02:38:06 PM
Posting from Firefox running on Ubuntu 16.04 running on Windows. Feels Good Man™.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 25, 2017, 03:42:22 PM
It turns out Windows Subsystem for Linux uses a default umask of 000. Not too impressed with that choice.
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 25, 2017, 04:30:41 PM
uses a default umask of 000
Surely a binary file of 000 wouldn't produce a meaningful program?
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 26, 2017, 01:01:33 AM
uses a default umask of 000
Surely a binary file of 000 wouldn't produce a meaningful program?

(http://img.sjm.so/confused)
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 26, 2017, 01:27:07 AM
(http://img.sjm.so/confused)
You said you've experienced a umask (https://en.wikipedia.org/wiki/Umask) of 000. That doesn't sound like it would work.
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 26, 2017, 02:06:30 AM
You said you've experienced a umask (https://en.wikipedia.org/wiki/Umask) of 000. That doesn't sound like it would work.

It works perfectly well, it's just a terrible idea.
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 26, 2017, 02:34:42 AM
It works perfectly well, it's just a terrible idea.
p. sure a function that wouldn't even meaningfully execute can't be reasonably considered to "work"
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 26, 2017, 03:34:36 AM
program
function

Nice 180
Title: Re: Windows Subsystem for Linux
Post by: xasop on February 26, 2017, 06:17:38 AM
I now have audio working. It was a bit of a wrangle, but the process is largely documented in this blog post (https://parseq.co.uk/wordpress/archives/setting-up-pulseaudio-1-0-beta-for-windows) and this bug report (https://github.com/Microsoft/BashOnWindows/issues/486).
Title: Re: Windows Subsystem for Linux
Post by: Pete Svarrior on February 26, 2017, 10:42:00 AM
program
function

Nice 180
Are you suggesting functions can exist without using any program memory? Because that'd be silly!!