Scott Hanselman

Ubuntu now in the Windows Store: Updates to Linux on Windows 10 and Important Tips

July 11, 2017 Comment on this post [15] Posted in Linux | Win10
Sponsored By

I noticed this blog post about Ubuntu over at the Microsoft Command Line blog. Ubuntu is now available from the Windows Store for builds of Windows over 16215.

image

You can run "Winver" to see your build number of Windows. If you run Windows 10 you can certainly sign up for the Windows Insiders builds, or you can wait a few months until these features make their way to the mainstream. I've been running Windows 10 Insiders "Fast ring" for a while with a few issues but nothing blocking.

The addition of Ubuntu to the Windows Store may initially seem confusing or even a little bizarre. However, given a minute to understand the larger architecture it make a lot of sense. However, for those of us who have been beta-testing these features, the move to the Windows Store will require some manual steps in order for you to reap the benefits.

Here's how I see it.

  • For the early betas of the Windows Subsystem for Linux you type bash from anywhere and it runs Ubuntu on Windows.
  • Ubuntu on Windows hides its filesystem in C:\Users\scott\AppData\Local\somethingetcetc and you shouldn't go there or touch it.
  • By moving the tar files and Linux distro installation into the store, that allows us users to use the Store's CDN (Content Distrubution Network) to get Distros quickly and easily. 
    • Just turn on the feature and REBOOT
      Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

then hit the store to get the binaries!

Ok, now this is where and why it gets interesting.

Soon (later this month I'm told) we will be able to have n number of native Linux distros on our Windows 10 machines at one time. You can install as many as you like from the store. No VMs, just fast Linux...on Windows!

There is a utility for the Windows Subsystem for Linux called "wslconfig" that Windows 10 has.

C:\>wslconfig
Performs administrative operations on Windows Subsystem for Linux

Usage:
/l, /list [/all] - Lists registered distributions.
/all - Optionally list all distributions, including distributions that
are currently being installed or uninstalled.
/s, /setdefault <DistributionName> - Sets the specified distribution as the default.
/u, /unregister <DistributionName> - Unregisters a distribution.

C:\WINDOWS\system32>wslconfig /l
Windows Subsystem for Linux Distributions:
Ubuntu (Default) Fedora
OpenSUSE

At this point when I type "bash" at the regular Windows command prompt or PowerShell I will be launching my default Linux. I can also just type "Ubuntu" or "Fedora," etc to get a specific one.

If I wanted to test my Linux code (.NET, node, go, ruby, whatever) I could script it from Windows and run my tests on n number of distros. Slick for developers.

TODOs if you have WSL and Bash from earlier betas

If you already have "bash" on your Windows 10 machine and want to move to the "many distros" you'll just install the Ubuntu distro from the store and then move your distro customizations out of the "legacy/beta bash" over to the "new train but beta although getting closer to release WSL." I copied my ~/ folder over to /mnt/c/Users/Scott/Desktop/WSLBackup, then opened Ubuntu and copied my .rc files and whatnot back in. Then I removed my original bash with lxrun /uninstall. Once I've done that, my distro are managed by the store and I can have as many as I like. Other than customizations, it's really easy (like, it's not a big deal and it's fast) to add or remove Linuxes on Windows 10 so fear not. Backup your stuff and this will be a 10 min operation, plus whatever apt-get installs you need to redo. Everything else is the same and you'll still want to continue storing and sharing files via /mnt/c.

NOTE: I did a YouTube video called Editing code and files on Windows Subsystem for Linux on Windows 10 that I'd love if you checked out and shared on social media!

Enjoy!


Sponsor: Seq is simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Version 4 adds integrated dashboards and alerts - check it out!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
July 11, 2017 18:24
> There is a utility for the Windows Subsystem for Linux called "wslconfig" that Windows 10 has.

Not Creators Update. Or at least it's not part of the %PATH% search variable, and "dir wslconfig.* /s" doesn't find it either.

I do have a very recent Insider release running in a VM, and I was going check on that, but it seems to be stuck "Working on updates 33%" right now - which is not good, as I had let it grab the latest update over 12 hours ago (as I'm writing this).
July 11, 2017 19:50
@Dandy72, You're right, you aren't missing anything, it's not in the Creators Update. The first line of the article (easy to miss, it appears above the first large image) states that: "Ubuntu is now available from the Windows Store for builds of Windows over 16215."
July 11, 2017 20:14
Does the store version still put everything in C: with no support for moving it? As long as that's the way it is, I'll never be able to use it (small C: on SSD). Hopefully that's been addressed.
July 11, 2017 20:39
Scott, how did you launch VS Code from Bash? I am using the Bash for Windows beta from the Anniversary Update and when I try to run
code .
I get
command not found: code
When I try to run
/mnt/c/Program\ Files\ \(x86\)/Microsoft\ VS\ Code/Code.exe .
I get this error
exec format error: /mnt/c/Program Files (x86)/Microsoft VS Code/Code.exe

Unfortunately, I cannot install an Insider build as this is my work machine and I'd like to stay on Stable.
July 11, 2017 22:38
(N00bs here) It is not clear to me. Will Gnome or another graphic interface be available in this environment ?
July 11, 2017 22:52
Hey Scott!

Thanks for the article!

Have a question, if I may. To use the Ubuntu app from VSCode, do we still use the:
"
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
"

or is there another way?

Thanks again!
July 12, 2017 0:50
CarlD - Yes, you can go to "Default Save Locations" and tell the Store that you want store apps and/or games on other drives, and it should go over there. So *you* should personally benefit from this change.

Michael - Yes, bash will start the default linux, or you can use "Ubuntu" or "Fedora" for those.

Mark - The ability to run Windows exes happened in a later update then you have.
July 12, 2017 0:51
JonT - There are hacks that make that possible, but totally not supported. This Linux is meant for developers in Text Mode.
July 12, 2017 5:20
Just a quick note to add that if you do NOT uninstall the WSL you had installed under earlier builds, you can still use wslconfig to switch between versions just fine. The old one shows up as 'Legacy'. This is pretty cool! Hopefully we can start adding new distros to play with soon...
July 13, 2017 4:09
@NuAngel, I didn't "miss" the first line; to me, it just didn't infer that wslconfig was new starting with that build, as there's no mention of it until a few paragraphs later.
July 14, 2017 14:56
It has actually been technically on the store since the day the Windows Subsystem for Linux came out – when you enabled it, it explicitly told you it was downloading it from the Windows Store.

What’s new here is that it now has a proper Windows Store page.
July 14, 2017 15:17
With XMing you can use graphical apps from WSL, here is example of WinForms on Mono called from pythonnet:

http://nbviewer.jupyter.org/gist/denfromufa/1fdb51fc58663c2fb058f0860cb03768#demo-apps
July 16, 2017 14:54
What is the use case of this? Can you give some more information on this? I'm confused. Why would we want to have an OS in an OS app store?
July 19, 2017 1:30
@Tarik - Ubuntu on their Store is not an OS; it is a collection of Ubuntu resources and binaries that run on Windows Subsystem for Linux: Bash and an ABI shim between Windows and Linux ELF64 system calls.
July 24, 2017 7:35
Now just hire a designer and make the UI look like it wasn't created by Microsoft rejects.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.