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

Failed in attempting to update the source: winget

Open felipecrs opened this issue 5 years ago • 153 comments

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

felipecrs avatar Oct 28 '21 22:10 felipecrs

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.

jedieaston avatar Oct 28 '21 23:10 jedieaston

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.

felipecrs avatar Oct 28 '21 23:10 felipecrs

--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.

jedieaston avatar Oct 29 '21 04:10 jedieaston

Oops, got it.

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

felipecrs avatar Oct 29 '21 04:10 felipecrs

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.

JohnMcPMS avatar Oct 29 '21 21:10 JohnMcPMS

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 avatar Oct 29 '21 21:10 felipecrs

Reset-AppxPackage Microsoft.Winget.Source_2021.1027.1909.482_neutral__8wekyb3d8bbwe

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

felipecrs avatar Oct 29 '21 21:10 felipecrs

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.

JohnMcPMS avatar Oct 29 '21 22:10 JohnMcPMS

Oh no!

image

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

felipecrs avatar Oct 29 '21 22:10 felipecrs

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 avatar Oct 31 '21 23:10 felipecrs

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.

felipecrs avatar Nov 02 '21 14:11 felipecrs

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

captainhook avatar Dec 14 '21 23:12 captainhook

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

isobeyan avatar Dec 21 '21 15:12 isobeyan

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?

felipecrs avatar Dec 21 '21 16:12 felipecrs

yap. it's still the same in my case

isobeyan avatar Dec 24 '21 11:12 isobeyan

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.

felipecrs avatar Dec 24 '21 15:12 felipecrs

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 avatar Jan 25 '22 15:01 ItzLevvie

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.

ItzLevvie avatar Jan 26 '22 11:01 ItzLevvie

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

matifali avatar Aug 05 '22 06:08 matifali

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.

borozu avatar Sep 23 '22 11:09 borozu