-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wsl.exe fails with "Access is denied" #4920
Comments
I seem to ahve the same issue... Although I can start ubuntu when I open it from the store, executing wsl always results in " Access is denied". |
Same over here. Switched from WSL 1 to WSL 2. After rebooting I got an So I removed WSL from Windows Features, reboot, and activated |
I have the same problem. |
Same problem, any update or fix? |
Fixed, modify permisions on WindowsApps folder work for me. |
I have the same problem, and have't fix it yet. |
same here. please provide a fix |
Had the same issue when running as admin, when running without it WSL works fine. try it. |
Also got past this with WindowsApps folder permissions. You need to change the owner of this folder so you can get access to it. |
EDIT: @rosea-tf has pinpointed the bug below. It only happens once wsl is shutdown by itself. You'll have to access wsl as admin and then you'll have access again. |
I have the same issue here. Is there any way we can do something similar to what @codemonkey33 is suggesting, but without the registry tweaking and only for WSL (not the whole windows apps folder)? |
Weird thing, I just launched Ubuntu from Windows Store, then ran wsl from cmd (running as administrator), and all of a sudden it seems like everything is working fine. Even in cmd without administrator privileges, or from Windows Terminal (which is where my issue started). |
I have the same issue on an Ubuntu installation imported from a TAR file to a custom location. I already have access to the WindowsApps folder; this doesn't help. Running as a regular user: I get the "Access Denied" message when trying to start wsl.exe. Problem seems to have appeared with Windows Update KB4565503 earlier this week. EDIT: After uninstalling KB4565503, the problem disappears. |
Can confirm the specific update (KB4565503) was the issue. |
Same here, uninstalling |
Issue #5605 has a possible "permanent" fix for the issue triggered by |
Same here. Just updated Win 10 yesterday and now my WSL2 throws "Access denied" but if you run terminal as administrator and then go to wsl, it works. |
Just to +1 to comments by other about KB4565503 as a root cause for this i.e. I had the same issue, with "access is denied" being returned on wsl commands. Having now uninstalled KB4565503 the problem is resolved. |
After uninstalling |
Yes - grant your user account full control over the .vhdx file. See https://answers.microsoft.com/en-us/windows/forum/all/kb4565503-installed-then-wsl-2-failed-to-start/25794c4f-0b20-465e-bbdb-a8af3d9e0e88 |
Thanks! It worked! |
Thank you - this worked for me! |
I experienced this issue when Docker stopped unexpectedly. PowerShell would either return that I didn't have permission (when run outside Administrator) or Access Denied (when run as Administrator. In a command prompt I was getting Access Denied when trying to run wsl, but was still able to run wsl --help. If you are able to run wsl --help and get information back, you should be able to do the following:
Then I had located ext4.vhdx and deleted the folders in AppData that contained this file (Mine was Docker). If you can't delete it because it says it is open in System, restart and you should be able to delete it. After it's deleted, you should have access to wsl in PowerShell and cmd and be able to reinstall the distro you deleted. |
I too have this issue but in my case, McAfee endpoint security is installed on my machine and it is blocking me to run it. In the McAfee endpoint security, the below message was posted. The windows update KB4565503 is NOT installed on my machine.
I found the resolution from the below source. |
Disable compress and encryption for this folder %USERPROFILE%\AppData\Local\Packages{distribution_folder} |
I had already installed Ubuntu on my machine a while ago. Today I found I could not start it: i. Trying to click "Ubuntu" in the Start Menu would appear to not react, What did work, was to start
I tried to reinstall:
It appeared to install successfully, however I still had the same symptoms. I tried reinstalling again, this time directly in my user account:
It didn't solve it, but instead of Ubuntu crashing immediately, it told me:
(which is what brought me to this thread) but it still works as Administrator. @jwsinner's fix in #4920 (comment) seems to have actually fixed it fully! And done it without having to garble my system permissions or anything: In my Administrator shell:
Then, as my regular user, without reinstalling anything package:
I'm -1 on KB4565503 being the problem. I don't have it installed: I have Windows 10 Pro N-1909-18363.1440: |
In my case, windows permission mixed up with linux permissions, and disabled the I had to do
|
Had simillar problem. Running as administator won't help. (Access Denied) Now, WSL works |
Use the WSL -List command to check whether the old version is completely uninstalled |
I ended up facing a similar issue where all I got was access denied when attempting to install any distro EXCEPT the default |
Thank you!!! That's almost unbelievable, so Microsoft created a conflict between 2 different installations of WSL, one from the command line and the 2nd one from Microsoft Store which appeared automatically without my consent, and that new one was causing this error: BTW this is the original message from the terminal whenever I launch wsl.exe: That's why I've run the update command and then it stopped working. BTW I use WSL2. Update: to be able to use the new WSL version from Microsoft Store, it didn't help to uninstall the old WSL and install the new one, there were still access denied errors and also no distro could be started (Registry entries broken?), so it was necessary to create a new user in Windows and start from scratch. |
amazing. simply amazing. so how could this ever have slipped through Microsoft's quality control?! and it's been this way since at least 8 months?! |
For anyone who might still be stuck here, this solution worked for me: Quoting from that solution: |
@vncntk Seconding this, the exact same thing happened to me today as well. Have not found a solution yet either. |
Same here, seemed to happen after installing the latest Windows Updates:
|
I have the same problem, but the only update I installed was:
|
Fixed after running the following in PowerShell as administrator
|
Same for me, the solution provided by @dylancarruthers solved the issue when in Administrator mode. Docker Desktop also stopped working because of this and resolved that by:
|
@koleh-tech Defender was the cause for us too with this rule: Block use of copied or impersonated system tools. If you can check your protection history in Defender you might see all the blocked wsl.exe actions. |
Same issue here and @dylancarruthers's solution did not solve the issue for me! |
Having the same issue not solved for me either |
my wsl is broken with "access denied" and it also looks like my traditional virtual machines also fail using vbox after the last windows update. Running Windows 11 10.0.22631 N/A Build 22631 |
This appears to be due to a windows update causing WSL.exe to trigger an attack surface reduction rule in defender for endpoint. https://learn.microsoft.com/en-us/defender-endpoint/attack-surface-reduction-rules-deployment-test#step-2-understand-the-attack-surface-reduction-rules-reporting-page-in-the-microsoft-defender-portal - Your IT admins can use this report to see if wsl.exe is triggering the rule. We confirmed this was the issue for our users after installing the latest updates pushed on 08.13. From here we went into the intune ASR policy and set an exemption for WSL.exe (decent write up here, this is not our page - https://www.nielskok.tech/microsoft-defender-for-endpoint/add-exclusion-in-attack-surface-reduction-microsoft-defender-for-endpoint/) We tested by running |
Also having this issue and adding these rules to powershell in admin mode still gives me an access denied when trying to launch wsl. Any other alternatives? |
If you are using intune to manage these devices your intune admin will need to go into the attack surface reduction rules and exempt WSL from there then you can run a group policy update and reboot. You may be able to look at the windows protection history and see if this is the case: |
So during not even a full year, Microsoft was able to completely break Docker via WSL two times via bodged updates - creating a massive amount of wasted working hours and annoyance. |
The issue regarding the Microsoft Defender has been resolved on its own apparently. I would advise everyone that was having this issue because of the Defender to update to the latest Windows version. |
Latest monthly cumulative update or latest edition of windows (W11 24h2, etc)? I'm on Windows 10 22H2 on the latest cumulative patch & getting this from an Attack Surface Reduction event viewer filter:
|
For anyone who encountered this issue after migrating the location of the distros and images, I found that the "accessDenied" was caused becaused the current user didn't have access to the new location I migrated to. This command: |
Thanks, it worked for me. I had the issue after a windows reset and starting a distro from an imported .vhdx. |
After uninstalling an re-installing Windows Subsystem for Linux I can't install any distro - they all fail with "Access is denied". Even running wsl.exe now fails with "Access is denied".
Your Windows build number: (Type ver at a Windows Command Prompt)
Microsoft Windows [Version 10.0.18362.657]
Steps to reproduce
> wsl.exe
Access is denied
Strace and logs attached.
wsl_strace.txt
logs.zip
The text was updated successfully, but these errors were encountered: