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

When executed with sudo, agreement for applications from the msstore source does not work.

Open aetos382 opened this issue 7 months ago • 1 comments

Brief description of your issue

When I run the winget upgrade command with sudo when there is an update for an application from the msstore source, an error occurs when agreeing to the terms of use, and the upgrade cannot be performed.

I thought this issue might have the same cause as #2819 and #3122, but since they do not mention sudo, I am reporting it just in case.

Applications from winget sources can be updated without any problems with sudo.

Steps to reproduce

run sudo winget upgrade XP8CBJ40XLBWKX

The XP8CBJ40XLBWKX is the ID for Docker Desktop.

Expected behavior

Docker Desktop is updated successfully.

Actual behavior

Error occurred while confirming agreement to terms of use

Entire outputs

Found Docker Desktop [XP8CBJ40XLBWKX] Version 4.41.2 This application is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Agreements for Docker Desktop [XP8CBJ40XLBWKX] Version 4.41.2 Version: 4.41.2 Publisher: Docker, Inc Publisher Url: https://www.docker.com/ Publisher Support Url: https://www.docker.com/support License: Commercial use of Docker Desktop at a company of more than 250 employees OR more than $10 million in annual revenue requires a paid subscription (Pro, Team, or Business).

Full terms: https://www.docker.com/legal Privacy Url: https://www.docker.com/legal/docker-privacy-policy Copyright: © 2024 Docker Inc. All rights reserved Agreements: Category: Developer tools Pricing: Free Free Trial: No Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction Seizure Warning: https://aka.ms/microsoft-store-seizure-warning Store License Terms: https://aka.ms/microsoft-store-license

The publisher requires that you view the above information and accept the agreements before installing. Do you agree to the terms? [Y] Yes [N] No: An unexpected error occurred while executing the command: 0x8a150042 : Error reading input in prompt

Environment

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

Windows: Windows.Desktop v10.0.26100.3194
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.25.390.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads
Configuration Modules              %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

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

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled

aetos382 avatar May 08 '25 04:05 aetos382

sudo has three modes of execution: run in a new window, run with input disabled, and run inline. I'm guessing that you are running with the "input disabled" option, so when winget attempts to prompt for you to accept the agreements it fails because there is no input to read whether you accepted or declined.

If you're running with the "input disabled" mode, you can add the --disable-interactivity flag to winget and it will give you a more helpful error. In this case you would get One or more of the source agreements were not agreed to. Operation cancelled. Please accept the source agreements or remove the corresponding sources.

You could either run sudo with a different setting (which I think is not the best, security-wise), accept the source agreements separately, or add --accept-source-agreements to the command

florelis avatar May 08 '25 18:05 florelis

I see, thanks.

aetos382 avatar Oct 03 '25 08:10 aetos382