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.28k stars 1.45k forks source link

Failed in attempting to update the source: winget #1656

Closed felipecrs closed 2 years ago

felipecrs commented 3 years ago

Brief description of your issue

I don't know exactly when this started to happen, but I'm pretty sure that it was after I ran some cleanup with CCleaner and BCUninstaller when I had some issues to uninstall a few of my programs.

Now, every time I try to run winget install or winget upgrade it fails with this error. When install, it fails but continues anyway.

I know this was probably my fault, but still, I think it would help the community to share what to do when it happens, or better yet: to allow winget to recover itself when such things happens.

I tried to do some things already, such as upgrading, downgrading (the winget cli), but none helped. I also tried to uninstall the "App Installer" but I could not find a way to do it, so that I could try to reinstall.

I also noticed that a previous issue was opened for this, but the solution mentioned isn't working for me: https://github.com/microsoft/winget-cli/issues/1066

Steps to reproduce

I'm not sure. But I would be happy to provide any information required.

Expected behavior

To not fail with this error.

Actual behavior

➜ winget upgrade --all
Failed in attempting to update the source: winget
No applicable update found.

Environment

➜ winget --info
Windows Package Manager v1.1.12702
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22000.282
Package: Microsoft.DesktopAppInstaller v1.16.12702.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

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
jedieaston commented 3 years ago

Can you run that command with --verbose-logs and post the log file?

Also: does winget source reset --force fix it? I kind of doubt it, but it seems to be able to recover from other weirdness.

felipecrs commented 3 years ago

Unfortunately, no logs are shown, and the command does not help either.

➜ winget source reset --force
This command requires administrator privileges to execute.

➜ gsudo winget source reset --force
Resetting all sources...Done

➜ winget upgrade
Failed in attempting to update the source: winget
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires current machine's geographic region to be sent to function properly.

Do you agree to all the source agreements terms?
[Y] Yes  [N] No: y
No installed package found matching input criteria.
➜ winget upgrade Microsoft.Teams --verbose-logs
Failed in attempting to update the source: winget
No applicable update found.
jedieaston commented 3 years ago

--verbose-logs dumps them to %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir, you'll have to find the file from that command and post it.

felipecrs commented 3 years ago

Oops, got it.

WinGet-2021-10-29-01-42-04.079.log

JohnMcPMS commented 3 years ago

I'm not sure what exactly is wrong with your system, but winget is failing to deploy the latest source file. Here are some things that might help you recover:

  1. Reset the source package [instructions for Win11 as it is in front of me, shouldn't be too different for Win10] a. Go to Settings (🪟 + i) > Apps > Installed Apps b. Search for Windows Package Manager Source (winget) c. Click the 3 dots on the right > Advanced Options d. Reset the package (you could try Repair but Reset is a bigger hammer and there is no data to lose) e. This will attempt to re-register the package with the system and hopefully make things happy again.
  2. Remove the winget source package a. If you tried the above and it didn't work, just use the Uninstall right there. b. Or winget source remove winget a. This will attempt to actually remove the existing source package from your system.

I agree that there is potentially something that we could do here to recover in a more automated fashion, although it would most likely be automating the removal to hopefully enable a new installation to just work. If that doesn't do it we would probably need to understand what was actually wrong to be able to mitigate.

felipecrs commented 3 years ago

Thank you very very much for the detailed suggestions, but unfortunately none worked. :(

  1. Ops:

    https://user-images.githubusercontent.com/29582865/139505776-87cc5944-0279-42d6-80a7-04ea6081045d.mp4

  2. a.:

    image b:

    ➜ gsudo winget source remove winget
    Removing source: winget...
    An unexpected error occurred while executing the command:
    Operation failed: Deployment Remove operation with target volume C: on Package Microsoft.Winget.Source_2021.1027.1909.482_neutral__8wekyb3d8bbwe from:  (Microsoft.Winget.Source_2021.1027.1909.482_neutral__8wekyb3d8bbwe)  failed with error 0x80070057. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.
    0x80070057 : The parameter is incorrect.
felipecrs commented 3 years ago
Reset-AppxPackage Microsoft.Winget.Source_2021.1027.1909.482_neutral__8wekyb3d8bbwe

This didn't help either (there was no output from this command).

JohnMcPMS commented 3 years ago

Ok, looks like you are in uncharted territories of broken. I would suggest filing feedback using https://aka.ms/appdepuif and performing any one (or all) of these actions during the repro recording step. That will collect logs from the appropriate area given the issues you are having. And also crashing Settings is a nice find, that should never happen. The owning team should see those crashes already, no extra steps required.

It might be possible to figure out how to help you from the logs but I have doubts if you can't even remove the package.

felipecrs commented 3 years ago

Oh no!

image

So I think I really messed up with my Windows installation. I will try some recover methods...

felipecrs commented 3 years ago

Update: reinstalling Windows on top of the existing installation (with the Media Creatin Tool) didn't help. dism and sfc commands neither. I will close this issue because I believe the only solution in my case will be a clean install.

Regardless, thank you very much for the help!

felipecrs commented 3 years ago

Just for completeness, I also tried to WSReset.exe and a forEach PowerShell snippet to restore the default Windows Appx packages. None worked.

So I ended up by doing a clean install (and of course it's working now).

Lesson taken: never make registry changes without a backup.

captainhook commented 2 years ago

I just managed to fix this by installing the pre-release from https://github.com/microsoft/winget-cli/releases

isobeyan commented 2 years ago

why the bug issue is closed without fixing it? clean installing windows os isn't a reasonable solution.

felipecrs commented 2 years ago

I closed the issue because in my case, other parts of Windows (apart from Winget) were also broken as mentioned here. Is it your case as well?

isobeyan commented 2 years ago

yap. it's still the same in my case

felipecrs commented 2 years ago

So, I think in this sense, this bug isn't much of Winget's concern but rather Windows itself. As mentioned in https://github.com/microsoft/winget-cli/issues/1656#issuecomment-955080920, perhaps the best would be to report in the Windows Feedback Hub.

ItzLevvie commented 2 years ago

Did you guys make some changes to C:\Windows\Temp folder ?

Running winget source update --name winget on your device will download the winget source file to C:\Users\%USERNAME%\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix and not to C:\Windows\Temp.

If you're having issues deploying the latest source file, it's likely an issue on your end; try seeing if you can repair your current installation of Windows by installing Windows on top of your current installation.

ItzLevvie commented 2 years ago

Ah I see what you mean.

It saves a few temporary files to C:\Windows\Temp but the actual source file is saved to C:\Users\%USERNAME%\AppData\Local\Temp\WinGet and then provisioned via Add-AppxPackage.

matifali commented 2 years ago

In my case I was using the 1.4 preview version reinstalling the latest 1.3.x stable version fixed the issue.

borozu commented 2 years ago

Did you guys make some changes to C:\Windows\Temp folder ?

Running winget source update --name winget on your device will download the winget source file to C:\Users\%USERNAME%\AppData\Local\Temp\WinGet\Microsoft.Winget.Source_8wekyb3d8bbwe.msix and not to C:\Windows\Temp.

If you're having issues deploying the latest source file, it's likely an issue on your end; try seeing if you can repair your current installation of Windows by installing Windows on top of your current installation.

Thanks man, it worked for me! I had the same error as OP

I've run first: "winget source update --name winget" and then "winget install --id GitHub.cli"

Thanks again.

sba923 commented 2 years ago

winget source update --name winget gets me

image

Cerebellum90 commented 2 years ago

winget source update --name winget gets me

image

Exactly the same here! Also, when running winget upgrade --all I get the warning; Failed in attempting to update the source: winget and then upates 3 of the 7 upgrades available. But without actually installing them. When running the command again, the same packages will be downloaded and installed again.

cndctr commented 2 years ago

Same things have happened on my main Windows 10 and on another machine with recently installed Windows 11 onboard.

HenkPoley commented 2 years ago

For the people dropping by:

winget source reset --force
winget upgrade

And chose 'Y' if you agree to the terms.

sba923 commented 2 years ago

For the people dropping by:

winget source reset --force
winget upgrade

And chose 'Y' if you agree to the terms.

image

Cerebellum90 commented 2 years ago

For the people dropping by:

winget source reset --force
winget upgrade

And chose 'Y' if you agree to the terms.

image
sba923 commented 2 years ago

This affects 4 (out of 4 tested) different systems here, Windows 10 and Windows 11, so feels like a server-side issue to me.

Dimension4 commented 2 years ago

Me and a colleague are also affected. +1 for the server-side issue guess.

NxBqLwa2 commented 2 years ago

I turned on VPN and winget upgrade and winget source reset --force executed successfully. I tried a US and Japanese IP, both worked.

bart-stiply commented 2 years ago

I have the same issue. (EU)

sba923 commented 2 years ago

I'm in France, so EU too.

SuperBrain commented 2 years ago

Considering the fact that this issue seems to be isolated to EU (and perhaps other regions), but US and Japan areoperational, I have a temporary workaround.

Use this to find an IP address from US, then add a line in your hosts file (%WINDIR%\System32\drivers\etc\hosts). For example, this is what I added

152.195.19.95 cdn.winget.microsoft.com

After this, run winget source update and it should properly update.

UPDATE:

Well, that worked once, but now it seems all IP addresses are returning the same result. My guess is they're all down for "maintenance" 😄

sba923 commented 2 years ago

Considering the fact that this issue seems to be isolated to EU (and perhaps other regions), but US and Japan areoperational, I have a temporary workaround.

Use this to find an IP address from US, then add a line in your hosts file (%WINDIR%\System32\drivers\etc\hosts). For example, this is what I added

152.195.19.95 cdn.winget.microsoft.com

After this, run winget source update and it should properly update.

UPDATE:

Well, that worked once, but now it seems all IP addresses are returning the same result. My guess is they're all down for "maintenance" 😄

I concur:

image

knilecrack commented 2 years ago

Same issue as well, almost reinstalled OS

Auxy6858 commented 2 years ago

Bruh, I just reinstalled windows for nothing :(

sba923 commented 2 years ago

Bruh, I just reinstalled windows for nothing :(

you should've read the thread, that was clearly pointing at a server-side issue 😜

Auxy6858 commented 2 years ago

Bruh, I just reinstalled windows for nothing :(

you should've read the thread, that was clearly pointing at a server-side issue 😜

I reinstalled before reading the thread, backed all my stuff up tho so I'm fine

nixeo commented 2 years ago

same issue

winget 2022-11-05 051848

5ubh4d45 commented 2 years ago

tried all methods. It seems most of the servers are down. msstore working fine.

image

CreaGab commented 2 years ago

I can confirm that nothing works in Europe. I even added US IP but it didn't change anything. Maybe a VPN works.

MichaelCharles commented 2 years ago

Japan here. Currently having this problem as well. November 5th, 10:30 JST

felipecrs commented 2 years ago

Guys, just in case you don't know and you really depend on winget for whatever reason: you can manually clone the winget-pkgs repository and use winget install -m path/to/manifest/folder you want to install.

congqiao commented 2 years ago

Same issue here in the US.

cmdshft commented 2 years ago

Same issue, Eastern Coast USA

aboudekahil commented 2 years ago

Same issue, Tripoli Lebanon

mwala-zm commented 2 years ago

The only workaround right now is the msstore.

aviRon012 commented 2 years ago

I have the same problem (Israel) Screenshot (2)

glen-84 commented 2 years ago

https://github.com/microsoft/winget-cli/issues/2666

hoang-himself commented 2 years ago

Same issue, Vietnam. image

NoSubstitute commented 2 years ago

Same issue, Sweden.