Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed in attempting to update the source: winget #1656

Closed
felipecrs opened this issue Oct 28, 2021 · 153 comments
Closed

Failed in attempting to update the source: winget #1656

felipecrs opened this issue Oct 28, 2021 · 153 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@felipecrs
Copy link
Contributor

felipecrs commented Oct 28, 2021

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: #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
@ghost ghost added the Needs-Triage Issue need to be triaged label Oct 28, 2021
@jedieaston
Copy link
Contributor

jedieaston commented Oct 28, 2021

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
Copy link
Contributor Author

felipecrs commented Oct 28, 2021

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...Donewinget 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
Copy link
Contributor

jedieaston commented Oct 29, 2021

--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
Copy link
Contributor Author

Oops, got it.

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

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Oct 29, 2021
@JohnMcPMS
Copy link
Member

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
Copy link
Contributor Author

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

  1. Ops:

    CQLbkOTPFE.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
Copy link
Contributor Author

felipecrs commented Oct 29, 2021

Reset-AppxPackage Microsoft.Winget.Source_2021.1027.1909.482_neutral__8wekyb3d8bbwe

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

@JohnMcPMS
Copy link
Member

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
Copy link
Contributor Author

Oh no!

image

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

@felipecrs
Copy link
Contributor Author

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
Copy link
Contributor Author

felipecrs commented Nov 2, 2021

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
Copy link

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

@isobeyan
Copy link

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

@felipecrs
Copy link
Contributor Author

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
Copy link

yap. it's still the same in my case

@felipecrs
Copy link
Contributor Author

So, I think in this sense, this bug isn't much of Winget's concern but rather Windows itself. As mentioned in #1656 (comment), perhaps the best would be to report in the Windows Feedback Hub.

@ItzLevvie
Copy link

ItzLevvie commented Jan 25, 2022

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
Copy link

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
Copy link

matifali commented Aug 5, 2022

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

@borozu
Copy link

borozu commented Sep 23, 2022

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
Copy link

sba923 commented Nov 4, 2022

winget source update --name winget gets me

image

@Cerebellum90
Copy link

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
Copy link

cndctr commented Nov 4, 2022

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

@feldegast
Copy link

running the command:
winget source reset --force
this fixes the issue for a single run of winget update, the issue returns the next time winget is run

@HeyItsJono
Copy link

HeyItsJono commented Mar 22, 2023

Can confirm I'm also getting Failed in attempting to update the source: winget, in Australia.

Things I've tried that don't work:

  • winget source reset --force then winget upgrade; issue continues to occur
  • winget source update --name winget; just continuously loads for hours until I manually break the command with Ctrl+C
  • winget source update; updates msstore source without issue then hangs again on winget source
  • Use a USA NordVPN node; no change to any of the above outcomes

For me winget source list shows winget points to https://cdn.winget.microsoft.com/cache.
Visiting this page shows a valid and in-date SSL certificate, but the page itself throws the following error:

<Error>
<Code>ResourceNotFound</Code>
<Message>The specified resource does not exist. RequestId:c8d43b9b-101e-004d-748d-5c6f85000000 Time:2023-03-22T07:08:08.5530177Z</Message>
</Error>

I can curl https://cdn.winget.microsoft.com/cache/source.msix --output ./source.msix and end up with source.msix, SHA-256 1b94f4cad9e735f2b650f579ed7e9d83ff84e4a8217951d77fd3853f89968dba, size 6.24mb.

@feldegast
Copy link

I have resorted to running the following command in an administrator-elevated PowerShell whenever I want to use winget

winget source reset --force && winget upgrade

and then do my update,.....

@GeorgeGribkov
Copy link

I had the same error, but found the solution: just run winget from the administrator-privileged command line:

  1. Win + R
  2. type "cmd"
  3. Ctrl+Shift+Enter to run with administrator privileges

Good luck!

@abbott
Copy link

abbott commented Apr 28, 2023

I recently ran into this error message after installing WingetUI. If installed, your attempt to run winget from shell may collide with a sub-process of winget under an active WingetUI instance.

Exit one of the instances, such as WingetUI to avoid this message in shell...and likely vice-versa.

@mohamedghry
Copy link

The following steps worked for me:

Note: This is the only solution that worked for me. I am 80% certain that this issue was caused by WingetUI as the issue wasn't present before it was installed @abbott .

Uninstall WingetUI if it's on your machine

Step 1: Troubleshooting

  1. Open Troubleshooting using Win+R, then write control panel in the dialogue box.
  2. Write Control Panel\All Control Panel Items\Troubleshooting\All Categories in the address bar of the control panel and press Enter.
  3. Click on Background Intellingent Transfer Service to open a dialogue box.
  4. Click on Advanced and check the box for Apply repairs automatically.
  5. Wait until the troubleshooter finishes.

Step 2: Repair System Files

  1. Open an elevated cmd session.
  2. Enter the command DISM /Online /Cleanup-Image /RestoreHealth
  3. Once finished, enter the command sfc /scannow and wait till it's finished.
  4. Restart your machine.

Hopefully this fixes the issue for you too.

@saizai
Copy link

saizai commented May 8, 2023

For me, simpler fix: winget source update from elevated command prompt.

Non elevated had this:

PS 7.3 C:\Windows\System32 0 $ winget upgrade
Failed in attempting to update the source: winget
Name                                        Id                             Version      Available   Source
----------------------------------------------------------------------------------------------------------
[redacted]
PS 7.3 C:\Windows\System32 0 $ winget source update
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
Cancelled

Elevated:

PS 7.3 C:\Windows\System32 0 # winget source update
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
  ██████████████████████████████  100%
Done
PS 7.3 C:\Windows\System32 0 # winget update
Name                                                               Id                             Version        Available     Source
[redacted]

Non elevated prompt, after elevated source update (no "failed in attempting to update the source" line):

PS 7.3 C:\Windows\System32 0 $ winget upgrade --all
Name                                                               Id                             Version        Available     Source
[redacted]

@tilsgee
Copy link

tilsgee commented May 29, 2023

To anyone who get this:
gambar
i think the problem is from winget source manifest file.

yeah. the one from https://cdn.winget.microsoft.com/cache/source.msix

as stated in Here TLDR: the error code is E_INVALIDARG

Edit: how do i get the error code?. it's in here:
gambar

@biyiklioglu
Copy link

If you have tried all the suggestions on this issue and still could not solve the problem your issue could be caused due to wrong permissions on the winget installer download directory.

Symptoms:

  • Running winget update with nonadmin user fails with
    Failed in attempting to update the source: winget
  • Running winget source update --name winget with nonadmin user fails with
    Cancelled
  • winget update works fine with admin user

Cause:

Nonadmin user has no permissions to the winget installer download directory:

%TEMP%\WinGet = C:\Users\%USERNAME%\AppData\Local\Temp\WinGet

May be related to #3322

Solution:

Correct the permissions on the %TEMP%\WinGet directory or simply delete it so it would be recreated.

@Montigomo
Copy link

Montigomo commented Aug 17, 2023

this help me [all happens on remote machines]
first i go System > Apps > Installed apps? found winget. Click "Repair". [use RDP]
then run that pwsh code: [pwsh over ssh]

winget source reset --force
$package = Get-AppxPackage | Where-Object { $_.Name -like "*WinGet*" }
if ($package) {
    $name = $package.PackageFullName
    Reset-AppxPackage $name
}

Will there come a time when I can do everything with cmd (pwsh) in winows became?

@NJT145
Copy link

NJT145 commented Sep 27, 2023

I have the same issue and I solved it by using VPN. So funny right? But that's true. I am in Turkey, in İstanbul, by the way.

@MadSpindel
Copy link

MadSpindel commented Sep 27, 2023

Since yesterday I am having this issue:

image

@darrens280
Copy link

darrens280 commented Sep 27, 2023

@MadSpindel

  • Close any PS window
  • Delete the folder C:\Users\%USERNAME%\AppData\Local\Temp\WinGet
  • Open new PS window (as admin)
  • Run the following --> winget source update
  • Enjoy winget

(Kudos to @biyiklioglu for the solution)

@raysilvers255
Copy link

raysilvers255 commented Sep 27, 2023

Since yesterday I am having this issue too......

winget source update,no effect
winget source reset --force,no effect

download and install https://cdn.winget.microsoft.com/cache/source.msix
still has no effect

@trajanmcgill
Copy link

* Open new PS window (as admin)
* Run the following --> `winget source update`

Unfortunately, this above step just results in:

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

and no changes to the problem.

@gwenreynolds94
Copy link

gwenreynolds94 commented Sep 27, 2023

What ended up (not) working for me was...

  • going to Apps and Features
  • uninstalling Windows Package Manager Source (winget)
  • running as admin winget source reset --force
  • closing any PowerShell windows
  • deleting the contents of the folder C:\Users\%USERNAME%\AppData\Local\Temp\WinGet (thanks, @darrens280)
  • downloading/installing https://cdn.winget.microsoft.com/cache/source.msix (and thank you, @raysilvers)
  • and finally running as admin winget source update

⁌⁌EDIT⁍⁍ aaaaand it's back to broke

@jmwielandt
Copy link

What ended up working for me was...

  • going to Apps and Features
  • uninstalling Windows Package Manager Source (winget)
  • running as admin winget source reset --force
  • closing any PowerShell windows
  • deleting the contents of the folder C:\Users\%USERNAME%\AppData\Local\Temp\WinGet (thanks, @darrens280)
  • downloading/installing https://cdn.winget.microsoft.com/cache/source.msix (and thank you, @raysilvers)
  • and finally running as admin winget source update

didn't worked to me :c
the winget source update failed printing "Cancelled"

@gwenreynolds94
Copy link

gwenreynolds94 commented Sep 27, 2023

What ended up working for me was...

  • going to Apps and Features
  • uninstalling Windows Package Manager Source (winget)
  • running as admin winget source reset --force
  • closing any PowerShell windows
  • deleting the contents of the folder C:\Users\%USERNAME%\AppData\Local\Temp\WinGet (thanks, @darrens280)
  • downloading/installing https://cdn.winget.microsoft.com/cache/source.msix (and thank you, @raysilvers)
  • and finally running as admin winget source update

didn't worked to me :c the winget source update failed printing "Cancelled"

yeh sorry, it worked for one or two commands for me just fine and reverted back. i think at one point in the past this exact thing started happening because of an expired certificate, so that's my bet.

EDIT sooo, i've consistently been able to make it work for a little bit by just running winget source reset --force as admin, reinstalling the source.msix as mentioned a few times in a row, and running winget source update winget as admin, just fyi

@wagnerck
Copy link

I also think this is a problem with the upstream repository, as this appears to have started sometime yesterday for everybody at around the same time that the App Installer package was updated. The error is happening to me somewhat randomly; currently it's working if I run winget upgrade, but some of the admin commands are still failing with the "Cancelled" error.

@Dvd-Znf
Copy link

Dvd-Znf commented Sep 27, 2023

Also having the same issue...
Going and manually downloading/installing from https://cdn.winget.microsoft.com/cache/source.msix seems to update the source (New updates are available afterwards with winget update)
But running winget source update --name winget still gets me Cancelled error

One interesting thing to note is that https://cdn.winget.microsoft.com/cache/source.msix sometimes seems unavailable, I have to try ~2-3 times to download it.

@xd003
Copy link

xd003 commented Sep 27, 2023

I am also facing this issue atm, has anyone discovered a fix yet ?

@WrinkleRelease
Copy link

Same issue. Any fixes?

  1. Any use of winget gives Failed in attempting to update the source: winget
  2. winget source update --name winget gives a CANCELLED response
  3. Winget will still try to run an upgrade or install and is sometimes successful.

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

Windows: Windows.Desktop v10.0.22621.2283
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.2631.0

@shomilsaini
Copy link

Also having the same issue... Going and manually downloading/installing from https://cdn.winget.microsoft.com/cache/source.msix seems to update the source (New updates are available afterwards with winget update) But running winget source update --name winget still gets me Cancelled error

One interesting thing to note is that https://cdn.winget.microsoft.com/cache/source.msix sometimes seems unavailable, I have to try ~2-3 times to download it.

This works for me as a temporary fix for now. Steps:

@Dvd-Znf
Copy link

Dvd-Znf commented Sep 27, 2023

Ok, so for everyone who is here right now, having the exact same issue as everyone else, read the pinned issue #3652
:D

@denelon
Copy link
Contributor

denelon commented Sep 27, 2023

Thanks @Dvd-Znf, I hadn't seen the chatter here. I'll lock discussions to reduce notifications on this Issue.

@microsoft microsoft locked as spam and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests