winget-cli: Windows cannot access the folder where the download happens during 'upgrade'

Brief description of your issue

when i try a winget upgrade ‘package’ for a package that installs in program files, i get the attached error. I am running in standard user mode. I am sure that admin has access to the folder. image

Steps to reproduce

type winget upgrade ‘package name’ wait for the download type in the admin password get the error message

Expected behavior

I expected the program to install properly

Actual behavior

The application errors out and does not install if it requires admin

Environment

Windows Package Manager v1.4.10173
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.1265
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.10173.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

The problem is with the temp directory winget uses for install. This is located at %LOCALAPPDATA%\temp\WinGet and simply has insufficient permissions for an elevated permission install. So effectively the given admin account is unable to read files from this directory. Unfortunately, it doesn’t help to adjust the permissions for this directory manually, because winget resets it during upgrade.

This problem already persists for months now and I’ve no clue why this hasn’t been fixed yet. Actually it should affect many users, if not all uses.

cc @denelon Resolved in #2945

I can confirm it’s working with the preview version (v1.5.1081-preview) 👍

This bug is already fixed in the 1.5 version. You may download the preview version in the Releases tab and I can confirm that this issue is no longer present.

@io43 I tried to do what you said, But from the admin command, I get this:

Winget uninstall 7zip.7zip
No installed package found matching input criteria.

I tried with the “Runas” command with different switches: “/profile”, “/noprofile”, “/env”, and no switch at all and I always get that error. I even tried running “cmd” from the start menu as administrator, but still the same result.

From my normal user, the package will be found, but I will get the error from the original poster.

That’s why I switched to chocolatey. There I have to run the console as admin as well, but at least this works.