Skip to content
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

0xc0000022 startup error when opening wt from file explorer or Run window #7081

Closed
JakubKoralewski opened this issue Jul 26, 2020 · 51 comments
Closed
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely.

Comments

@JakubKoralewski
Copy link

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.959]
Windows Terminal version (if applicable): 1.1.2021.0

Any other software?

Found this in my PATH:

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

Alias settings:
image

I tried turning my computer off and on again 😉 This error started popping up very recently, maybe I could try to install an old version to try to find the one that triggers this. I install from Windows Store, and don't really know how to do that.
I think this shows the time of last update:
image
I think the time when the bug started to appear might coincide.

Steps to reproduce

Type wt in the file explorer, or Run window.

It works if I search for wt and open it. Also works if I navigate to C:\Users\<USERNAME>\AppData\Local\Microsoft\WindowsApps and run it manually. Doesn't work though from both the Run window and file explorer.

I also tried typing wt in the Run window, then pressing Ctrl+Shift+Enter, a popup appeared to ask for permission, but the same error appeared after allowing.

Expected behavior

It opens.

Actual behavior

I get 0xc0000022 error
image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jul 26, 2020
@DHowett
Copy link
Member

DHowett commented Jul 26, 2020

If you turn this switch off and on again, does it work?

image

Can you open up Command Prompt and run where wt? I wonder if there is another copy somewhere that is broken.

@DHowett DHowett added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 26, 2020
@JakubKoralewski
Copy link
Author

If you turn this switch off and on again, does it work?

Unfortunately not.

Can you open up Command Prompt and run where wt? I wonder if there is another copy somewhere that is broken.

From command prompt:

C:\Windows\System32>where wt
C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe

From Windows Terminal (git bash):

$ where wt
C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe
C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.2.2022.0_x64__8wekyb3d8bbwe\wt.exe

I guess the preview shouldn't be there? And why would it only show up when called from the Windows Terminal?

I thought this was because of git bash so I changed directory into the same folder as before with Windows Terminal, but the output from git bash is kind of different:

$ where wt
C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe
(base)

Also opening from the cmd prompt by typing wt works fine. The cwd working directory is correctly assigned and all is good, but Run window and File explorer still throws the error.

Also trying to open wt from git bash:

$ wt
bash: /c/Users/Admin/AppData/Local/Microsoft/WindowsApps/wt: Permission denied
(base)

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 27, 2020
@DHowett
Copy link
Member

DHowett commented Jul 27, 2020

If you turn the non-preview one off and the preview one on, does the behavior change?

@DHowett DHowett added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jul 27, 2020
@JakubKoralewski
Copy link
Author

I uninstalled the Preview version and now everything seems to work.

If you turn the non-preview one off and the preview one on, does the behavior change?

It didn't. I restarted, tried again and it was the same error. Only difference was where wt showed only the path to WindowsApps\wt.exe and the Preview had disappeared.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 28, 2020
@DHowett
Copy link
Member

DHowett commented Jul 31, 2020

This is very strange. Thank you for reporting. Just to confirm: now that you've removed preview, it works fine? That is very unexpected 😄

@DHowett DHowett added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jul 31, 2020
@JakubKoralewski
Copy link
Author

Yes, it's been working fine since I removed Preview. Seems weird, but I'm just happy everything's working 🥰 . Also since it seems tab renaming has hit stable, Preview lost the major thing I've been using it for, so all is good now in my book.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 31, 2020
@DHowett
Copy link
Member

DHowett commented Aug 4, 2020

Thanks for following up! I'm gonna close this out as not reproducing, but please do let me know if it comes back.

@DHowett DHowett closed this as completed Aug 4, 2020
@DHowett DHowett added Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Aug 4, 2020
@JakubKoralewski
Copy link
Author

please do let me know if it comes back.

It did :(
image

It seems when I type wt into the explorer it's using this path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.3.2651.0_x64__8wekyb3d8bbwe\wt.exe (it flashes very briefly in the explorer URL input and can be retrieved), while where wt returns a more sane C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe. And opening the first path in cmd returns the same error as running in explorer, but running the second path is not a recognized command...:

C:\Windows\System32>"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.3.2651.0_x64__8wekyb3d8bbwe\wt.exe"

C:\Windows\System32>C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe
'C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\wt.exe' is not recognized as an internal or external command,
operable program or batch file.

After the above, I tried reinstalling, but the same error happens. So I tried to uninstall it again and this time I tried removing all these folders:
image
but I can't remove it all because some files are either opened in another program or I need "SYSTEM" permissions to remove them. I tried changing one of the folder's owner to myself, but when trying to uninstall it says I need permissions from myself to uninstall.

After reinstalling, I removed %USERPROFILE%\AppData\Local\Microsoft\WindowsApps folder from user Path and now the error remains when starting from the explorer, but it doesn't work at all when typed into the cmd:

C:\Windows\System32>wt.exe
'wt.exe' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>where wt
INFO: Could not find files for the given pattern(s).

Is there a way to force the use of %USERPROFILE%\AppData\Local\Microsoft\WindowsApps instead of C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.3.2651.0_x64__8wekyb3d8bbwe ?

@DHowett
Copy link
Member

DHowett commented Sep 28, 2020

This usually happens when you change the permissions on C:\Program Files\WindowsApps. It is an important part of the app platform on Windows and not something Terminal can recover from when it is broken.

Given that you had no trouble accessing that folder, consider restoring the permissions and removing and reinstalling all instances of Terminal so that they get put back with the correct permissions.

@JakubKoralewski
Copy link
Author

JakubKoralewski commented Oct 18, 2020

This is crazyyy. I did a restore first with and then without keeping data, but the WindowsApps permissions problem was still there, where the Windows Store or any other built-in app for that matter would not turn on. I am now very finickly at a reverse stage where it works when called from the explorer, but doesn't (incorrect parameter) when called from a shortcut.

I have no idea how a permission problem can persist after system reinstall. This is crazy. I guess somehow it's in the cloud in my Windows user profile... 🤷

EDIT: Is there a way something could have persisted if I chose to restore the system? Is it identical to a clean install cause I want to get rid of this for goood

EDIT2: 🎉 solution as simple as drive format, ez fix 😄

@zachHixson
Copy link

I am getting this issue starting this morning. Windows updated something (I think security related) and when I booted up I get the same error. Unfortunately for me, drive formatting isn't really an option as it's just not worth it.

Currently I'm just switching back to powershell, but it would be nice if there was a fix/solution for this

@dwright726
Copy link

I too started getting this error out of the blue this morning no updates have been applied (to my knowledge) worked yesterday afternoon, I've already spent 1-2hours trying to figure it out. My answer is just to abandon the terminal all together this is the second time I have ran into issues with it that has led to multiple hours of troubleshooting, at this point the benefits of wt are no longer worth the technical debt

@JamesWZM
Copy link

JamesWZM commented Mar 4, 2021

icacls does not work for me at all!

The WindowsTerminal.exe is still available, but wt.exe just won't work and returns to me a 0xc0000022 error.
I have no idea what has happened to it. It's still working well yesterday and I have not restarted my computer.

Also, OpenConsole.exe returns to me the same error.

It is amazing that, in shell (any shell including cmd, pwsh...), command "wt" worked well. But it just won't work with double click or Win+R run

@wuqiling97
Copy link

icacls not working, but I found a workaround:

  • Uninstall Windows Terminal.
  • Goto Settings → System → Storage → Change where new content is saved and change "New apps will save to" from C: to D:.
  • Install Windows Terminal.

Then I can run wt from Run window.

@zachHixson
Copy link

Great workaround! Wouldn't be surprised if a future update breaks this folder too though

@Gameghostify
Copy link

Happened to me again as well. Same thing as last time, taking ownership of the folder the app is in fixed the issue

@barnemesh
Copy link

A solution I found-
changing the values in the following registries:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe
from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

@zachHixson
Copy link

Changing the registry path worked like a charm. Since it points to an AppData folder, I think this should be the default as we wouldn't ever have to worry about security bugs like this

@DHowett
Copy link
Member

DHowett commented Apr 9, 2021

security bugs like this

App packages are installed and registered per-user; this is the only effective way to give users specific control over which app package is invoked :)

@zachHixson
Copy link

Ok. Also it broke again so I retract my previous statement. Don't know why it only worked once or twice, registry entries are still the new value so idk what is going on anymore

@mihirsavadi
Copy link

A solution I found-
changing the values in the following registries:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe
from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

This worked perfectly!!!!!!!!! Tried literally everything else in this thread only more problems, but this worked

@pashza
Copy link

pashza commented Jan 30, 2022

I was able to fix the issue by resetting permissions to the WindowsApps folder. wt works as expected after running the command below in an elevated PowerShell:

icacls "C:\Program Files\WindowsApps" /reset /t /c /q

This worked perfectly!

@PennRobotics
Copy link

For anyone else who messed up their WindowsApps permissions running the command above, running the script at https://github.com/AgentRev/WindowsAppsUnfukker made everything (mostly) well again. Except now Windows Store thinks Terminal Preview is installed while it cannot be found via Start Menu or Add/Remove Programs. (It is, in fact, installed.)

@liudonghua123
Copy link

A solution I found- changing the values in the following registries: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

This method works for me. I found that "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\wt.exe" is a uwp, and can not directly run. You should run %LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe (It's a zero sized file, maybe called app execution alias) instead.

image

image

But I find other items in Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths are using path like C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.51.3.0_x64__8wekyb3d8bbwe.

@plutonium-239
Copy link

@liudonghua123 Thank you so much!
Finally works after 6 months lol

@Anonymous87549236
Copy link

@LeoZeolite
Copy link

A solution I found- changing the values in the following registries: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

This method works for me.

@petryaevve
Copy link

A solution I found- changing the values in the following registries: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

This method works for me. I found that "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\wt.exe" is a uwp, and can not directly run. You should run %LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe (It's a zero sized file, maybe called app execution alias) instead.

image image

But I find other items in Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths are using path like C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.51.3.0_x64__8wekyb3d8bbwe.

Thanks!!! It works good

@ghost
Copy link

ghost commented Mar 5, 2023

Why won't Microsoft fix this registry issue on Windows Terminal installation?

@smurpau
Copy link

smurpau commented Nov 17, 2023

I've run into this issue as well, reproducibly, by building a Hyper-V VM with Vagrant, the "gusztavvargadr/windows-10-22h2-enterprise-nocm" base box, chocolatey, and choco install microsoft-windows-terminal (tried the latest version as well as 1.18.2822.0 which is running fine on my host Win10 machine).

icacls "C:\Program Files\WindowsApps" /reset /t /c /q doesn't work, nor does the registry change.

@r1ght0us
Copy link

r1ght0us commented Dec 7, 2023

我找到的解决方案-更改以下注册表中的值: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe 从 C:\Program Files\WindowsApps\ 路径更改为 C:\用户\用户名\应用程序数据\本地\微软\WindowsApps\

这个方法对我有用。我发现"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\wt.exe"是一个uwp,并且不能直接运行。您应该运行%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe(这是一个零大小的文件,可能称为应用程序执行别名)。

图像 图像

但我发现其他项目Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths正在使用类似的路径C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.51.3.0_x64__8wekyb3d8bbwe

thanks, this work for me

@petryaevve
Copy link

A solution I found- changing the values in the following registries: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\wt.exe from the C:\Program Files\WindowsApps\ path, to the path in C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\

Thank you! It's working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Tag-Fix Doesn't match tag requirements Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely.
Projects
None yet
Development

No branches or pull requests