microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.18k stars 1.45k forks source link

Failed in attempting to update the source: winget #3525

Open nirgranth opened 1 year ago

nirgranth commented 1 year ago

Brief description of your issue

Failed in attempting to update the source: winget when running anything

Steps to reproduce

Run a winget command

Expected behavior

No Errors

Actual behavior

Failed in attempting to update the source: winget

Environment

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

Windows: Windows.Desktop v10.0.22621.2134
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.2201.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
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

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
stephengillie commented 1 year ago
brookst commented 1 year ago

I'm seeing the same. Here's an extract from my logs with a really weird error:

2023-09-13 14:33:55.027 [CORE] Downloading to path: C:\Users\Tim\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix
2023-09-13 14:33:55.027 [CORE] Started applying motw to C:\Users\Tim\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix with zone: 3
2023-09-13 14:33:55.028 [CORE] Finished applying motw
2023-09-13 14:33:55.028 [CORE] WinINet downloading from url: https://cdn.winget.microsoft.com/cache/source.msix
2023-09-13 14:33:55.029 [CORE] Download completed.
2023-09-13 14:33:55.029 [CORE] Starting AddPackage operation #1: file:///C:/Users/Tim/AppData/Local/Temp/WinGet/Microsoft.Winget.Source_8wekyb3d8bbwe.msix SkipSmartScreen: 1
2023-09-13 14:33:55.030 [CORE] Begin waiting for operation #1
2023-09-13 14:33:55.030 [CORE] Begin blocking for operation #1
2023-09-13 14:33:55.034 [CORE] Deployment operation #1: Common::Deployment::MsixvcStagingSession::GetManifestReader in MsixvcStagingSession failed with error 0x80070570.
2023-09-13 14:33:55.034 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(54)\WindowsPackageManager.dll!00007FFC895B14EF: (caller: 00007FFC895B1B7F) Exception(2) tid(cdd0) 80070570 The file or directory is corrupted and unreadable.
    Msg:[Operation failed: Common::Deployment::MsixvcStagingSession::GetManifestReader in MsixvcStagingSession failed with error 0x80070570.] 

2023-09-13 14:33:55.042 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerRepositoryCore\RepositorySource.cpp(671)\WindowsPackageManager.dll!00007FFC8972B49E: (caller: 00007FFC89508C2A) LogHr(2) tid(cdd0) 80070570 The file or directory is corrupted and unreadable.
    Msg:[D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(54)\WindowsPackageManager.dll!00007FFC895B14EF: (caller: 00007FFC895B1B7F) Exception(2) tid(cdd0) 80070570 The file or directory is corrupted and unreadable.
    Msg:[Operation failed: Common::Deployment::MsixvcStagingSession::GetManifestReader in MsixvcStagingSession failed with error 0x80070570.] 
] 

2023-09-13 14:33:55.042 [REPO] Failed to update source: winget

The file C:/Users/Tim/AppData/Local/Temp/WinGet/Microsoft.Winget.Source_8wekyb3d8bbwe.msix is 0B but downloading from https://cdn.winget.microsoft.com/cache/source.msix gives an 8MB file which I assume is correct.

The log seems to indicate that the source download was complete. I would have expected some kind of error with the download if it wrote zero bytes of data from the request. It looks like it just tries to parse it regardless and of course can't read anything.

g0t4 commented 1 year ago

Sounds like there are currently CDN issues: https://github.com/microsoft/winget-cli/issues/3652#issuecomment-1734652549

HenkPoley commented 1 year ago

What resolved "Failed in attempting to update the source: winget" for me:

  1. Download this file: https://cdn.winget.microsoft.com/cache/source.msix (e.g. with Edge)
  2. Open the Downloads folder
  3. Right-click, choose install, follow the wizard to install the package.

No clue why this is necessary. Source list remains the same:

PS C:> winget source list
Name    Argument
-----------------------------------------------------
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0
winget  https://cdn.winget.microsoft.com/cache

Yes, I did run the command mention at the top here: https://github.com/microsoft/winget-cli/issues/3652#issue-1907725867

But I was running a more recent version anyways (1.5? 1.6.??).