I have Windows Subsystem for Linux, but I don't know which version I have, and many things won't work in version 1. How do I check my version?

  • 3
    @Rinzwind You are welcome to join with me requesting such at github.com/microsoft/WSL/issues/4555 – K7AAY Sep 30 '19 at 18:07
  • 1
    From that thread, it looks like the following bash command works: uname -r | grep Microsoft > /dev/null && echo "WSL1". -- It's a pretty adhoc way to detect it, but it will print "WSL1" if that's what you're running. – BrainSlugs83 Aug 12 '20 at 23:23
  • 3
    @BrainSlugs83 Extremely fragile but works for me! In WSL1, uname -r ends with -Microsoft, in WSL2, it ends -microsoft-standard ... lower case "m"! – Arthur Tacca Aug 14 '20 at 9:09
  • 1
    @Rinzwind Any questions regarding WSL, including how to install it, are on-topic, in my opinion. – Flimm Aug 24 '20 at 9:15
  • 1
    @Rinzwind If the question is on-topic, then so are the answers to that question. If someone asks how to create a bootable Ubuntu USB stick on Windows, then that question is on-topic, and so are all the answers to it, even if the answers mention unetbootin.exe . Same thing with WSL. – Flimm Aug 25 '20 at 13:36
  1. At a Windows 10 command prompt, run ver. Is the next-to-last numeric group version 18917 or higher? If so, it is possible you have WSL 2 but not yet verified. Go on to step A or B.
    If you do not see Windows version 18917 or higher, you have version 1.
    This illustrates the result when the OS is Build 16299:

    Version 16299

    A. Open Windows PowerShell and enter the command wsl -l -v. If version 2 is installed properly, you will see the version number. If you don't see a version number, or if you see an error message (Thank you, Cornea Valentin) you have version 1 (you may also see a version number '1' which could indicate that you're running v1 - see here). Uninstall it then reinstall it as per https://scotch.io/bar-talk/trying-the-new-wsl-2-its-fast-windows-subsystem-for-linux

    B. From the WSL shell prompt, run uname or uname -r. If the kernel version => 4.19, it's WSL Version 2.

Why is this relevant?

WSL 1 was based on Microsoft's Linux-compatible kernel interface, a compatibility translation layer with no Linux kernel code.

WSL 2 was redesigned with a Linux kernel running in a lightweight VM environment, and innovators have found many more things they can do with WSL 2.

Windows 10 Version 2004 (build 19041.153 & later) enhances WSL2 further; see https://devblogs.microsoft.com/commandline/wsl2-will-be-generally-available-in-windows-10-version-2004/ and https://winaero.com/blog/wsl2-will-ship-with-windows-10-version-2004-with-kernel-updates-via-windows-update/ .

  • 34
    also if he get any errors after: wsl -l -v it's 100% wsl 1. – Cornea Valentin Oct 5 '19 at 15:04
  • 5
    I needed to use uname -r to see the kernel version, but the kernel version ended up being 4.4.0, which I'm pretty sure means WSL 1. – Keara Jun 12 '20 at 15:27
  • 15
    Use uname -a to print kernel version. – thisismydesign Jul 23 '20 at 11:35
  • 4
    For me, wsl -l -v prints the usage info (i.e. doesn't work), but wsl -l --verbose prints the verbose list as intended. systeminfo.exe gives me OS Version: 10.0.19041 N/A Build 19041. – drkvogel Aug 10 '20 at 14:35
  • 2
    I'm seeing 4.4, is that greater or less than 4.19? – quant Sep 17 '20 at 22:48
  1. Open PowerShell
  2. Check the version with wsl -l -v
  3. If at version 1, then update the version with wsl --set-version Ubuntu-20.04 2

Note, changing the version of a running OS will terminate it.

If you are not able to update to version 2, then you may not be on the WSL 2 Kernel. This can be downloaded from Microsoft.

  • Note on point 3, running it will instantly kill currently running instances of the OS selected, eg all instances of Ubuntu-20.02 in this case. – zshift Aug 22 '20 at 21:40
  • Thanks for pointing that out, I added a note to point that out. – Jack Aug 23 '20 at 7:44
  • 6
    @Jack, Having only one version of ubuntu, 18.04, I noticed that "wsl --set-version Ubuntu 2" worked for me without specifying the version. I suspect that's always the case. – Angelo Aug 28 '20 at 1:05
  • This is the correct answer for me on Windows 10. – mLstudent33 Mar 29 at 1:23

If you happen to be running Docker for Windows and you have WSL 1, then if you enter docker in the terminal for your WSL, you'll see the message The command 'docker' could not be found in this WSL 1 distro., which is a very clear confirmation.

Not the answer you're looking for? Browse other questions tagged or ask your own question.