Open john-vaudin opened 4 years ago
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 Access is denied. Later I found that I didn't have Windows Version 2004, Build 19041 install but only 1909 Build 18363.720.
So I removed WSL from Windows Features, reboot, and activated WSL again with the effect that I get an "Access is denied" in PS being Admin but runs without Admin. However, I'm stuck now since I can no longer use wsl.exe being Admin nor revert to any previous state.
I have the same problem.
I followed these steps https://docs.microsoft.com/pt-br/windows/wsl/install-win10
And got stucked in the part I had to switch to version 2.
I can't simply run wsl
because windwos always say Access Denied
Same problem, any update or fix?
Fixed, modify permisions on WindowsApps folder work for me.
Fixed, modify permisions on WindowsApps folder work for me.
I have the same problem, and have't fix it yet. Could you please to describe in detail of your operation?
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. Try this link (ignoring the stupid download an app version 1 of course :) https://www.maketecheasier.com/access-windowsapps-folder-windows-10/
~@codemonkey33 has the solution that worked just fine for me. I still had the problem even when I had imported my ubuntu outside of the WindowsApps
folder, weird...~
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.
Running as Administrator": wsl.exe works to .start the distro running. I can then use it either as admin or as a regular user (via wsl.exe, Windows Terminal, VS Code...)
However, if the distro shuts down (e.g. via wsl.exe --shutdown
), then I lose my ability to connect as a regular user, and have to run wsl.exe as admin again.
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. wsl
now works perfectly and doesn't say access denied.
Same here, uninstalling KB4565503
fixed the issue. Everything is back to normal.
Issue #5605 has a possible "permanent" fix for the issue triggered by KB4565503
.
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 KB4565503
, updates automatically install it again. Is there a permanent fix for this issue?
After uninstalling
KB4565503
, updates automatically install it again. Is there a permanent fix for this issue?
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
After uninstalling
KB4565503
, updates automatically install it again. Is there a permanent fix for this issue?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!
After uninstalling
KB4565503
, updates automatically install it again. Is there a permanent fix for this issue?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
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:
wsl --list --verbose
to get a list of distroswsl --shutdown
wsl --unregister [distro name listed from step 1]
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.
[MyUsername] ran C:\Windows\System32\wsl.exe, which attempted to access the process LxssManagerProxyStub.dll, violating the rule "Executing Windows Subsystem for Linux", and was blocked. For information about how to respond to this event, see KB85494.
I found the resolution from the below source. Source: answers.microsoft.com
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,
ii. trying to start it from cmd.exe
would exit immediately.
What did work, was to start cmd.exe
or powershell.exe
as Administrator and run wsl
from there:
C:\Windows\system32> wsl
root@DESKTOP-XXXXX:~# uname -a
Linux DESKTOP-XXXX 4.4.0-18362-Microsoft #1049-Microsoft Thu Aug 14 12:01:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
root@DESKTOP-XXXXX:~# logout
I tried to reinstall:
PS C:\Windows\system32> # this is in powershell
PS C:\Windows\system32> cd C:\Users\user
PS C:\Users\user> Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
PS C:\Users\user> Add-ProvisionedAppxPackage -PackagePath .\Ubuntu.appx -Online -SkipLicense
It appeared to install successfully, however I still had the same symptoms.
I tried reinstalling again, this time directly in my user account:
PS C:\Users\user> Get-AppxPackage -name CanonicalGroupLimited.Ubuntu18.04onWindows | Remove-AppxPackage
PS C:\Users\user> Add-AddxPackage .\Ubuntu1804.appx
It didn't solve it, but instead of Ubuntu crashing immediately, it told me:
PS C:\Users\user> ubuntu1804.exe
Access is denied.
(which is what brought me to this thread)
but it still works as Administrator.
@jwsinner's fix in https://github.com/microsoft/WSL/issues/4920#issuecomment-746843348 seems to have actually fixed it fully! And done it without having to garble my system permissions or anything:
In my Administrator shell:
PS C:\Windows\system32> wsl --list --verbose
NAME STATE VERSION
* Ubuntu-18.04 Running 1
PS C:\Windows\system32> wsl --shutdown
PS C:\Windows\system32> wsl --unregister Ubuntu-18.04
Unregistering...
PS C:\Windows\system32>
Then, as my regular user, without reinstalling anything package:
PS C:\Users\user> ubuntu1804.exe
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username:
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 x
attribute on my folders, so I couldn't read them.
I had to do
chmod +x folder
卸载后
KB4565503
,更新会自动再次安装。是否有针对此问题的永久修复程序?是-授予您的用户帐户对.vhdx文件的完全控制权限。请参阅https://answers.microsoft.com/zh-cn/windows/forum/all/kb4565503-installed-then-wsl-2-failed-to-start/25794c4f-0b20-465e-bbdb-a8af3d9e0e88
Yes, after I restored the system, vhdx permissions were messed up. Adding my own account access can solve the problem
After uninstalling
KB4565503
, updates automatically install it again. Is there a permanent fix for this issue?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!
I have also encountered the same problem . Any solution ?
I also have this issue...
Same here, is there a possibility to see the error cause - where does wsl log more info?
actually I fixed this by running the powershell without the administrator access...only regular..now everything works fine :)
I just fixed it.
wsl --import Ub C:\Users\fs\wsl\Ub C:\Users\fs\backup\wsl\wsl.tar.gz --version 2
worked, whereas
wsl --import Ub C:\Users\fs\wsl\Ub C:\Users\fs\backup\wsl\wsl.tar --version 2
failed. I don't know why I decided to unpack the gz file in the first attempt and tried to import from there.
I started recently getting File permission errors when trying to edit anything under \\wsl$\Ubuntu-20.04
from Windows Explorer, opening in VSCode. In the end I resorted to unregistering from Powershell (wsl --shutdown
and wsl --unregister Ubuntu-20.04
), and then re-installing (I just clicked on the Ubuntu icon which I had pinned in the taskbar, and it reinstalled). After reinstalling and creating the new user, now I can access and edit files using Windows Explorer and VSCode.
Unfortunately this has the downside of removing all data within the Ubuntu instance. It seems to me to be a pretty drastic approach. I had already checked permissions on the ext4.vhdx
file (C:\%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
) and they were all correct as far as I could tell.
After wondering about the extreme high amount of RAM consumption I've followed the advice from here https://github.com/microsoft/WSL/issues/4166 by adding a .wslconfig file in my windows user home folder:
[wsl2] kernel=C:\temp\MyCustomLinuxKernel memory=2GB # Limits VM memory in WSL 2 processors=4 # Makes the WSL 2 VM use N virtual processors
(I also created the above temp folder and granted permission to access them for my user and administrator)
Then I've shut down wsl via wsl --shutdown
as advised in the Microsoft documentation:
https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig
After a reboot I can no longer start wsl from the Powershell - neither with normal user nor administrator.
I then followed various suggestions like:
So all good and well, but STILL the PowerShell outputs "Access denied" when trying to execute "wsl"
Does anyone have any other ideas I could try out?
Installing the Kernel Update (step 4) miraculously solved my issue.
For anyone else who runs into this, it might be your antivirus. I'm using Bitdefender, ran into this problem, had time to find this post and search a few other pages, then Bitdefender (finally, after ~ 5-10 min.) popped up a message about it. I excluded it (wsl.exe), and things went back to normal.
I had clicked on a .cpp file from a nautilus window (seeing if it would open gedit) and it crashed. After I excluded wsl.exe in BD, I was able to click on the .cpp, but it tried to use windows apps (i.e. no gedit). Anyway, maybe this will be useful to someone else. Good luck, WSL2 is awesome.
I'm still having this issue. Did everything in @CreativeWarlock 's post, but no joy. wsl.exe
is owned by TrustedInstaller and can't be moved, deleted or anything (even when I uninstall wsl2). Just executing wsl.exe
gives the "Access is denied" message. To be clear, wsl.exe does run -- you can see it in procmon. But then it prints that message and exits. Passing any args to it has no effect.
This just happened to me when the following updates were installed (all available recently): KB5009566, KB5008880, KB5007292, KB5008215 I uninstalled each one individually and tried running wsl in a administrator cmd. Uninstalling them did not fix the issue. I think the damage was already done. Hopefully this helps.
Recently ran out of disk space and had the same thing occur. Unable to resolve
I used wrong file path, wsl --import fedora C:\wsl C:\Users\aa\Documents\fedora-33.20211125-x86_64.tar
should be wsl --import fedora C:\wsl C:\Users\aa\Documents\fedora-33.20211125-x86_64.tar\fedora-33.20211125-x86_64.tar
This started working again after I did a full wipe and reinstall of the operating system. Disappointing to have to do that. But, I'm glad it's working again now.
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:
- Run
wsl --list --verbose
to get a list of distroswsl --shutdown
wsl --unregister [distro name listed from step 1]
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.
for me, it's only thing worked. But in new register I get new error, its like 'no permission' (don't remember exactly). Search for new error, I found this :
So maybe that's possible be the cause of no permission
If you have WSL "Access is denied" problem, at first check where have you your WSL installed.
If you use WSL from Microsoft Store (it is good choice, because you have got fresh and current version) then WSL is installed in C:\Program Files\WindowsApps\
folder. And this folder has very limited access. Local administrators can't access this folder.
I took over ownership of files in this directory to LOCAL-DOMAIN\Administrators. Then it was possible to add Read/Execute rights to LOCAL-DOMAIN\Administrators. After it WSL start working via SSH or other remote access.
I get the same mistake after a while but not at the beginning. I think this must be a bug in the App Windows Store. After I repair it by using Windowstools it seems to be work. (Settings ->Apps -> Reset to default.) This bug has a long history but unfortunately without a solution until now.
If anyone are facing this problem, check if you have an App called Windows Subsystem for Linux, if yes, uninstall it and you will get access to wsl2 again.
It was installed here after running wsl --update
command.
Had simillar problem. Running as administator won't help. (Access Denied) After some manipulations, I've decided to turn off Windows Update Blocker (wub)
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 Ubuntu
distro that is installed by default when installing wsl
from the CLI. I tried every proposed solution in this thread and many others with a similar access denied error, none of them ended up working. The solution that ended up working for me was to perform a full factory reset on my PC. Obviously not the best solution, but you can always back up your data and copy it back over to your fresh install. This was a last resort as I've been facing this issue for over 3 weeks now and needed to get things working again 🤷
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