Bash on Windows / Windows Subsytem for Linux (WSL) not installing correctly / hangs

12,109

I initially had problems uninstalling a failed install and removing the lxss folder. After I successfully cleaned up the installation, I began my trials to reinstall, but the earlier problem with installing popped up. The process gets stuck Extracting Filesystem... as reported here.

After days of trial and error, I seem to have found the reason for this agony. In my case (and as reported by many others here) it is the antivirus being the spoilsport. Disabling antivirus and restarting seem to do it for me. As silly as it sounds, Antivirus was the main cause for the pain and Error: 0x80080005

Now for those who still have this error, this is should help if you try doing the following things in order:

  1. Disable Antivirus permanently & Restart (You can enable it after the installation is complete)
  2. Open Command Prompt or Windows PowerShell as admin
  3. Uninstall WSL by running the following command lxrun /uninstall /full
  4. Now stop WSL service - sc stop lxssmanager
  5. Remove App data folders - rmdir /S %LOCALAPPDATA%\lxss. Confirm the folders have been deleted. You might need to change the ownership to delete the folder if you get any access-denied errors.
  6. Once the folders are deleted, try installing WSL again by running lxrun /install /y
  7. Wait until it downloads from the Windows Store and Extracts the files. (You can check %LOCALAPPDATA%\lxss\rootfs to see if the files have been extracted).
  8. Hopefully you shouldn't get a Error: 0x80080005 this time.
  9. Enjoy Bash on Windows!

EDIT : Another reason for the error is identified as a bug when you have multiple swap files. This will be fixed in the future, but for now, remove other swap files and keep only one swapfile. This should fix it.

More details for those interested:

"Because of your trace file I have identified a bug in the installation code that is calculating the swap file size. This function is used by both the sysinfo system call and generating the contents of /proc/meminfo. This problem will happen when you have multiple pagefiles on your machine. There are three different outcomes that can happen as a result of this bug: The swapfile size will be reported incorrectly Our driver will dereference an invalid memory address and cause a bluescreen The machine will enter an infinite loop when calculating the swap file size (this is the one you are seeing) As a temporary workaround if you remove all but one of your pagefiles you should be able to use WSL. I am coding up a fix for this right now."

Reference: Bash on Ubuntu on Windows

Share:
12,109

Related videos on Youtube

Vivek Vijayan
Author by

Vivek Vijayan

Software Engineer

Updated on September 18, 2022

Comments

  • Vivek Vijayan
    Vivek Vijayan over 1 year

    I got the windows anniversary update and tried to install Bash. I ran bash from the command prompt (non-admin mode) and it got stuck while trying to extract the files. I closed the window and tried to do the same with elevated privileges (command prompt run as admin).

    But now when I enter bash, it is stuck there and doesn't launch or ask me to install bash. I could see bash process consuming 25% of CPU in the background.

    When I try to uninstall bash running lxrun /uninstall /full, it fails to uninstall:

    C:\WINDOWS\system32>lxrun /uninstall /full
    This will uninstall Ubuntu on Windows.

    This will remove the Ubuntu environment as well as any modifications, new applications, and user data.

    Type "y" to continue: y

    Uninstalling...

    Error: 0x80080005

    How could I reset the Linux subsystem for windows 10?

    EDIT: Also tried options mentioned here by Microsoft.

    Also, check out this issue. Bash does nothing for a while then exits

    • gronostaj
      gronostaj almost 8 years
      How long did you actually wait for it to (un)install?
    • Vivek Vijayan
      Vivek Vijayan almost 8 years
      I waited for about 30 mins.
    • kleinfreund
      kleinfreund almost 8 years
      Alternatively you could go to Enable or disable Windows features and uncheck Windows subsystem for Linux (Beta) and then restart. After that, reenable the same checkbox and restart again. On my machine, I could not run lxrun.
    • Vivek Vijayan
      Vivek Vijayan almost 8 years
      I tried all that! I think this is a widely reported issue
    • Ramhound
      Ramhound almost 8 years
      @VivekVijayan - Take ownership of %localappdata%\lxss then delete it. You can then use lxrun /install to install Ubuntu on Windows again. This assumes you have developer mode enabled and have already added the (Windows Linux Subsystem) Windows Feature.
    • Vivek Vijayan
      Vivek Vijayan almost 8 years
      Thanks @Ramhound. I was able to remove the folder but now when I try lxrun /install it gets stuck exactly at the same place as before - trying to extract the files. But looking at the %LOCALAPPDATA%\lxss\rootfs the files seems to have extracted correctly as mentioned here. But it fails to finish the installation for some reason.
  • Tom Ellis
    Tom Ellis about 7 years
    Thanks, this helped me. I had Windows Defender running and I only had to do 1-3 and 6-9, i.e. I didn't have to stop the service or delete anything.
  • Vivek Vijayan
    Vivek Vijayan about 7 years
    Happy to help. In some cases, WSL service hinders the clean removal of installation files. Glad you didn't have to go through all that.