winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Windows cannot access the folder where the download happens during 'upgrade'

Open coeus89 opened this issue 2 years ago • 3 comments

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

coeus89 avatar Feb 18 '23 18:02 coeus89

This happens for most applications that require admin. something about not being able to access the network or directory. but the directory has full privileges.

coeus89 avatar Feb 18 '23 18:02 coeus89

image

coeus89 avatar Feb 18 '23 18:02 coeus89

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.

Facing the exact same issue.

PapysGit avatar Feb 26 '23 14:02 PapysGit

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.

jdelker avatar Mar 11 '23 13:03 jdelker

I saw this too. When trying to install "7zip.7zip": Winget install 7zip.7zip

I got the problem mentioned by the original poster. It seems to be related to the repository and happening with user elevation. If I use this instead: winget install "7-zip" --source msstore

Then it will install. So, I guess other repositories are buggy

jmeile avatar Mar 17 '23 18:03 jmeile

This has been a consistent problem for me and a main reason why I must still rely on other package managers.

Prometheus720 avatar Mar 19 '23 18:03 Prometheus720

I face the exact same issue.

loooooooooooor avatar Mar 31 '23 13:03 loooooooooooor

I also face this issue for anything requiring admin. I was trying to install Oracle.Virtualbox but I also tried to upgrade existing packages, and it failed with the same network error.

static0verdrive avatar Apr 16 '23 23:04 static0verdrive

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.

What I can't understand is why it doesn't affect every package that needs admin elevation. Some of the programs I have installed can still be updated via winget, others can't.

niStee avatar Apr 27 '23 12:04 niStee

@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.

jmeile avatar Apr 29 '23 12:04 jmeile

I moved away from winget to scoop because of this specific bug. My work laptop is configured to use a non-admin account for everyday work and occasionally use a different admin account to run stuff elevated.

thesobercoder avatar Apr 30 '23 18:04 thesobercoder

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.

ondrejsv avatar May 13 '23 09:05 ondrejsv

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

akaegi avatar May 16 '23 06:05 akaegi

Yes, working well on current preview

adrian-cancio avatar May 18 '23 05:05 adrian-cancio

cc @denelon Resolved in #2945

mdanish-kh avatar May 18 '23 16:05 mdanish-kh