winget-cli: winget source update is not available

Brief description of your issue

When I run this command, the terminal is stuck at the following screen image It only shows the path where I am and the process cannot be ended log

2022-01-27 03:02:11.971 [CORE] WinGet, version [1.2.3411-preview], activity [{BE59B699-D786-4CB8-9F77-6E011F6EF80F}]
2022-01-27 03:02:11.972 [CORE] OS: Windows.Desktop v10.0.19044.1503
2022-01-27 03:02:11.972 [CORE] Command line Args: "C:\Users\29422\AppData\Local\Microsoft\WindowsApps\winget.exe" source update
2022-01-27 03:02:11.972 [CORE] Package: Microsoft.DesktopAppInstaller v1.17.3411.0
2022-01-27 03:02:11.972 [CORE] IsCOMCall:0; Caller: winget-cli
2022-01-27 03:02:11.990 [CLI ] WinGet invoked with arguments: 'source' 'update'
2022-01-27 03:02:11.990 [CLI ] Found subcommand: source
2022-01-27 03:02:11.990 [CLI ] Found subcommand: update
2022-01-27 03:02:11.990 [CLI ] Leaf command to execute: root:source:update
2022-01-27 03:02:11.990 [CLI ] Executing command: update
2022-01-27 03:02:11.993 [REPO] GetCurrentSourceRefs: Source named 'microsoft.builtin.desktop.frameworks' from origin Default is hidden and is dropped.
2022-01-27 03:02:12.013 [REPO] Named source requested, found: msstore
2022-01-27 03:02:12.014 [REPO] Named source to be updated, found: msstore
2022-01-27 03:02:12.126 [REPO] Named source requested, found: winget
2022-01-27 03:02:12.129 [REPO] Named source to be updated, found: winget

Steps to reproduce

1.run windows terminal 2.Input winget source update 3.press enter

Expected behavior

command will run normally and end

Actual behavior

It gets stuck and shows strange things

Environment

Windows Package Manager (Preview) v1.2.3411-preview
Windows: Windows.Desktop v10.0.19044.1503
程序包: Microsoft.DesktopAppInstaller v1.17.3411.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I have exactly the same issue like you, and actually EVERY winget command would get stuck.

This solution works for me. Change the dns server to 4.2.2.2 and 4.2.2.1 and retry. (or some other dns servers I guess)

Reason for this: I ran

winget source update --versboe-logs

after runing the command

winget source reset --force

Then I checked the logs and found things below:

2022-03-04 17:42:14.923 [CORE] Did not find extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2022-03-04 17:42:14.923 [CORE] Downloading to path: C:\Users\D~1\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix
2022-03-04 17:42:14.923 [CORE] Started applying motw to C:\Users\D~1\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix with zone: 3
2022-03-04 17:42:14.926 [CORE] Finished applying motw
2022-03-04 17:42:14.926 [CORE] WinINet downloading from url: https://winget.azureedge.net/cache/source.msix
2022-03-04 17:42:19.624 [CORE] Download request status success.
2022-03-04 17:42:19.624 [CORE] Download size: 3350977
2022-03-04 17:42:59.804 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Downloader.cpp(94)\AppInstallerCLI.exe!00007FF629C06A56: (caller: 00007FF629C07422) Exception(1) tid(9a4) 80072F78     Msg:[InternetReadFile() failed.] 

2022-03-04 17:42:59.820 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerRepositoryCore\RepositorySource.cpp(681)\AppInstallerCLI.exe!00007FF629D57CA1: (caller: 00007FF629C5F58C) LogHr(1) tid(9a4) 80072F78     Msg:[D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Downloader.cpp(94)\AppInstallerCLI.exe!00007FF629C06A56: (caller: 00007FF629C07422) Exception(1) tid(9a4) 80072F78     Msg:[InternetReadFile() failed.] 
] 

2022-03-04 17:42:59.820 [REPO] Source add/update failed, waiting a bit and retrying: winget
2022-03-04 17:43:21.466 [CORE] Did not find extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2022-03-04 17:43:21.466 [CORE] Downloading to path: C:\Users\D~1\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix
2022-03-04 17:43:21.466 [CORE] Started applying motw to C:\Users\D~1\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix with zone: 3
2022-03-04 17:43:21.469 [CORE] Finished applying motw
2022-03-04 17:43:21.470 [CORE] WinINet downloading from url: https://winget.azureedge.net/cache/source.msix
2022-03-04 17:43:25.436 [CORE] Download request status success.
2022-03-04 17:43:25.436 [CORE] Download size: 3350977

It said it lacked some extension and kept retrying to download it. The [FAIL] says InternetReadFile() fails. I copied the url https://winget.azureedge.net/cache/source.msix and tried to download it manually but it failed. I’d tried to use some proxy and didn’t work. Well, it reminds me of an annoying problem of Chinese Internet so I tried to specify the dns server and it worked. Rerunning winget commands again with --verbose-logs now gives the following log

2022-03-04 17:58:30.839 [REPO] Adding to aggregated source: winget
2022-03-04 17:58:30.867 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2022-03-04 17:58:30.867 [CORE] Found matching extension.

which says the winget has found the matching extension. I’ve tried to install, update source, upgrade with DHCP set and they are still fine.

Conclusion Internet issue.

https://cdn.winget.microsoft.com/cache/source.msix is the URL to the PreIndexed package that contains the local copy of the database for the community repository.

As a workaround you may be able to download and “double click” the package to install the source for winget.

This worked for me, running 1.5.1. My situation is a little unique in that the system I’m running it on, I don’t have admin rights with the account I’m logged in as. However, I do have an account I can open a powershell window with admin rights. Additionally, the MS Store has been removed. In the elevated prompt, running as a different, it was unable to get the winget source (but was able to pull the msstore source). The regular account was able to get pull the winget source. Downloading the source.msix and installing it in the elevated prompt using Add-AppxPackage -Path source.msix seemed to resolve the issue.

Update_PS_winget.zip

Created a PowerShell script that will update PowerShell and Winget to the latest on systems with this issue.

Well, I updated the system today, and the problem was solved, I think it may be a problem with the system components

@lvzhenbo does this kind of workaround fix the issue you’re encountering?

I tried, but it didn’t solve the problem