Bash on Windows / Windows Subsytem for Linux (WSL) not installing correctly / hangs
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
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:
- Disable Antivirus permanently & Restart (You can enable it after the installation is complete)
- Open Command Prompt or Windows PowerShell as admin
- Uninstall WSL by running the following command
lxrun /uninstall /full
- Now stop WSL service -
sc stop lxssmanager
- 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. - Once the folders are deleted, try installing WSL again by running
lxrun /install /y
- 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). - Hopefully you shouldn't get a
Error: 0x80080005
this time. - 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