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
22.93k stars 1.42k forks source link

Number/list of updates available totally broken, `update` not working #3356

Open aetonsi opened 1 year ago

aetonsi commented 1 year ago

Brief description of your issue

Hi, i found a few problems with the update command, but i'm not even sure if these are all of them, so please see the log at the end that might be clearer than my explanations/suppositions.

When running update commands, to list available updates or to update packages, a number of problems occur:

  1. some packages get skipped; see the output below: update --all --include-unknown tries to update 3 out of 6 listed packages. More details:
    1. for a couple of packages (powershell, visual studio) cannot be updated via update --all nor update --id ..., the update commands simply skips them and reports "no applicable update found"; in reality, visual studio's already installed version is 17.6.2 (so an update should be available) and powershell version is 7.3.4 (so the lastest version is already installed)
    2. also another package, with "unknown" version number (windirstat) gets skipped too, when using --include-unknown
  2. the other packages with "unknown version number"s, are kind of updated with update --all --include-unknown, meaning each one of them gets installed successfully, but still end up with "unknown" version after installation (idk maybe this is the expected behaviour?), so they are perpetually listed as having an update available
  3. the update --all command reports twice the line "X packages have version numbers that cannot be determined. Use --include-unknown to see all results", the second time with a totally random number

I don't even know if these problems are related to each other, of if i should open a separate issue for some/all of them. Please notice me if i should do that. Also please rename the issue if a better title could be found.

Steps to reproduce

i don't know, aside running the commands below, while having the following software installed:

Expected behavior

Actual behavior

> winget -v
v1.4.11071

> winget update
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.3    winget
PowerShell 7.3.2.0-x64       Microsoft.PowerShell                  7.3.2.0 7.3.4.0   winget
2 upgrades available.
4 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.

> winget update --include-unknown
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Google Cloud SDK             Google.CloudSDK                       Unknown 431.0.0   winget
MEGAsync                     Mega.MEGASync                         Unknown 4.9.4.0   winget
SpeedFan (remove only)       Almico.SpeedFan                       Unknown 4.52      winget
WinDirStat 1.1.2             WinDirStat.WinDirStat                 Unknown 1.1.2     winget
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.3    winget
PowerShell 7.3.2.0-x64       Microsoft.PowerShell                  7.3.2.0 7.3.4.0   winget
6 upgrades available.

> winget update --all
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.3    winget
PowerShell 7.3.2.0-x64       Microsoft.PowerShell                  7.3.2.0 7.3.4.0   winget
2 upgrades available.
4 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
14 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.

> winget update microsoft.powershell
No applicable upgrade found.

> winget update --id microsoft.powershell
No applicable upgrade found.

> winget update --id microsoft.visualstudio.2022.community
No applicable upgrade found.

> winget update --include-unknown --all
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Google Cloud SDK             Google.CloudSDK                       Unknown 431.0.0   winget
MEGAsync                     Mega.MEGASync                         Unknown 4.9.4.0   winget
SpeedFan (remove only)       Almico.SpeedFan                       Unknown 4.52      winget
WinDirStat 1.1.2             WinDirStat.WinDirStat                 Unknown 1.1.2     winget
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.3    winget
PowerShell 7.3.2.0-x64       Microsoft.PowerShell                  7.3.2.0 7.3.4.0   winget
6 upgrades available.

(1/3) Found Google Cloud SDK [Google.CloudSDK] Version 431.0.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe
  ██████████████████████████████   148 KB /  148 KB
Successfully verified installer hash
Starting package install...
Successfully installed

(2/3) Found MEGAsync [Mega.MEGASync] Version 4.9.4.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://mega.nz/MEGAsyncSetup64.exe
  ██████████████████████████████  51.6 MB / 51.6 MB
Successfully verified installer hash
Starting package install...
Successfully installed

(3/3) Found SpeedFan [Almico.SpeedFan] Version 4.52
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://www.almico.com/instspeedfan452.exe
  ██████████████████████████████  2.94 MB / 2.94 MB
Successfully verified installer hash
Starting package install...
Successfully installed

Environment

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

Windows: Windows.Desktop v10.0.22621.1848
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.11071.0

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

User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json

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
denelon commented 1 year ago

@aetonsi thanks for the detailed feedback. Lots to unpack here. I'll see about referencing the existing issues to help split this into the separate classes of issues to make sure we're tracking everything.

  1. Some packages do not report their version in the registry. WinGet looks at the keys behind "Windows Apps & Features". In this case WinGet displays "Unknown" for the installed version, WinGet cannot reason about the installed version and by default doesn't run the upgrade as it's possible the machine may have a newer version.

The other reason one might see "Unknown" is in the available column. This is treated as a "sentinel value" so WinGet doesn't try to upgrade to an unknown version. Currently, the Microsoft Store "msstore" REST source doesn't expose the version information, so all packages report unknown. We are working on getting this metadata updated. It's a very long lead time work item due to the way the data is captured, stored, and presented.

denelon commented 1 year ago

By coincidence, I was chatting with @Trenly this morning and he shared his tracking list which makes the rest of the breakdown a bit easier:

The PowerShell issue is matching/side-by-side:

Upgrade all not upgrading all is labeled with "Area-Output":

Upgrade by Id works for me, but this depends on which version of the installer was used for the currently installed version.

Update with wrong count of unknown is correctly identified as:

Register available version is:

denelon commented 1 year ago

I don't believe I saw any untracked issues in your report. Please check to make sure I've not missed anything.

We use the sort by👍in Issues to prioritize in addition to:

Be sure to add your 👍 to any Issues to help raise priority. I'm going to mark the issue as "Needs-Author-Feedback" before closing it, so you have a chance to confirm nothing was missed.

microsoft-github-policy-service[bot] commented 1 year ago

Hello @aetonsi,

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Template: msftbot/noRecentActivity

aetonsi commented 1 year ago

I don't believe I saw any untracked issues in your report. Please check to make sure I've not missed anything.

Hi, sorry for the late reply. What about the line about packages with "version numbers that cannot be determined" being printed twice? I mean the last 2 lines here:

> winget update --all
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.3    winget
PowerShell 7.3.2.0-x64       Microsoft.PowerShell                  7.3.2.0 7.3.4.0   winget
2 upgrades available.
4 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
14 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.

Also, i don't understand the following:

Upgrade by Id works for me, but this depends on which version of the installer was used for the currently installed version.

Do you mean the version of the Microsoft Visual Studio Installer? It's 3.6.2115.31769 on my pc (doesn't show up in winget, but it does in appwiz.cpl):

PS # winget update --id microsoft.visualstudio.2022.community
No applicable upgrade found.
PS # winget list microsoft.visualstudio.2022.community
Name                         Id                                    Version Available Source
-------------------------------------------------------------------------------------------
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.6.2  17.6.4    winget
PS #  winget list microsoft.visualstudio
Name                               Id                                     Version Available Source
--------------------------------------------------------------------------------------------------
Visual Studio Community 2022       Microsoft.VisualStudio.2022.Community  17.6.2  17.6.4    winget
Microsoft Visual Studio Code       Microsoft.VisualStudioCode             1.79.2            winget
Visual Studio Build Tools 2022 (2) Microsoft.VisualStudio.2022.BuildTools 17.6.4            winget
Trenly commented 1 year ago

Upgrade by Id works for me, but this depends on which version of the installer was used for the currently installed version.

Do you mean the version of the Microsoft Visual Studio Installer? It's 3.6.2115.31769 on my pc (doesn't show up in winget, but it does in appwiz.cpl):

Some applications have multiple different installer types - exe, msi, zip, portable, etc. If the currently installed version was installed using the msi installer, winget will try to use the msi Installer during the upgrade. However, if the creator of the manifest hasn't included the msi in the latest manifest, it's possible the upgrade will fail. This is why the upgrade by ID works for me - because it does, in most cases - but depends on which version of the installer was used previously and if the same type of installer is available to winget.

aetonsi commented 1 year ago

How can i check the actual version of the installer, so i can tell you which one is it?

aetonsi commented 1 year ago

Is there a way i can "fix" this, so that the update works, without having to do a full reinstallation? Because Visual Studio 2022 actually has an update available, for me, but i can't get to it due to this problem. PS: I think i originally installed VS22 via chocolatey.

BlocklyCodeX commented 5 months ago

I'm not sure if this solution is appropriate for this thread, but I've encountered a similar issue. When executing winget update --all or winget upgrade --all, the system lists all packages with available updates but doesn't proceed with any action. In my case, the output is as follows:

> winget upgrade --all

Name                                                              ID                            Version       Available    Source
----------------------------------------------------------------------------------------------------------------------------------
[List of packages with available updates]
15 updates available.

Some packages require specifying a destination for the update:
Name                        ID               Version      Available           Source
-------------------------------------------------------------------------------------
[List of packages requiring an explicit destination]

To address this issue, I created a PowerShell script (.ps1) that automates the update process for all packages without needing to specify them manually. The script collects the IDs of the packages and updates them one by one. The code is as follows:

write-host "Updating winget upgrade list..."
$OUTPUT=winget.exe upgrade

Write-Host "Filtering list..."
$regexPattern = '([a-zA-Z-]+(?:\.[a-zA-Z0-9]+)+)'

$match = [regex]::Matches($OUTPUT, $regexPattern)
$packageNames = $match | ForEach-Object { $_.Value.Trim() }

Write-Host $packageNames

$LIST = $packageNames.Split(" ")

Write-Host "Excluding packages..."

Write-Host $LIST
Write-Host "*********"

for ($i = 0; $i -lt $LIST.count; $i++) {
    write-host "$i/$($LIST.count). Upgrading $($LIST[$i])..."
    winget.exe upgrade --id "$($LIST[$i])"
}

This script starts by displaying the list of packages to be updated, filters and excludes packages as needed, and finally, updates each one using its corresponding ID.

denelon commented 2 months ago

Is this still happening in WinGet 1.8?

aetonsi commented 1 month ago

Is this still happening in WinGet 1.8?

yes. i'm on v1.8.1791. the problem seems to be a little different but still present:

── 23:19:45 - winget ───────────────────────────────────────────────────────────
Name         Id                 Version  Available Source
---------------------------------------------------------
Discord      Discord.Discord    1.0.9152 1.0.9153  winget
Proton Drive Proton.ProtonDrive 1.6.0    1.6.2     winget
2 upgrades available.
3 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.

(1/1) Found Discord [Discord.Discord] Version 1.0.9153
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed

7 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
mdanish-kh commented 1 month ago

@aetonsi Could you run the command winget upgrade --id Proton.ProtonDrive --verbose-logs --open-logs? This'll help give us more info on the skipped upgrade. After the command finishes, it'll open up the WinGet logs directory. Could you share the latest generated log file? (if you sort by last updated, the log file should be the first one in the list)

aetonsi commented 1 month ago

sorry i already updated protondrive within the protondrive UI itself..

looking into the logs folder if you want i found this older log of a winget update proton.protondrive (without --verbose-logs unluckily):

2024-07-11 17:54:16.920 [CORE] WinGet, version [1.8.1791], activity [{B64F21C1-D66D-415A-A51F-E1FD865C7017}]
2024-07-11 17:54:16.921 [CORE] OS: Windows.Desktop v10.0.22635.3066
2024-07-11 17:54:16.921 [CORE] Command line Args: "C:\Users\u6\AppData\Local\Microsoft\WindowsApps\winget.exe" update proton.protondrive
2024-07-11 17:54:16.921 [CORE] Package: Microsoft.DesktopAppInstaller v1.23.1791.0
2024-07-11 17:54:16.921 [CORE] IsCOMCall:0; Caller: winget-cli
2024-07-11 17:54:16.930 [CLI ] WinGet invoked with arguments: 'update' 'proton.protondrive'
2024-07-11 17:54:16.930 [CLI ] Found subcommand: update
2024-07-11 17:54:16.930 [CLI ] Leaf command to execute: root:upgrade
2024-07-11 17:54:16.936 [CLI ] Executing command: upgrade
2024-07-11 17:54:16.946 [REPO] Default source requested, multiple sources available, adding all to source references.
2024-07-11 17:54:16.946 [REPO] Adding to source references msstore
2024-07-11 17:54:16.946 [CORE] Default proxy is not set
2024-07-11 17:54:16.946 [REPO] REST HTTP Client helper does not use proxy
2024-07-11 17:54:16.946 [REPO] Adding to source references winget
2024-07-11 17:54:16.946 [CLI ] Created authentication arguments. Mode: silentPreferred, Account: 
2024-07-11 17:54:16.957 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2024-07-11 17:54:16.957 [CORE] Found matching extension.
2024-07-11 17:54:16.961 [REPO] Multiple sources available, creating aggregated source.
2024-07-11 17:54:16.961 [REPO] Adding to aggregated source: msstore
2024-07-11 17:54:16.961 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2024-07-11 17:54:18.724 [REPO] Response status: 200
2024-07-11 17:54:18.725 [REPO] Authentication node not found. Assuming authentication type none.
2024-07-11 17:54:18.725 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2024-07-11 17:54:18.853 [REPO] Response status: 200
2024-07-11 17:54:18.853 [REPO] Authentication node not found. Assuming authentication type none.
2024-07-11 17:54:18.853 [REPO] Adding to aggregated source: winget
2024-07-11 17:54:18.860 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB
2024-07-11 17:54:18.860 [CORE] Found matching extension.
2024-07-11 17:54:19.003 [REPO] Opening database for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2024.711.1339.30_neutral__8wekyb3d8bbwe\Public\index.db'
2024-07-11 17:54:19.005 [REPO] Opened SQLite Index with version [1.7], last write [2024-07-11 14:37:54.000]
2024-07-11 17:54:19.143 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2024-07-11 17:54:19.148 [REPO] Reading MSI UpgradeCodes
2024-07-11 17:54:19.420 [REPO] Reading MSI UpgradeCodes
2024-07-11 17:54:20.060 [REPO] Opening database for ReadWrite at 'C:\Users\u6\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\StoreEdgeFD\installed.db'
2024-07-11 17:54:20.062 [REPO] Opened SQLite Index with version [1.5], last write [2024-01-12 17:16:27.000]
2024-07-11 17:54:20.108 [REPO] Sending http POST request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/manifestSearch
2024-07-11 17:54:20.457 [REPO] Response status: 200
2024-07-11 17:54:20.464 [REPO] Opening database for ReadWrite at 'C:\Users\u6\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-07-11 17:54:20.466 [REPO] Opened SQLite Index with version [1.3], last write [2024-07-11 17:37:10.000]
2024-07-11 17:54:20.711 [REPO] Found multiple results for Id [Proton.ProtonDrive] in tracking catalog for: winget
2024-07-11 17:54:20.734 [CLI ] Found one app. App id: Proton.ProtonDrive App name: Proton Drive
2024-07-11 17:54:20.740 [REPO] Attempting to open pinning database: C:\Users\u6\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2024-07-11 17:54:20.740 [REPO] ... opening existing pinning database
2024-07-11 17:54:20.740 [REPO] Opening database for Read at 'C:\Users\u6\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2024-07-11 17:54:20.742 [REPO] Opened Pinning Index with version [1.0], last write [2024-06-28 12:08:54.000]
2024-07-11 17:54:20.876 [CLI ] Terminating context: 0x8a15002b at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UpdateFlow.cpp:be
mdanish-kh commented 1 month ago

sorry i already updated protondrive within the protondrive UI itself..

That's okay. The log that you shared doesn't seem to offer all that much context other than failing with 0x8a15002b, which is the return code for No applicable update found. Generally when winget skips an upgrade, it's because the available upgrade isn't compatible with your existing installation of the package. This can happen if your current installation differs in scope, installer type, or other parameters from the available update. If you encounter such issues again, feel free to open a new issue over at winget-pkgs