winget-cli: Discord does not install
Brief description of your issue
When trying to install Discord via winget, installer throws an error about lack of permission to copy file. Doesn’t matter if this is done via Windows Terminal launched as admin or not (in the latter case, error left in console is different and only second error from attached screenshot is displayed).
Steps to reproduce
- Launch Windows Terminal as admin
- Issue
winget install Discord
command
Expected behavior
Discord installs properly
Actual behavior
Installation fails
Environment
Windows Package Manager v0.1.41331
Windows: Windows.Desktop v10.0.19041.264
Package: Microsoft.DesktopAppInstaller v1.0.41331.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 24
- Comments: 36 (9 by maintainers)
+1, a bunch of apps all failed to install for me with this same error.
I reckon there’ve been no fixes from Microsoft because
Git.Git
also doesn’t install.Some info that may help investigate: I also hit the “Unable to write to C:\ProgramData\ - IT Policies may be restricting writing to this folder” issue. For me the problem was that on that machine the command:
icacls "C:\Users\<user>\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\TempState"
showedMandatory Label\Low Mandatory Level:(OI)(CI)(NW)
This was getting inherited to files in the \TempState\WinGet folder which is where the installers are downloaded to. CDing into the TempState folder and running:icacls c:WinGet /setintegritylevel m
fixed the issue for me. (Possibly there’s a better command to just break the inheritance rather than set to medium explicitly) On other machines I do not see that the TempState folder has this low mandatory label, so I’d speculate that it’s either something about different initialization paths for the folder or possibly a version that some machines upgraded through but others skipped.So yeah, wouldn’t be surprised if repair and reset fixes it since those likely recreate the permissions on the appdata as well.
Decided to follow @electronic-dk and run
Get-AppxPackage -Name "Microsoft.DesktopAppInstaller" | Reset-AppxPackage
and now it works for me as well.I’m seeing the same behaviour in winget v1.0.11451 trying to install GitHub.GitHubDesktop (2.8.2) from an elevated prompt. winget sees the result as successful, but the windowed app shows Installation has failed - Unable to write to "C:\ProgramData\ … IT policies etc.
Found GitHub Desktop [GitHub.GitHubDesktop] This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licences to, third-party packages. Downloading https://desktop.githubusercontent.com/releases/2.8.2-4423bb9d/GitHubDesktopSetup-x64.exe ██████████████████████████████ 110 MB / 110 MB Successfully verified installer hash Starting package install… Successfully installed
Looks like @icedream found it was the directory, just as you did @sreadingMSFT . Most likely the issue has been this ACL the entire time, and we need to ensure that our temp directory does not inherit it.
Good to know that the repair and/or reset is fixing it while we work on an fix in the code to ensure that it doesn’t happen.
Same issue with
Atlassian.Sourcetree
My issue got closed as a duplicate but I get “Access Denied” and it’s definitely not installed. Seems like a lot of different behaviors are being lumped in as duplicates of this, is it all the same underlying cause?