You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Starting WSL results in error "The file cannot be accessed by the system." #9197
I am experiencing the same issue. No matter which WSL command I run right after installing Ubuntu with wsl --install -d ubuntu, I get the same error.
Distro: Ubuntu 22.04
Host: Windows 11 Enterprise (21H2 22000.1281)
Powershell: 5.1.22000.832
I'm running the WSL commands from a ScheduledJob (powershell) after waiting for the initial user creation prompt, but having closed it without creating a user.
I am having the same error message since this morning, except it is only happening while using a remote ssh connection, if I start the command locally then they work, if I connect to windows using OpenSSH then type wsl then I get the error
I am on insider build 25201.1000
Reacted by Riccardo Lincetto, Daniel O. Delgado, Pavel, wrobertg, Silver, Philipp Gesang, Carlos A. Wong, Jacob, jqknono, resettarget and 19 more
I was able to resolve my issue with a dism /Online /Cleanup-Image /RestoreHealth and a restart.
Reacted by Gihan Marasingha, jdmichaud, Shivam Singh, Daniel Collaguazo Malla, Tim Burt, andika eka, Wancho Zhang, Stalin Gino, Glen, jilsom845 and 3 more
Reacted by Ross Smith II, Gottlieb, Raphael Abreu, Antonioni Campos, Mark O. Brown, Aliaksei Holubau, Kate, Steven Hartland, kendofriendo, Seonglae Cho and 23 more
I am having the same error message since this morning, except it is only happening while using a remote ssh connection, if I start the command locally then they work, if I connect to windows using OpenSSH then type wsl then I get the error I am on insider build 25201.1000
I have had this happen twice, last time I did the dism command and a couple of restarts and it eventually worked again, and now I have the same problem again. So I think that is not a permanent solution. And I think this issue should be reopened, there seem to be multiple people with an issue here.
Reacted by Sergei Silnov, Trevor Gross, Pavel, Alejandro, Ross Smith II, Carlos A. Wong, jay-waves, Mark O. Brown, TrainFun, Tim Brooks and 9 more
I have the same issue. WSL works fine when executing from the usual graphical session but ends up with The file cannot be accessed by the system when using remote ssh session. The problem appeared approximately a month ago. Have no clue what could be the reason. No updates where applied or any configuration changes made. dism tool doesn't help in my case. Windows version: 10.0.19045.2486. The issue definitely has to be reopened.
Reacted by Kenvix, Tim Brooks, Fengting, jiadn and Andy Pindus
I am having the same error message since this morning, except it is only happening while using a remote ssh connection, if I start the command locally then they work, if I connect to windows using OpenSSH then type wsl then I get the error I am on insider build 25201.1000
c:\agent> wsl --version
The file cannot be accessed by the system.
In our case, we want to install a custom WSL image on a build agent.
Over a RDP connection the call to "wsl --version" works.
Via the build agent (same user) it does not work anymore.
The error exists since about the beginning of January 2023.
As described in the known issues, calls to the WSL that originate from a session zero no longer works.
For example, when something is started from a Windows service (ADOs agents or SSH-Daemon) .
Release Notes for Windows Subsystem for Linux in the Microsoft Store
Launching Windows Subsystem for Linux from session zero does not currently work (for example from an ssh connection).
Our case seems to be almost exactly the same as yours. We want to install a custom WSL image using a build agent. We noticed this issue with remote commands in Jan 2023 and found that no command with WSL at the front would work.
We use packer and powershell scripts to provision a windows sysprep image with WSL baked in. I do not know exactly what fixed the problem but we now do the following and it works fine:
I solved this issue by Reset the Windows Subsystem for Linux in App Settings.
I can't access that setting page after resetting. but I remember what I did.
Windows logo key -> type linux -> 'Windows Subsystem for Linuxappears -> you can seeApp Settings` in the right pane, hit that menu.
When Settings windows open, you can see the Reset button.
after the reset, It works like a charm!
Reacted by karthick-kk, Chieh-Yang Huang, Valentin Porchet, Christian Ariza, Nicolas Fernandez, Psi505, Li Junkang, Allan Rebelo, boonwj, quentonwu and 26 more
Reacted by ozkan, Matheus Lozano, frozenproof, , vrajjbhatt, ccfelix, Lucas Schulze, Alex D and Tim Mousaw
Reacted by simba-g, Benyamin Limanto, Collin, Alex D, Anwar Hossain and hecmay
Reacted by Nicolas Fernandez, hkunz, Ashish Pandagre, naTlatsyrC, Matheus Lozano, K, hkhoi1589, Lucas Schulze, NakedTrashPanda, Alex D and 1 more
Reacted by Shreenidhi H D, Maurício Pólvora, Lucas Schulze and Alex D
Just want to report that this solves my problem as well!!
I solved this issue by Reset the Windows Subsystem for Linux in App Settings. I can't access that setting page after resetting. but I remember what I did.
Windows logo key -> type linux -> 'Windows Subsystem for Linuxappears -> you can seeApp Settings` in the right pane, hit that menu.
When Settings windows open, you can see the Reset button. after the reset, It works like a charm!
Reacted by luceat-lux-vestra, AJ Kishawi, Jose Velaides and Psi505
Just want to report that this solves my problem as well!!
I solved this issue by Reset the Windows Subsystem for Linux in App Settings. I can't access that setting page after resetting. but I remember what I did.
Windows logo key -> type linux -> 'Windows Subsystem for Linuxappears -> you can seeApp Settingsin the right pane, hit that menu. When Settings windows open, you can see theReset` button. after the reset, It works like a charm!
I tried many things, repairing Windows, dism commands, sfc /scannow, uninstalling / reinstalling the Windows Subsystem for Linux optional feature of Windows, repairing my distro app, repairing the WSL store app, but the thing that finally worked was:
Uninstalling "Windows Subsystem for Linux" (it's a store app but you can only see it by typing "linux" in "applications and features" in Windows settings)
At this point, the wsl command worked again but advised to run "wsl update"
So I did, but that command fails miserably ("/bin/bash: line 1: update: command not found") because it's actually "wsl --update"
Running "wsl --update" installs again the store app
В моем случае проблема была решена одной простой командой: "wsl --shutdown". Значение ее можно посмотреть набрав "wsl --help". Может показаться странным, но это работает как сразу, так и после перезагрузки. Удачи!
Since I'm on Windows Server 2022 I didn't have a Reset option in the GUI so I tried Reset-AppxPackage with no luck. The version I was using was 2.0.14.0, but with -pre-release it went to 2.1.3.0 and my problems went away!
Tried everything possible, none worked. Eventually this helped - wsl --update --pre-release
which is funny! Stable version is Unstable
In my case I managed to solve it in the following way:
delete the folder: C:\Program Files\WSL
If it does not allow you to eliminate, stop the wsl service, in the windows search engine you search for services and within the application you search for wsl and stop it
After that you search for wsl in windows and it will reinstall the wsl and it no longer gave me the error
Sub system app.so just remove it and reinstall from store
Hi I'm also facing the same issue and uninstalled the WSL from windows. Now trying to install from microsoft store, please check below screen shot if I'm installing correct app.
Need to uninstall
Need to install
Is this correct? Please let me know so that I can proceed.
It worked thanks just needed to click repair, the internal windows repair functions for me are also broken i think
Had this very issue on a Windows 11 installation and after reading through all comments here I noticed that indeed the wsl.exe copies that get installed and are available on the standard PATH aren't really the actual executables, unless they get replaced or something gets changed after reboot/repair, but debugging through the instances of wsl.exe on the system:
>where wsl.exe
C:\Windows\System32\wsl.exe
C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps\wsl.exe
>dir C:\Windows\System32\wsl.exe
Volume in drive C has no label.
Volume Serial Number is 6E9D-788A
Directory of C:\Windows\System32
02/25/2024 01:48 PM 196,608 wsl.exe
1 File(s) 196,608 bytes
0 Dir(s) 96,262,938,624 bytes free
>C:\Windows\System32\wsl.exe --version
The file cannot be accessed by the system.
Since while running dir /s \wsl.exe found many other copies in many directories including C:\Program Files\WSL\wsl.exe I ended up testing executing the same command with that one:
That file seems to be much bigger than the ones on the path:
>dir /s wsl.exe
Volume in drive C has no label.
Volume Serial Number is 6E9D-788A
Directory of C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_2.2.4.0_x64__8wekyb3d8bbwe
06/21/2024 07:55 PM 3,633,088 wsl.exe
1 File(s) 3,633,088 bytes
Directory of C:\Program Files\WSL
04/25/2024 06:19 PM 3,633,088 wsl.exe
1 File(s) 3,633,088 bytes
Directory of C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps
06/21/2024 07:56 PM 0 wsl.exe
1 File(s) 0 bytes
Directory of C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe
06/21/2024 07:56 PM 0 wsl.exe
1 File(s) 0 bytes
Directory of C:\Windows\System32
02/25/2024 01:48 PM 196,608 wsl.exe
1 File(s) 196,608 bytes
Directory of C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6
02/25/2024 01:48 PM 196,608 wsl.exe
1 File(s) 196,608 bytes
Directory of C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6\f
02/09/2024 08:05 PM 344 wsl.exe
1 File(s) 344 bytes
Directory of C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6\r
02/25/2024 01:48 PM 595 wsl.exe
1 File(s) 595 bytes
Total Files Listed:
8 File(s) 7,660,331 bytes
0 Dir(s) 96,284,803,072 bytes free
So not sure if the other ones are stubs or some sort of "symbolic link" to the actual ones but they don't seem to work out of the box after installing and rebooting.
Just for future reference, I was also a victim of this weird error after a Windows 10 system restore that showed a weird error upon finishing. I tried what other people said above, Repair, Reset, none of them worked.
What actually worked for me was reinstalling it like you suggested, thanks!
Activity
arothenhaeuser commentedon Dec 2, 2022
I am experiencing the same issue. No matter which WSL command I run right after installing Ubuntu with wsl --install -d ubuntu, I get the same error.
Distro: Ubuntu 22.04
Host: Windows 11 Enterprise (21H2 22000.1281)
Powershell: 5.1.22000.832
I'm running the WSL commands from a ScheduledJob (powershell) after waiting for the initial user creation prompt, but having closed it without creating a user.
StephaneKazmierczak commentedon Dec 7, 2022
I am having the same error message since this morning, except it is only happening while using a remote ssh connection, if I start the command locally then they work, if I connect to windows using OpenSSH then type wsl then I get the error
I am on insider build 25201.1000
taikodragon commentedon Dec 7, 2022
I was able to resolve my issue with a
dism /Online /Cleanup-Image /RestoreHealthand a restart.AidanStrong commentedon Jan 13, 2023
stephane (@StephaneKazmierczak) did you ever fix this issue?
MathanGeurtsen commentedon Jan 16, 2023
I have had this happen twice, last time I did the dism command and a couple of restarts and it eventually worked again, and now I have the same problem again. So I think that is not a permanent solution. And I think this issue should be reopened, there seem to be multiple people with an issue here.
pavelgood commentedon Jan 17, 2023
I have the same issue. WSL works fine when executing from the usual graphical session but ends up with
The file cannot be accessed by the systemwhen using remote ssh session. The problem appeared approximately a month ago. Have no clue what could be the reason. No updates where applied or any configuration changes made.dismtool doesn't help in my case. Windows version: 10.0.19045.2486. The issue definitely has to be reopened.simmel commentedon Jan 18, 2023
For solution see #7900
pavelgood commentedon Jan 19, 2023
Thanks Simon Lundström (@simmel) . Removing
Windows Subsystem for Linuxworks to me.StephaneKazmierczak commentedon Jan 27, 2023
I keep a wsl shell running on remote machine at all times. Also I was having more issues with 1.1.0 so downgraded to 1.0.3
marklechtermann commentedon Feb 16, 2023
Same problem with our Azure DevOps pipeline job.
In our case, we want to install a custom WSL image on a build agent.
Over a RDP connection the call to "wsl --version" works.
Via the build agent (same user) it does not work anymore.
The error exists since about the beginning of January 2023.
As described in the known issues, calls to the WSL that originate from a session zero no longer works.
For example, when something is started from a Windows service (ADOs agents or SSH-Daemon) .
Does anyone know workarounds?
https://learn.microsoft.com/en-us/windows/wsl/store-release-notes#known-issues
AidanStrong commentedon Feb 16, 2023
Mark Lechtermann (@marklechtermann)
Our case seems to be almost exactly the same as yours. We want to install a custom WSL image using a build agent. We noticed this issue with remote commands in Jan 2023 and found that no command with WSL at the front would work.
We use packer and powershell scripts to provision a windows sysprep image with WSL baked in. I do not know exactly what fixed the problem but we now do the following and it works fine:
I hope this helps.
luceat-lux-vestra commentedon Apr 1, 2023
I solved this issue by Reset the
Windows Subsystem for LinuxinApp Settings.I can't access that setting page after resetting. but I remember what I did.
Windows logo key -> type
linux-> 'Windows Subsystem for Linuxappears -> you can seeApp Settings` in the right pane, hit that menu.When Settings windows open, you can see the
Resetbutton.after the reset, It works like a charm!
appleternity commentedon Apr 3, 2023
Just want to report that this solves my problem as well!!
jmihalich commentedon May 7, 2023
This worked for me too. seriously, wtf???
32 remaining items
chandankushwahaa commentedon Mar 13, 2024
\\wsl$- It will open the file directory of linux distributionwsl --list --v: It will list all installed Linux distributionswsl --unregister ubuntu- ubnuntu is the name it can be anything from the listIt works for me
gabsoftware commentedon Mar 15, 2024
I tried many things, repairing Windows, dism commands, sfc /scannow, uninstalling / reinstalling the Windows Subsystem for Linux optional feature of Windows, repairing my distro app, repairing the WSL store app, but the thing that finally worked was:
DmitrY66 commentedon Mar 16, 2024
В моем случае проблема была решена одной простой командой: "wsl --shutdown". Значение ее можно посмотреть набрав "wsl --help". Может показаться странным, но это работает как сразу, так и после перезагрузки. Удачи!
HumbleBee14 commentedon Mar 22, 2024
Tried everything possible, none worked. Eventually this helped -
wsl --update --pre-releasewhich is funny! Stable version is Unstable
bjagasia commentedon Apr 2, 2024
This worked after a system restore -- thank you.
pengweiqhca commentedon Apr 2, 2024
I fixed it after installing wsl.msi manuall
rayinfinite commentedon May 8, 2024
I fixed it by clicking a reinstall button in Windows Subsystem for Linux app in Microsoft Store
DonovanPS commentedon May 11, 2024
In my case I managed to solve it in the following way:
delete the folder:
C:\Program Files\WSLIf it does not allow you to eliminate, stop the wsl
service, in the windows search engine you search for services and within the application you search for wsl and stop itAfter that you search for
wslin windows and it will reinstall the wsl and it no longer gave me the errorplato1123 commentedon Jun 5, 2024
wow that saved the day thank you <3
Useems commentedon Jun 14, 2024
It worked for me, resolved in less than 1 minute.
herofahad777 commentedon Jun 23, 2024
It worked thanks just needed to click repair, the internal windows repair functions for me are also broken i think
robertoandrade commentedon Jun 27, 2024
Had this very issue on a Windows 11 installation and after reading through all comments here I noticed that indeed the
wsl.execopies that get installed and are available on the standardPATHaren't really the actual executables, unless they get replaced or something gets changed after reboot/repair, but debugging through the instances ofwsl.exeon the system:Since while running
dir /s \wsl.exefound many other copies in many directories includingC:\Program Files\WSL\wsl.exeI ended up testing executing the same command with that one:That file seems to be much bigger than the ones on the path:
So not sure if the other ones are stubs or some sort of "symbolic link" to the actual ones but they don't seem to work out of the box after installing and rebooting.
Knufle commentedon Jun 3, 2025
Just for future reference, I was also a victim of this weird error after a Windows 10 system restore that showed a weird error upon finishing. I tried what other people said above, Repair, Reset, none of them worked.
What actually worked for me was reinstalling it like you suggested, thanks!
shiftonetothree commentedon Jun 29, 2025
I delete this two file then fix this issue
DanielAtCosmicDNA commentedon Sep 4, 2025
After testing other solutions here, this was the only one that worked for me...
I tried the following solutions previously but unfortunately none of them worked: