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

winget upgrade is not working (Failed in attempting to update the source: winget)

Open vishnu-itachi opened this issue 1 year ago • 21 comments

Brief description of your issue

Hi, since 1 week or so winget is not working at all. This is what I get

➜winget upgrade
Failed in attempting to update the source: winget
Failed when searching source; results will not be included: winget
No installed package found matching input criteria.

Updating the source I get the following:

➜ winget source update
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
Cancelled

Now running with verbose logs:

➜ winget source update --verbose-logs --logs

gives me log file which has one error :

2025-01-28 22:47:54.327 [CORE] Adding chain to pinning configuration [Microsoft Store Source]:
DigiCert Global Root G3 : PublicKey
  Microsoft Azure ECC TLS Issuing CA 04 : Subject | Issuer
    sfdataservice.microsoft.com : Subject | Issuer
2025-01-28 22:47:54.327 [CORE] Adding chain to pinning configuration [Microsoft Store Source]:
DigiCert Global Root G3 : PublicKey
  Microsoft Azure ECC TLS Issuing CA 04 : Subject | Issuer
    sfdataservice.microsoft.com : Subject | Issuer
2025-01-28 22:47:54.327 [CORE] Setting action: Get, Type: Standard, Name: sources_metadata
2025-01-28 22:47:54.327 [YAML] Detected UTF-8
2025-01-28 22:47:54.327 [REPO] Named source to be updated, found: winget
2025-01-28 22:47:54.333 [CORE] Did not find extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-01-28 22:47:54.333 [CORE] Retrieving headers from url: https://cdn.winget.microsoft.com/cache/source2.msix
2025-01-28 22:47:55.128 [FAIL] WindowsPackageManager.dll!00007FFE504FB4D5: LogHr(1) tid(5d04) 80072F06 
2025-01-28 22:47:55.128 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\PreIndexedPackageSourceFactory.cpp(125)\WindowsPackageManager.dll!00007FFE507E453F: (caller: 00007FFE5070922E) LogHr(2) tid(5d04) 80072F06     Msg:[PreIndexedPackageUpdateCheck failed on location: https://cdn.winget.microsoft.com/cache/source2.msix -- winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:47:55.128 [CORE] Retrieving headers from url: https://cdn.winget.microsoft.com/cache/source.msix
2025-01-28 22:47:55.879 [FAIL] WindowsPackageManager.dll!00007FFE504FB4D5: LogHr(3) tid(5d04) 80072F06 
2025-01-28 22:47:55.879 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\PreIndexedPackageSourceFactory.cpp(125)\WindowsPackageManager.dll!00007FFE507E453F: (caller: 00007FFE5070922E) LogHr(4) tid(5d04) 80072F06     Msg:[PreIndexedPackageUpdateCheck failed on location: https://cdn.winget.microsoft.com/cache/source.msix -- winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:47:55.879 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\RepositorySource.cpp(96)\WindowsPackageManager.dll!00007FFE507E2355: (caller: 00007FFE506EF2F3) LogHr(5) tid(5d04) 80072F06     Msg:[winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:47:55.879 [REPO] Source add/update failed, waiting 8281 milliseconds and retrying: winget
2025-01-28 22:48:04.164 [CORE] Did not find extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2025-01-28 22:48:04.164 [CORE] Retrieving headers from url: https://cdn.winget.microsoft.com/cache/source2.msix
2025-01-28 22:48:04.923 [FAIL] WindowsPackageManager.dll!00007FFE504FB4D5: LogHr(6) tid(5d04) 80072F06 
2025-01-28 22:48:04.923 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\PreIndexedPackageSourceFactory.cpp(125)\WindowsPackageManager.dll!00007FFE507E453F: (caller: 00007FFE5070922E) LogHr(7) tid(5d04) 80072F06     Msg:[PreIndexedPackageUpdateCheck failed on location: https://cdn.winget.microsoft.com/cache/source2.msix -- winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:48:04.923 [CORE] Retrieving headers from url: https://cdn.winget.microsoft.com/cache/source.msix
2025-01-28 22:48:05.697 [FAIL] WindowsPackageManager.dll!00007FFE504FB4D5: LogHr(8) tid(5d04) 80072F06 
2025-01-28 22:48:05.697 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\PreIndexedPackageSourceFactory.cpp(125)\WindowsPackageManager.dll!00007FFE507E453F: (caller: 00007FFE5070922E) LogHr(9) tid(5d04) 80072F06     Msg:[PreIndexedPackageUpdateCheck failed on location: https://cdn.winget.microsoft.com/cache/source.msix -- winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:48:05.697 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\RepositorySource.cpp(956)\WindowsPackageManager.dll!00007FFE507E2ED7: (caller: 00007FFE505BB012) LogHr(10) tid(5d04) 80072F06     Msg:[winrt::hresult_error: The host name in the certificate is invalid or does not match] 

2025-01-28 22:48:05.697 [REPO] Failed to update source: winget
2025-01-28 22:48:05.940 [CLI ] Leaf command succeeded: root:source:update

I tried almost all methods present in other github issues No specific order

➜ Get-History | grep winget
   1       12.388 winget upgrade --all
   2        7.731 winget source update
   3       11.973 winget source update --verbose-logs --logs
   4        2.975 sudo winget source update --force
   5       10.906 sudo winget source update
   6        0.226 winget source reset --force
   7        2.721 sudo winget source reset --force
   8       16.140 winget upgrade --all
   9        0.219 wget https://cdn.winget.microsoft.com/cache/source.msix
  10        0.264 winget settings --enable BypassCertificatePinningForMicrosoftStore
  11        2.806 sudo winget settings --enable BypassCertificatePinningForMicrosoftStore
  12        8.510 winget upgrade --all
  13        0.252 winget --version
  14        9.711 winget upgrade
  15       10.501 winget source update
  16        1.579 winget source update --verbose-logs --logs
  18        0.103 histry | grep winget

Nothing worked.

Finally accessing the CDN on the browser shows:

Image

Doing wget shows the following:

# WSL
❯❯ ~                                                                                                       22:51:58
 wget https://cdn.winget.microsoft.com/cache/source.msix
--2025-01-28 22:52:19--  https://cdn.winget.microsoft.com/cache/source.msix
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving cdn.winget.microsoft.com (cdn.winget.microsoft.com)... 152.195.19.97
Connecting to cdn.winget.microsoft.com (cdn.winget.microsoft.com)|152.195.19.97|:443... connected.
The certificate's owner does not match hostname ‘cdn.winget.microsoft.com’

# Windows Powershell
➜ curl https://cdn.winget.microsoft.com/cache/source.msix
curl: (60) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the webpage mentioned above.

Hope I have given enough info.

Steps to reproduce

Expected behavior

should update or show upgrades

Actual behavior

Environment

➜ winget --version
v1.9.25200

vishnu-itachi avatar Jan 28 '25 17:01 vishnu-itachi

We've found some similar issues:

  • #2666 , similarity score: 85%
  • #4224 , similarity score: 82%

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

similar-issues-ai[bot] avatar Jan 28 '25 17:01 similar-issues-ai[bot]

The SSL certificate you are getting when accessing https://cdn.winget.microsoft.com/cache/ is not for the right domain for some reason.

What domain is the cert for? You can check that by clicking on the "Not secure" message in your browser's address bar. If the cert domain is correct, what is it's certification path/hierarchy? Do you happen to have a proxy or something else that would be intercepting the connection?

florelis avatar Jan 28 '25 21:01 florelis

Hi. This is the domain

Image

And this is the hierarchy

Image

Also, I am not behind any proxy. It's the normal ISP internet. Nothing has changed recently.

vishnu-itachi avatar Jan 29 '25 04:01 vishnu-itachi

@vishnu-itachi - does https://cdn.winget.microsoft.com/cache/source2.msix work for you?

Trenly avatar Jan 29 '25 17:01 Trenly

it's the same :(

Image

Image

vishnu-itachi avatar Jan 29 '25 17:01 vishnu-itachi

Having exactly the same issue. Winget worked fine in the past.

bnystrom avatar Jan 29 '25 20:01 bnystrom

Thanks for reporting this. It doesn't seem to affect all CDN end points, we're looking into it.

denelon avatar Jan 29 '25 21:01 denelon

@vishnu-itachi @bnystrom Can you provide information about the region where this requests are failing for cert reasons.

hackean-msft avatar Jan 29 '25 22:01 hackean-msft

If you mean to ask which region I am hitting the requests, then it's India, Bangalore. Not sure if this is the answer you are expecting

vishnu-itachi avatar Jan 30 '25 05:01 vishnu-itachi

Btw I just tried to hit the cdn urls on my mac using same wifi and both URLs are working. So its windows only issue not the internet.

vishnu-itachi avatar Jan 30 '25 19:01 vishnu-itachi

@vishnu-itachi - does https://cdn.winget.microsoft.com/cache/source2.msix work for you?

When I try that link I get "the request is blocked"

Windows 10, Central US.

bnystrom avatar Jan 30 '25 19:01 bnystrom

We've isolated this to the CDN service we're using. We've raised an incident report with them.

denelon avatar Jan 31 '25 19:01 denelon

Now I am getting a different error:

>> curl https://cdn.winget.microsoft.com/cache/source.msix                                                                                                                                                               
curl: (28) Failed to connect to cdn.winget.microsoft.com port 443 after 21451 ms: Could not connect to server

Is there a way I can configure a different CDN and make the update?

vishnu-itachi avatar Feb 05 '25 03:02 vishnu-itachi

I am also running into this same issue. Cannot connect to https://cdn.winget.microsoft.com/cache.

EDIT: it looks like I had a bad entry in my C:\Windows\System32\drivers\etc\hosts file. Clearing out the entry for the URI in question and running ipconfig /flushdns got me back in business

and-jacob avatar Feb 08 '25 00:02 and-jacob

Thanks a lot!!! , it finally resolved my issue

vishnu-itachi avatar Feb 09 '25 08:02 vishnu-itachi

tried all of the above including reinstall winget and choco using chrititus winutil still got 0x80072ee7 0x80072efd

winget source list Name Argument Explicit

msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0 false winget https://cdn.winget.microsoft.com/cache false

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

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 Enabled InstallerHashOverride Disabled LocalArchiveMalwareScanOverride Disabled ProxyCommandLineOptions Disabled DefaultProxy Disabled C:\WINDOWS\System32 

PS C:\Users\tony> winget -v v1.9.25200

errors 0x80072ee7 0x80072efd

been tring to fix this for 3weeks need a breather

clfmoher avatar Feb 14 '25 17:02 clfmoher

Based on what @vishnu-itachi and I experienced, it was an issue with the hosts file. Can you confirm there are no entries in there for cdn.winget.microsoft.com ?

If there are not, is there a static entry from your DNS server?

I was able to track down the issue to my hosts file by CURLing https://cdn.winget.microsoft.com/cache/source.msix on my affected Windows machine to no result, and again on another machine in the same network successfully.

and-jacob avatar Feb 14 '25 17:02 and-jacob

I have been experiencing this issue for a couple weeks now on my personal machine. I want to confirm that the fix from @and-jacob worked for me. It is a strange issue, because I have not edited my host file on my personal machine at all. Was this faulty hosts entry generated by winget?

phil-harmoniq avatar Feb 16 '25 19:02 phil-harmoniq

My issues were resolved finally by going into the windows TEMP folder and deleting the winget folder. I'm guessing that permissions were changed somehow, and that happened after I once again attempted to use the "UniGetUI" interface (never works well for me and I always go back to cli)

bnystrom avatar Feb 20 '25 23:02 bnystrom

Hi, I'm not sure if re-opening is the best thing to do, but I'd like to warn that from the last two days I'm encountering problems with https://cdn.winget.microsoft.com/cache/source.msix

No file is downloaded. Would I ask if https://cdn.winget.microsoft.com/cache/source2.msix has the same information, that URL works

Thanks in advance

doncicuto avatar Apr 10 '25 12:04 doncicuto