NOTE: Since I published the video the official way to now install docker for WSL 2 is to use "Docker Desktop for Windows" rather than downloading the script via curl. See docs.docker.com/docker-for-windows/wsl/
In Microsoft presentation of WSL2 they showed a different conceptual image of how the whole thing is structured. According to their presentation both linux and windows kernels work on top of hypervisor and not like in your picture where linux runs on top of windows kernel. I might got that wrong, but as far as I understood linux in wsl2 is a normal linux except that resources are dynamically allocated by hypervisor the same way they do it on the cloud and there is a communication bridge in application layer between windows and linux.
You are correct, when Hyper-v is enabled, windows runs on top of Hyper-v the same way VMs like the wsl2 and other standard Hyper-v VMs. This is the reason why virtualbox and other virtualization tools does not work when Hyper-v is enabled.
Great explanation!! I was having issues with someone elses install video and yours filled in all the problem areas I had. Luckily I did the docker desktop for windows install instead of your script. Only after the fact did I see the pinned comment stating this. Thanks a ton!!!
Warning, if installing on Windows Server 2019, you need to be on build version 1909 which is not generally available even as an update (unless you're on Core edition?). 1809 is the latest you'll get on Windows Server 2019 Standard via Windows update. A lot of online videos and guides fail to mention the build number. You'll be able to install the WSL and Windows Image features but you will not be able to use the WSL commands. You'll get stuck and wishing people told you about this basic stuff!
I love Microsoft is doing it. Now, it all comes down to a matter of preference of what system to use. If one is a gamer and a programmer, using WSL is just more convenient.
Thank you very much! Your explanation was very helpful to me. I did manage to install WSL2 in an intel machine with the command wsl set default version 2 on PowerShell. I did not have the first version. It seemed that everything was going well but when I tried to start Ubuntu I got the same error message. In my case I did have to enable the virtualization in the BIOS and then uninstall and reinstall Ubuntu and that solved the problem.
If, when you try to do the 'wsl -l -v' command, and you get an usage screen - it means that your version of Windows does not support wsl2 - yet. I had tried to use windows insider slow track - but it still would not do wsl -v... I had to upgrade to Windows insider Fast track to get the latest version of Windows. Now when I do wsl -l -v I get a listing of my Ubuntu and it's version 1.
Yes. I'd like to add that many enterprise versions of Windows lag behind, so it may take several months before you could try if you're using Enterprise versions
Good stuff. I think Windows will eventually become a hyper-visor itself one day (type 1 [hardware based]). Problem is that it's not coming into fruition fast enough for my tastes. XBox, Windows and other O.S.s will all be run in virtualized environments using a Windows/Microsoft type 1 hyper-visor VM manager - it will be awesome. System crashes could be managed without having to hard reset the system thus debugging could be far more powerful with real time trace & dump that was previously impossible for most. The implications are staggering in my observations. Anyway, excellent video & treatment.
If you're doing that, you're not running windows, you're running linux. If someone wanted to run linux as their main os, why would they install windows and then replace windows with linux?
Normally I prefer to use either Mac OSX or Linux however I recently got a work laptop that has some compatibility issues with ubuntu 20.04 so I opted for windows. I still believe mac > linux > windows
yes, i got some of the troubles you mentioned when upgrading to WSL2 on an AMD Ryzen. I had to go into the BIOS and enable Virtualization, among other things, but it's working fine now. Good video and really interesting to hear about the Surface Pro X havng an ARM! (man, don't i love all the wordplay you can get out of tech...)
Docker in ChromeOS would be even more Inception: container -> Linux container (If you install a Linux distro on ChromeOS it comes as a container within a VM) -> VM -> Gentoo(ChromeOS)
Gary. Interesting stuff for sure. One question. Could you describe the pros and cons of this WSL-2 setup over using a traditional Type-2 hypervisor like Virtualbox (beyond the obvious fact that Vbox can so a Linux guest with desktop GUI) . Thanks.
John Edge The main use case of WSL for me is clicking ubuntu as my ssh shell or choosing it as a terminal in vs code. In each case it loads instantly without having to load a whole virtual machine explicitly. I haven’t looked into how it grabs resources but I dont dedicate 6-8GB of ram to it like I normally do with a vm either.
the primary advantage is resource allocation. A typical type-2 hypervisor has to allocate all of the memory for the 'machine' will ever use up front, and needs to do so for every guest. WSL-2 integrates allocation of machines into the operating system, so most of it can be allocated dynamically as-needed like native processes, and every machine shares some amount of common kernel state so it doesn't all need to be allocated for every single guest. So you don't need to pre-allocate gigs and gigs of memory for every guest. They share a kernel (with some resource isolation between guests), and they only consume as much memory beyond that as is required. The main con is that its linux only, and only the one kernel you have installed in wsl2 for all guests. So no BSD or plan9 or arbitrary-home-grown non-linux operating systems (or linux distributions that rely on specific sorts of early initialization to make sense). Distributions like TinyCore for instance that configure the system with kernel parameters would be pretty hard to port, and are generally outside of the intended use case. I guess it could be possible to also port other sorts of kernels, but it would be a significant effort, and this would still mean all of your guests would have to use just that.
The big Pro for WSL 2 is the tight integration to windows using their customized version of the Linux kernel. Network share, port forwarding and mounting your real drives are built-in. On the other hand, you miss out on specific configuration of the VM like in other hypervisors.
@@TLAngus1337 “Customized version of the Linux kernel” sounds like a bad idea. That’s going to be an extra support headache for them, trying to keep up with changes in the mainline kernel. How long do you think it will be before they fall irretrievably behind?
@@lawrencedoliveiro9104 i dont really worry about that. I mean, given the Effort that they Put in to build this in the first place, also with their New direction to open Source and Linux, I dont think they Will just Abandon it.
Dude...some of us are REALLY psyched on this being GA soon... heck..this ALONG SIDE Powershell 7 (7.1 soon which is LTS) make us EXTREMELY giddy ... mix that with .Net Notebooks (with Powershell) on Jupyter Notebooks ..reports, analytics, and automation for days yo
The point that it will update through Windows update is not that it is not through Linux update. The point is that it will be delivered within bound to updates of Windows itself. Look know we have to wait wsl2 only with new windows. But later we will get wsl2 updates more often. It is not that it will update Linux not wsl2
Linux on WSL2 is (understandably) text mode only, and you have to be careful not to touch Linux files from within Windows or vice-versa because of the file system incompatibilities. This video is a bit misleading regarding files - it's ok to read/view the alternate filesystems but any changes from the 'wrong' side can lead to a world of pain. The alternative to WSL/WSL2 is to repurpose your old PC as a 'real' Linux box and simply ssh to that.
ViewBothSides It’s totally fine to edit files on your windows partitions through wsl. I can edit in vim and then, in a powershell run hugo to serve the files.
@@ViewBothSides wsl2 is text mode, but linux graphics do not actually require any sort of 'local' graphics hardware or acceleration. You can run an x11 server on windows and connect to it from linux, just as you generally do on linux. Hardware access of all kinds (USB, GPU, PCI) is currently extremely limited (read non-existent) but it is planned. You cannot run accelerated graphics on x11(or wayland either, not really sure how wayland works) without some sort of GPU acceleration feature parity between the client and the server.
@@ViewBothSides And also, filesystem access is only unsafe if you are not going through the WSL network filesystem. For WSL2 this isn't really a problem, since the filesystem is inside of a VHD, and not encoded into the filesystem itself, so you cannot really get at it without going through the network filesystem layer.
I wish there was an android app Call Remote Task Manager and is the while entire windows task manager in all its functions and appearance that you run on your phone but it shows you your pcs information as well as allows you to remotely monitor your pcs usages as well as to close as well as open tasks and processes as literally as if you were doing the same on your pc. So that you can run full screen apps and still see the task manager.
Guys a serious question - if this is basicaly a VM running underneath is it being reset with each opening or Windows reboot? Also is there any other interface between VM and windows other than shared network and storage access?
Only feature I still want is for the linux kernel to have access to the GPU so I can run machine learning from the linux side of things on my single GPU (the same one windows is accessing to display my desktop)
It seems the biggest disadvantage with WSL2 vs WSL1 is that WSL2 grabs a large fixed part of your HDD, which is SSD in my case. OK, you can resize the part, but it's still no that flexible.
Does the Hyper-V implementation still cause problems running VirtualBox or VMware on the same machine? I've been running WSL1 for a while but was a bit frustrated by its limitations.
Yes. Hyperv actually technically virtualizes your current windows when you turn it on, thus causing problems for VirtualBox, VMware, or any other type 2 hypervisor.
After making the upgrade from WSL to WSL2 I'm getting some trouble running GUI. Before I was using X-ming and export Display:0 now this does not work. How had the same problem? How did you solve it?
2004? We are at 2020 now. :-) (You also want to run graphical systems in the Linux system. Like a X11 server running on MS Windows, and get Linux talking to that X11-server)
I think many people don't reaslize it, but WSL (2) is a thread towards Linux and open source. Because it only exists to prevent developers to actually use Linux for development, so that everyone stays bound to Windows.
But the stuff you develop under WSL is still Linux development, no? If an obstacle to developing for Linux is that a developer needs to switch away from Windows and onto Linux then surely WSL allows developers to increase their Linux development without having to switch away from Windows? That means that WSL increases, not decreases, Linux development.
@@GaryExplains That's what I thought at first as well. Then they sayed they would bring GUI support to WSL 2 - but not via OpenGL or Vulcan, but a propriotary DirectX implementation that relys on Windows to work. And worst of all: OpenGL apps running in gui mode will be translatet to DirectX. You've probably heard of microsoft's EEE strategy - "Embrace, Extend, Extinguish". Fist they randomly started to embrace Linux even though they litterally called it a cancer a few years back. Now they are extending it with propriotary features so that developers start to write "WSL optimized" apps - that don't work correctly on Linux since they are made for DirectX. And then they'll basically have killed Linux since many, many developers will move to WSL. I've actually read several blog posts from devs confirming just this today.
I think you have misunderstood Microsoft's announcements about GPU support for WSL. I just re-read it to be sure. For example, bringing GUI support (as in X11 support) is a different thing to offering GPU acceleration. Both were announced at Build2020 along with support for NVIDIA CUDA. From reading your comments it seems like you have mixed some things up in your mind and have come to some wrong conclusions.
Two questions 1) what about system calls (POSIX) on WSL? Do they work? If so, how do they work and how well do they work? 2) one of the limitations of WSL was that it only works on 64 bit systems and I thought it was because of the comparability layer. Does WSL2 have the same limitation? Since it uses the kernel itself it may be working on 32 bit.
WSL2? Oh boy I've been enjoying Windows Powershell and its functionalities but you can tell easily it has a lot of flaws. I hope WSL2 can fix them (I'm locked to Windows rn, I miss Linux). Edit: can you run docker and VMs without having to change Hyper-V and reboot the system? That's the worst part about windows
WSL2 is pretty much native Linux with dynamic memory that returns RAM to the host OS if it's not in use. Theres literally no reason *not* to use WSL2 if your an engineer of the computing sort... and yes, docker runs without having to reboot the system, it's a one time install and configuration.
Great, but without an Linux ARCH based distro, WSL is not really helpful for me. The currently available Ubuntu 18.04 contains waaaay to old software packages, and PPAs are a mess! I switched to Opensuse which is not so outdated, but and ARCH based distro would be a game changer, to me.
Been away from Windows for a long time. New job means I *must* use it, I can try, but I'm not sure the support desk will allow me to install this on my Windows desktop machine. I *so* wanted perl for some data munging recently, this would be so useful. Thanks for the heads-up, I had no idea MS had become enlightened.
They haven't, they are just following their interest and pretending to be friendly with linux (see for instance the exfat driver they submited to linux kernel, later to be replaced by Samsung's driver, which was better than the one created by the maker ox exfat).
@@franciscosusana2292 Fast ring? I have never had any issues. I am not really probing the edges of the 'questionably stable' parts of it though, so it isn't too surprising. The biggest annoyance is the frequency of updates, so I generally just pause them once I get to the set of features I work with. I don't really care that much about stability in general so long as it isn't completely bricking my desktop environment. I imagine if you are using newer hardware for which drivers are getting touched more frequently in the fast ring it's a different story, but I am on a pretty plane jane machine with older hardware that has stable 3rd party drivers.
@Jean-Paul Teitu II It's acceptable for my use cases (mostly development). I do not know what you mean by startup time though. The way WSL1 works, nothing is really 'started up' other than your shell when you execute `[wsl -d] distroname`. all of the initialization happens when you install the distro, and when the host system starts. The most obvious performance distinction between the two is how the disks work, so heavy disk operations will almost always be faster in WSL2.
@Jean-Paul Teitu II have you tried just starting wsl from an existing command shell? I imagine this might have nothing to do specifically with the WSL system but rather the mechanism windows uses for starting up a command shell that it uses to launch WSL from the start menu/a shortcut (maybe it runs it in powershell, i know powershell initialization is disgusting). When actually just engaging wsl directly (through an existing command shell) there is no initialization that needs to happen. You aren't really 'starting wsl' (its functionality baked into the OS), you are starting bash in the context of the existing container space.
Basically. It is their response to WINE to keep people from leaving windows. Because linux is becoming more popular, compatible with more things and easier to install.
@@MyReviews_karkan Linux market share of desktop OS has barely increased at all. gs.statcounter.com/os-market-share/desktop/worldwide WSL is just part of Microsoft's strategy under Nadella, along with things like .NET Core, Terminal, VSCode Remote Development, etc. to make developing on Windows less of a headache for developers who end up switching to Macs.
@@MyReviews_karkan lol, WSL made me leave Windows and install Ubuntu instead. So for me it's was an entry point to try Linux before I decide to go all in.
Your error about virtualising just looks like VT-x is disabled in the BIOS. This is common for most X86/X64 off the shelf hardware and most likely has nothing to do with the Surface Pro X initially. Considering the SP-X is an ARM based platform, I wonder if you get a performance hit running WSL if the virtual machine has to translate to ARM calls and vice versa or if ARM calls are already packaged in the M$ Linux kernel. It would actually be great to see a comparison against this and your intel platform.
I am sure it is something to do with that PC, rather than a general problem, however after spending a couple of hours trying to fix it and double checking the virtualization capabilities, etc, it should work, but doesn't. This will cause headaches for people since the error message is basically meaningless.
sir, I installed it and reboot my laptop, but suddenly while rebooting it made a very noisy beep sound and the screen was total dark.In order to stop that noise I shut it with by pressing the power button. I am very scared right now. Please tell me, will my Laptop be crashed ? Well, I will restart again tommorow to see what happens. If the sound doesn't stop what should I do ?... Plzzz someone help with this
I want to like wsl2 but I keep running into issues when I try to actually work with it. In the case that I have mysql installed via ubuntu wsl2. But want to use workbench to interact with my mysql db. Could I have the server running through ubuntu and workbench working with the dbs through windows? Same with mongodb and 3T.
Can you explain what's the difference b/w WSL and Linux running in docker container (Before WSL was a thing) because docker uses a VM to run linux containers I think that microsoft just microsoft just added "Docker" to windows, renamed it WSL
Part of the justification for WSL2 is to actually use linux containerization with docker on windows without a a type 2 hypervisor. This makes allocating resources for containers more dynamic, so docker on windows doesn't need to grab a huge amount of resources on the host preemptively, and can just grab what it needs to meet the needs of the containers dynamically, like it can on a native linux host. This also streamlines the integration of windows server and linux containers. Docker and microsoft have been partnered since 2014. Theres no 'in quotation idea thievery' and rebranding. They are partnered, and there is a whole hell of a lot more to wsl than 'der windoze docker amirite'
Hey Gary I have a question and this question is a bit out of this topic . Will there be a ecosystem between android and windows in future I mean a fully fledged where I can transfer files bw them.right now we can only trasfer photos from your phone app but only limited to 25 photo's.
How long till we have Androidx86 running under WSL2? I think it will be awesome to be able to actually install native Google Play Store under Windows...
@@GaryExplains at 4:28, you used curl to get docker install shellscript, I tried with this way, the docker demon can't be connected. I did some googling, turns out this way no longer supported since May, 2020. We have to install Docker for Windows installation.
@@alexhu01 Great, thanks, I will update the description. I appreciate it. However I would like to point out that your original comment is a little vague, it sounded like the whole WSL 2 video is old information whereas in fact it was just the docker part you were referring to.
Hello Everyone, Would be appreciative if anyone can answer 2 Q I have... 1. I was disappointed with my first WSL2 image that that systemd commands were removed (apparently the entire systemd architecture may have been removed) and none of the old SysVinit architecture can be found, too. So, here is something basic... How or where do you find system events, is everything that's running in a WSL2 being written to the Windows Event logs now? 2. I see that compatibility with Virtualbox and VMware running on the same machine might be resolved sometime soon. I just got a VMware update so I'll see if there is something new. The link to Virtualbox's raodmap doesn't mention WSL2 so I assume nothing new is available. Up until now, I've had to turn off everything (apps, services) related to any other virtualization to run a particular virtualization technology. You can't run different hypervisors simultaneously, only one can be used at a time. Apparently MS has provided an API for other virtualization to run on the Hyper-V hypervisor instead if their native hypervisors to resolve this incompatiblity, but details and implementation is left to the other technology. Has anyone actually done this (VMware is supposed to have this in Tech Preview schedled to be released officially sometime soon) TIA if anyone has an answer to either of these 2 issues.
hi, if a person created dev environment, created app, then suddenly windows crashed, the developer will lost everything he/she created on WSL ?? IMO in case of dual boot or a VM he/she can have all things to continue his/her efforts. Just wants to know what you or people are saying for this situation?
If a person created dev environment, created app, then suddenly Linux crashed, the developer will lost everything he/she created on Linux. What is your point?
@@GaryExplains thanks for reply, i knew it but as per my knowledge Win* is more vulnerable than Linux, so there are chances to crash more often as compare to Linux.
Ok, so I installed WSL2 manually, but the --l -v and --set-version options aren't available in my wsl.exe. Can not upgrade my Linuxes to WSL2. What did I do wrong?
The problem with wsl1 is the way they interface Linux kernel calls thought windows kernel, is a lot of work and does not support all Linux features. WSL will run the actual kernel and not a shim translating Linux to windows.
This is mainly for the web & software developer / scientific computing crowd as well as the people who want to download and use Linux / Unix tooling which if you haven't experienced it.. is *vastly* superior to any (if any?) tooling by Windows or Mac OS.
NOTE: Since I published the video the official way to now install docker for WSL 2 is to use "Docker Desktop for Windows" rather than downloading the script via curl. See docs.docker.com/docker-for-windows/wsl/
Thanks for the video! Just wanted to point out that Docker Desktop for Windows only works on Windows Pro, not home edition!
Thanks, this video was helpful anyway
wow the twist at the end really surprised me!
In Microsoft presentation of WSL2 they showed a different conceptual image of how the whole thing is structured. According to their presentation both linux and windows kernels work on top of hypervisor and not like in your picture where linux runs on top of windows kernel. I might got that wrong, but as far as I understood linux in wsl2 is a normal linux except that resources are dynamically allocated by hypervisor the same way they do it on the cloud and there is a communication bridge in application layer between windows and linux.
You are correct, when Hyper-v is enabled, windows runs on top of Hyper-v the same way VMs like the wsl2 and other standard Hyper-v VMs.
This is the reason why virtualbox and other virtualization tools does not work when Hyper-v is enabled.
@@guibirow so, when there's no hyper-v, it's like explained in video?
i dont like hyper-v. cant use vmware and virtualbox at the same time.
So from what you are saying, this is just a Hypervisor running both kernels... Something you could do previously without this, like KVM or QEMU
Rescenic just use hyper v then
they should have named the conversion layer "eniw" since its kind like wine in reverse
how about "Windows Subsystem Is Not an Emulator" WSINE
@@alnm645 that breaks the recursive joke though. maybe "WSINE Subsystem Is Not an Emulator"
@@xybersurfer maybe :thinking:
@@alnm645 Windows subsystem actually uses a virtual machine so it is an emulator
@@VictorRodriguez-zp2do they mean the first version
I must see Inception again one day.
You mean "Paprika". It predates "Inception" by four years.
@@SenileOtaku No I meant Inception
@@hermanstokbrood GRAND PIANO INTENSIFIES
can you explain the ending? i guess he was still in dream.
Great explanation!! I was having issues with someone elses install video and yours filled in all the problem areas I had. Luckily I did the docker desktop for windows install instead of your script. Only after the fact did I see the pinned comment stating this. Thanks a ton!!!
Warning, if installing on Windows Server 2019, you need to be on build version 1909 which is not generally available even as an update (unless you're on Core edition?). 1809 is the latest you'll get on Windows Server 2019 Standard via Windows update. A lot of online videos and guides fail to mention the build number. You'll be able to install the WSL and Windows Image features but you will not be able to use the WSL commands. You'll get stuck and wishing people told you about this basic stuff!
I love Microsoft is doing it. Now, it all comes down to a matter of preference of what system to use. If one is a gamer and a programmer, using WSL is just more convenient.
Sounds like me
That computer hardware reveal got me to emotionally go, “ 😳 😯 woah”
Thank you very much! Your explanation was very helpful to me. I did manage to install WSL2 in an intel machine with the command wsl set default version 2 on PowerShell. I did not have the first version. It seemed that everything was going well but when I tried to start Ubuntu I got the same error message. In my case I did have to enable the virtualization in the BIOS and then uninstall and reinstall Ubuntu and that solved the problem.
This is neat.
In other news, who's excited about 20.04 LTS?
Hell yeah (at least for the GNOME updates that it'll bring). Trying GNOME 3.36 on Fedora 32 Beta and it's great!
Run something other than Ubuntu...
Run a proper Linux Distribution.
@@rossonerodiavolo8074 wdym proper?
@@AA-zm9hk Maybe he doesn't like Snap? Or systemd? :-)
Excellent. Now I know what I'm getting in what I'm currently upgrading to. :)
If, when you try to do the 'wsl -l -v' command, and you get an usage screen - it means that your version of Windows does not support wsl2 - yet.
I had tried to use windows insider slow track - but it still would not do wsl -v... I had to upgrade to Windows insider Fast track to get the latest version of Windows. Now when I do wsl -l -v I get a listing of my Ubuntu and it's version 1.
Thank you!
Yes. I'd like to add that many enterprise versions of Windows lag behind, so it may take several months before you could try if you're using Enterprise versions
Good stuff.
I think Windows will eventually become a hyper-visor itself one day (type 1 [hardware based]). Problem is that it's not coming into fruition fast enough for my tastes. XBox, Windows and other O.S.s will all be run in virtualized environments using a Windows/Microsoft type 1 hyper-visor VM manager - it will be awesome. System crashes could be managed without having to hard reset the system thus debugging could be far more powerful with real time trace & dump that was previously impossible for most. The implications are staggering in my observations.
Anyway, excellent video & treatment.
You know what WSL 3 should be? Swapping the Windows 10 kernel for the latest Linux kernel, then allowing the installation of Cinnamon or Gnome. 🤞🌠🤞
x11 or wayland would need to come first xd
And rename to Lindows 10
@@skatcat743 Yep.
@@newstar346 You might be joking, but that name is taken: www.linux.org/threads/lindows.11236/
If you're doing that, you're not running windows, you're running linux. If someone wanted to run linux as their main os, why would they install windows and then replace windows with linux?
How about accessing hardware connected to USB ports? Can I connect to a UART/CDC device?
I had noticed the Arm64 message in the docker hello-world and wondered why that was :)
It's funny how WSL was made to try and keep developers on Windows, but for me it became an entry point for Linux Desktop.
Normally I prefer to use either Mac OSX or Linux however I recently got a work laptop that has some compatibility issues with ubuntu 20.04 so I opted for windows. I still believe mac > linux > windows
yes, i got some of the troubles you mentioned when upgrading to WSL2 on an AMD Ryzen. I had to go into the BIOS and enable Virtualization, among other things, but it's working fine now.
Good video and really interesting to hear about the Surface Pro X havng an ARM! (man, don't i love all the wordplay you can get out of tech...)
As a heavy user of Docker, I'm happy to see this being worked on :)
One thing I have on my mind though... how does it work with volumes?
I use docker on wsl2. Just make sure to use wsl version 2. Install docker and then *manually* start it using /etc/init.d/docker start.
you really have good talent in writing movie script. the ending is exceptional...
The big reveal!
Docker in ChromeOS would be even more Inception: container -> Linux container (If you install a Linux distro on ChromeOS it comes as a container within a VM) -> VM -> Gentoo(ChromeOS)
My head hurts XD
So this essentially means that the nice idea of executable compatibility was just shifted to a glorified VM? I'm not sure if that's better
Gary. Interesting stuff for sure. One question. Could you describe the pros and cons of this WSL-2 setup over using a traditional Type-2 hypervisor like Virtualbox (beyond the obvious fact that Vbox can so a Linux guest with desktop GUI) . Thanks.
John Edge The main use case of WSL for me is clicking ubuntu as my ssh shell or choosing it as a terminal in vs code. In each case it loads instantly without having to load a whole virtual machine explicitly. I haven’t looked into how it grabs resources but I dont dedicate 6-8GB of ram to it like I normally do with a vm either.
the primary advantage is resource allocation. A typical type-2 hypervisor has to allocate all of the memory for the 'machine' will ever use up front, and needs to do so for every guest. WSL-2 integrates allocation of machines into the operating system, so most of it can be allocated dynamically as-needed like native processes, and every machine shares some amount of common kernel state so it doesn't all need to be allocated for every single guest.
So you don't need to pre-allocate gigs and gigs of memory for every guest. They share a kernel (with some resource isolation between guests), and they only consume as much memory beyond that as is required.
The main con is that its linux only, and only the one kernel you have installed in wsl2 for all guests. So no BSD or plan9 or arbitrary-home-grown non-linux operating systems (or linux distributions that rely on specific sorts of early initialization to make sense). Distributions like TinyCore for instance that configure the system with kernel parameters would be pretty hard to port, and are generally outside of the intended use case.
I guess it could be possible to also port other sorts of kernels, but it would be a significant effort, and this would still mean all of your guests would have to use just that.
The big Pro for WSL 2 is the tight integration to windows using their customized version of the Linux kernel. Network share, port forwarding and mounting your real drives are built-in.
On the other hand, you miss out on specific configuration of the VM like in other hypervisors.
@@TLAngus1337 “Customized version of the Linux kernel” sounds like a bad idea. That’s going to be an extra support headache for them, trying to keep up with changes in the mainline kernel. How long do you think it will be before they fall irretrievably behind?
@@lawrencedoliveiro9104 i dont really worry about that. I mean, given the Effort that they Put in to build this in the first place, also with their New direction to open Source and Linux, I dont think they Will just Abandon it.
Great video again, Professor!
Nice 👍🏼 a video on docker would be interesting to watch.
I already have one here ruclips.net/video/nBwJm0onzeo/видео.html
@@GaryExplains thanks
I'm so used to calling WSL "wuzzle" that hearing W S L was kinda strange.
Dude...some of us are REALLY psyched on this being GA soon... heck..this ALONG SIDE Powershell 7 (7.1 soon which is LTS) make us EXTREMELY giddy ... mix that with .Net Notebooks (with Powershell) on Jupyter Notebooks ..reports, analytics, and automation for days yo
The point that it will update through Windows update is not that it is not through Linux update. The point is that it will be delivered within bound to updates of Windows itself. Look know we have to wait wsl2 only with new windows. But later we will get wsl2 updates more often. It is not that it will update Linux not wsl2
thanks, nice explanation, I update to wsl2
How well do Graphical tools and desktop environments run now? They used to run very poorly before and w/o hardware acceleration. Any changes to that?
Linux on WSL2 is (understandably) text mode only, and you have to be careful not to touch Linux files from within Windows or vice-versa because of the file system incompatibilities. This video is a bit misleading regarding files - it's ok to read/view the alternate filesystems but any changes from the 'wrong' side can lead to a world of pain. The alternative to WSL/WSL2 is to repurpose your old PC as a 'real' Linux box and simply ssh to that.
@@ViewBothSides It's not safe if you find and change them in the AppData folder, but it is safe if you access them through the wsl$ network share.
ViewBothSides It’s totally fine to edit files on your windows partitions through wsl. I can edit in vim and then, in a powershell run hugo to serve the files.
@@ViewBothSides wsl2 is text mode, but linux graphics do not actually require any sort of 'local' graphics hardware or acceleration. You can run an x11 server on windows and connect to it from linux, just as you generally do on linux. Hardware access of all kinds (USB, GPU, PCI) is currently extremely limited (read non-existent) but it is planned. You cannot run accelerated graphics on x11(or wayland either, not really sure how wayland works) without some sort of GPU acceleration feature parity between the client and the server.
@@ViewBothSides And also, filesystem access is only unsafe if you are not going through the WSL network filesystem. For WSL2 this isn't really a problem, since the filesystem is inside of a VHD, and not encoded into the filesystem itself, so you cannot really get at it without going through the network filesystem layer.
this was very helpful - but you missed a critical step "sudo service docker start". without this, the docker run command does not work
怎么解决wsl2的docker开机自启呢
You are so good. I love your clear and correct explanations of all interesting things. Thank you for your videos!
From Ubuntu 19.10 you can just install Docker with:
sudo apt install docker.io
Indeed, much cleaner and safer like that!
"From any Linux distro.."
@@hammerheadcorvette4 wrong - try at Arch Linux
I wish there was an android app Call Remote Task Manager and is the while entire windows task manager in all its functions and appearance that you run on your phone but it shows you your pcs information as well as allows you to remotely monitor your pcs usages as well as to close as well as open tasks and processes as literally as if you were doing the same on your pc. So that you can run full screen apps and still see the task manager.
Guys a serious question - if this is basicaly a VM running underneath is it being reset with each opening or Windows reboot? Also is there any other interface between VM and windows other than shared network and storage access?
*GARY!!!*
*GOOD MORNING PROFESSOR!!!*
*GOOD MORNING FELLOW CLASSMATES!!!*
MARK!
Only feature I still want is for the linux kernel to have access to the GPU so I can run machine learning from the linux side of things on my single GPU (the same one windows is accessing to display my desktop)
Where is Mark?
Oh late again. class is ending !.
Lol
*JACK BROWN!*
@@EmmanuelGoldsteinUK *CANZUK!*
@@kanumanu1656 *KANU MANU!*
It seems the biggest disadvantage with WSL2 vs WSL1 is that WSL2 grabs a large fixed part of your HDD, which is SSD in my case. OK, you can resize the part, but it's still no that flexible.
Honestly it sounds like the opposite, as it's a linux subsystem for windows.
I had the same thoughts before.
But actually it makes sense: Windows Subsystem for Linux - Windows subsystem for what purpose? For Linux.
We started calling WSL *weasel*
But there is still no access to the GPU from within WSL... :(
Maybe run native Linux
Maybe you can run a native Linux distrobution or a KVM Virtualization...
You can run an X server if you would like a GUI
Does the Hyper-V implementation still cause problems running VirtualBox or VMware on the same machine? I've been running WSL1 for a while but was a bit frustrated by its limitations.
Yes. Hyperv actually technically virtualizes your current windows when you turn it on, thus causing problems for VirtualBox, VMware, or any other type 2 hypervisor.
I got wsl1 and still be able to use vmware workstatiom nicely gor gns3 simulation, idk about vbox
maybe because wsl1 is translator and not an VM. so no problems when using virtualization software
After making the upgrade from WSL to WSL2 I'm getting some trouble running GUI. Before I was using X-ming and export Display:0 now this does not work. How had the same problem? How did you solve it?
So can a external drive be mounted in the wsl2 now?
Why microsoft not replace windows nt kernel by Linux kernel??
That will become more and more attractive over time. ;)
Microsoft loves their backwards compatibility, switching to a new kernel will throw that all out the window.
@@shny_scott They’ve broken that so many times in the past ... what’s another breakage? ;)
They already have their own linux distro, clear os. What's the point ?
@@ragilmalik clear Linux is by intel
Super Gery!
thank you
2004? We are at 2020 now. :-)
(You also want to run graphical systems in the Linux system. Like a X11 server running on MS Windows, and get Linux talking to that X11-server)
I don't get the reference to 2004, did I say 2004 by mistake somewhere? Also I published a video a while back on getting X11 working under WSL.
2004 as in April 2020.
question ... whay not just use docker instead of downloading wsl .. if both runs the same thing ?????
Good Question!! This is actually just what Docker.com wants you to do. In fact, they don't support installing docker this way anymore.
I think many people don't reaslize it, but WSL (2) is a thread towards Linux and open source. Because it only exists to prevent developers to actually use Linux for development, so that everyone stays bound to Windows.
But the stuff you develop under WSL is still Linux development, no? If an obstacle to developing for Linux is that a developer needs to switch away from Windows and onto Linux then surely WSL allows developers to increase their Linux development without having to switch away from Windows? That means that WSL increases, not decreases, Linux development.
@@GaryExplains That's what I thought at first as well. Then they sayed they would bring GUI support to WSL 2 - but not via OpenGL or Vulcan, but a propriotary DirectX implementation that relys on Windows to work. And worst of all: OpenGL apps running in gui mode will be translatet to DirectX. You've probably heard of microsoft's EEE strategy - "Embrace, Extend, Extinguish". Fist they randomly started to embrace Linux even though they litterally called it a cancer a few years back. Now they are extending it with propriotary features so that developers start to write "WSL optimized" apps - that don't work correctly on Linux since they are made for DirectX. And then they'll basically have killed Linux since many, many developers will move to WSL. I've actually read several blog posts from devs confirming just this today.
I think you have misunderstood Microsoft's announcements about GPU support for WSL. I just re-read it to be sure. For example, bringing GUI support (as in X11 support) is a different thing to offering GPU acceleration. Both were announced at Build2020 along with support for NVIDIA CUDA. From reading your comments it seems like you have mixed some things up in your mind and have come to some wrong conclusions.
I tried installing Linux apps on wsl2 but it tells me that it can’t find the Ubuntu package can you help me
Two questions
1) what about system calls (POSIX) on WSL? Do they work? If so, how do they work and how well do they work?
2) one of the limitations of WSL was that it only works on 64 bit systems and I thought it was because of the comparability layer. Does WSL2 have the same limitation? Since it uses the kernel itself it may be working on 32 bit.
2> He was running this in an ARM powered device. So, if windows NT and linux can run in your target platform, you're good to go.
I'm pretty sure the entire point of WSL is that it's posix compliant...
WSL 2 could run Unix kernel derive from Microsoft very own Unix OS called Xenix, maybe it could run POSIX
WSL2? Oh boy I've been enjoying Windows Powershell and its functionalities but you can tell easily it has a lot of flaws. I hope WSL2 can fix them (I'm locked to Windows rn, I miss Linux).
Edit: can you run docker and VMs without having to change Hyper-V and reboot the system? That's the worst part about windows
WSL2 is pretty much native Linux with dynamic memory that returns RAM to the host OS if it's not in use. Theres literally no reason *not* to use WSL2 if your an engineer of the computing sort... and yes, docker runs without having to reboot the system, it's a one time install and configuration.
Great, but without an Linux ARCH based distro, WSL is not really helpful for me. The currently available Ubuntu 18.04 contains waaaay to old software packages, and PPAs are a mess! I switched to Opensuse which is not so outdated, but and ARCH based distro would be a game changer, to me.
Been away from Windows for a long time. New job means I *must* use it, I can try, but I'm not sure the support desk will allow me to install this on my Windows desktop machine. I *so* wanted perl for some data munging recently, this would be so useful. Thanks for the heads-up, I had no idea MS had become enlightened.
They haven't, they are just following their interest and pretending to be friendly with linux (see for instance the exfat driver they submited to linux kernel, later to be replaced by Samsung's driver, which was better than the one created by the maker ox exfat).
He did mention that you has to be on the "slow ring" program of MS to use it, right?
you can use it on fast ring in earlier versions. I am on fast ring using 19041, and wsl2 is here. Its been on fast ring for quite a while.
@@homelessrobot how stable has it been for you?
@@franciscosusana2292 Fast ring? I have never had any issues. I am not really probing the edges of the 'questionably stable' parts of it though, so it isn't too surprising.
The biggest annoyance is the frequency of updates, so I generally just pause them once I get to the set of features I work with.
I don't really care that much about stability in general so long as it isn't completely bricking my desktop environment.
I imagine if you are using newer hardware for which drivers are getting touched more frequently in the fast ring it's a different story, but I am on a pretty plane jane machine with older hardware that has stable 3rd party drivers.
@Jean-Paul Teitu II It's acceptable for my use cases (mostly development). I do not know what you mean by startup time though. The way WSL1 works, nothing is really 'started up' other than your shell when you execute `[wsl -d] distroname`. all of the initialization happens when you install the distro, and when the host system starts.
The most obvious performance distinction between the two is how the disks work, so heavy disk operations will almost always be faster in WSL2.
@Jean-Paul Teitu II have you tried just starting wsl from an existing command shell? I imagine this might have nothing to do specifically with the WSL system but rather the mechanism windows uses for starting up a command shell that it uses to launch WSL from the start menu/a shortcut (maybe it runs it in powershell, i know powershell initialization is disgusting).
When actually just engaging wsl directly (through an existing command shell) there is no initialization that needs to happen. You aren't really 'starting wsl' (its functionality baked into the OS), you are starting bash in the context of the existing container space.
So, was WSL 1 an inverse WINE?
Exactly
GNU/NT
Basically. It is their response to WINE to keep people from leaving windows. Because linux is becoming more popular, compatible with more things and easier to install.
@@MyReviews_karkan Linux market share of desktop OS has barely increased at all. gs.statcounter.com/os-market-share/desktop/worldwide
WSL is just part of Microsoft's strategy under Nadella, along with things like .NET Core, Terminal, VSCode Remote Development, etc. to make developing on Windows less of a headache for developers who end up switching to Macs.
@@MyReviews_karkan lol, WSL made me leave Windows and install Ubuntu instead. So for me it's was an entry point to try Linux before I decide to go all in.
Your error about virtualising just looks like VT-x is disabled in the BIOS. This is common for most X86/X64 off the shelf hardware and most likely has nothing to do with the Surface Pro X initially. Considering the SP-X is an ARM based platform, I wonder if you get a performance hit running WSL if the virtual machine has to translate to ARM calls and vice versa or if ARM calls are already packaged in the M$ Linux kernel. It would actually be great to see a comparison against this and your intel platform.
Your older intel machine may just not have the proper virtualization capabilities. So this isn't necessarily a problem with x86_64 processors.
I am sure it is something to do with that PC, rather than a general problem, however after spending a couple of hours trying to fix it and double checking the virtualization capabilities, etc, it should work, but doesn't. This will cause headaches for people since the error message is basically meaningless.
when will they change the name to Linux Subsystem for Windows? :D Will you also take a look at Ubuntu 20.04 and its updates?
Probably never. Its a subsystem in windows, for linux. You are just reading it wrong :P
Your machine said armV8, not a surprise at the end 🙊
Pls do a running gui apps on wsl 2
How did you get from Windows console into the Linux console? I'm missing basic info in the video...
My hosts have stopped working all of a sudden. Any ideas what should I do
Ok that was unexpected, wow
sir, I installed it and reboot my laptop, but suddenly while rebooting it made a very noisy beep sound and the screen was total dark.In order to stop that noise I shut it with by pressing the power button. I am very scared right now. Please tell me, will my Laptop be crashed ? Well, I will restart again tommorow to see what happens. If the sound doesn't stop what should I do ?... Plzzz someone help with this
is it really working on arm? or we are just in a dream? damn Nolan should be proud of us
thx Gary
The only thing that bothers me is that I won't be able to use VMWare or VBox no more. Had to turn Hyper-V off to get that going
1 Quest...!!! I have Ubuntu 20.04 subsystem, and the patch doesn´t apply. What should I do next. Or, is it only that solution for 18.04???
Does uninstalling the distro from settings also clean all the files in ubuntu subsystem and installed packages stuff?
This was a good video.
I want to like wsl2 but I keep running into issues when I try to actually work with it.
In the case that I have mysql installed via ubuntu wsl2.
But want to use workbench to interact with my mysql db. Could I have the server running through ubuntu and workbench working with the dbs through windows?
Same with mongodb and 3T.
Can you explain what's the difference b/w WSL and Linux running in docker container (Before WSL was a thing)
because docker uses a VM to run linux containers
I think that microsoft just microsoft just added "Docker" to windows, renamed it WSL
Part of the justification for WSL2 is to actually use linux containerization with docker on windows without a a type 2 hypervisor. This makes allocating resources for containers more dynamic, so docker on windows doesn't need to grab a huge amount of resources on the host preemptively, and can just grab what it needs to meet the needs of the containers dynamically, like it can on a native linux host. This also streamlines the integration of windows server and linux containers.
Docker and microsoft have been partnered since 2014. Theres no 'in quotation idea thievery' and rebranding. They are partnered, and there is a whole hell of a lot more to wsl than 'der windoze docker amirite'
Can I mount another hard drive with Ubuntu from a different machine?
Hey Gary I have a question and this question is a bit out of this topic . Will there be a ecosystem between android and windows in future I mean a fully fledged where I can transfer files bw them.right now we can only trasfer photos from your phone app but only limited to 25 photo's.
is better cygwin than xming? and with wsl 2 ???
How long till we have Androidx86 running under WSL2? I think it will be awesome to be able to actually install native Google Play Store under Windows...
how do you start Exlorer with a lower case initial e? I have to use upper case E
So is it no okay to use windows computer instead of Mac???
the docker part no longer works, you need install Docker For Windows instead. other parts still work at this point.
What specifically has changed so I can leave a note in the description?
@@GaryExplains at 4:28, you used curl to get docker install shellscript, I tried with this way, the docker demon can't be connected. I did some googling, turns out this way no longer supported since May, 2020. We have to install Docker for Windows installation.
@@alexhu01 Great, thanks, I will update the description. I appreciate it. However I would like to point out that your original comment is a little vague, it sounded like the whole WSL 2 video is old information whereas in fact it was just the docker part you were referring to.
I have problem on using wsl when using kali distro. Checking today if there are any more issue
Hello Everyone,
Would be appreciative if anyone can answer 2 Q I have...
1. I was disappointed with my first WSL2 image that that systemd commands were removed (apparently the entire systemd architecture may have been removed) and none of the old SysVinit architecture can be found, too. So, here is something basic... How or where do you find system events, is everything that's running in a WSL2 being written to the Windows Event logs now?
2. I see that compatibility with Virtualbox and VMware running on the same machine might be resolved sometime soon. I just got a VMware update so I'll see if there is something new. The link to Virtualbox's raodmap doesn't mention WSL2 so I assume nothing new is available. Up until now, I've had to turn off everything (apps, services) related to any other virtualization to run a particular virtualization technology. You can't run different hypervisors simultaneously, only one can be used at a time. Apparently MS has provided an API for other virtualization to run on the Hyper-V hypervisor instead if their native hypervisors to resolve this incompatiblity, but details and implementation is left to the other technology. Has anyone actually done this (VMware is supposed to have this in Tech Preview schedled to be released officially sometime soon)
TIA if anyone has an answer to either of these 2 issues.
Still no GPU support 😥
I’ve been using it for months. I love it! 2 means twice as good.
can we install wsl2 version {10240}
hi, if a person created dev environment, created app, then suddenly windows crashed, the developer will lost everything he/she created on WSL ?? IMO in case of dual boot or a VM he/she can have all things to continue his/her efforts. Just wants to know what you or people are saying for this situation?
If a person created dev environment, created app, then suddenly Linux crashed, the developer will lost everything he/she created on Linux. What is your point?
@@GaryExplains thanks for reply, i knew it but as per my knowledge Win* is more vulnerable than Linux, so there are chances to crash more often as compare to Linux.
I hope it'll be released this midnight
x410 doesn't work for my anymore on Pro X after moving to WSL2
Ok, so I installed WSL2 manually, but the --l -v and --set-version options aren't available in my wsl.exe. Can not upgrade my Linuxes to WSL2. What did I do wrong?
How did you install WSL2 manually?
Any way to run Gnome?
Native Linux...
X Server on Windows?
Can you Outline Server on subsystem?
Docker can map network port to windows localhost port, like "-p 8080:8080"
I don't get it. They have change what was a nice feature into a customised virtual machine. Feels like a backwards step.
The problem with wsl1 is the way they interface Linux kernel calls thought windows kernel, is a lot of work and does not support all Linux features. WSL will run the actual kernel and not a shim translating Linux to windows.
How far can you go into the matrix 🤔 How far will it let you go Linux inside docker on Linux in Windows?
As many times as you feel like.
On a MacBook running bootcamp
They fix the network integration , so I can nmap, and wifi pentest on my laptop and not need a RasPi any more ?
I would like linux subsystem for windows more.
So how exactly is this beneficial for the average user if at all ?
This is mainly for the web & software developer / scientific computing crowd as well as the people who want to download and use Linux / Unix tooling which if you haven't experienced it.. is *vastly* superior to any (if any?) tooling by Windows or Mac OS.