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

Failing to upgrade packages - Scheduled Task #2265

Open fnginfosec opened 2 years ago

fnginfosec commented 2 years ago

Brief description of your issue

I created a scheduled SYSTEM task so Winget will upgrade in the background without user interaction. The task will run, but it does not update any of the packages. I tested deployment to a small test environment with 8 devices, and 2 of the devices are getting the same errors.

Any feedback is greatly appreciated.

Steps to reproduce

Expected behavior

I'd like for it to run in the background to keep apps updated, it works for most but not all of the devices I tested on. Winget works fine when updating manually via terminal.

Actual behavior

Winget runs but the logs cut off after checking Repo information. Logs from different days

2022-06-16 17:00:01.521 [CORE] OS: Windows.Desktop v10.0.19044.1766
2022-06-16 17:00:01.521 [CORE] Command line Args: "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.17.10941.0_x64__8wekyb3d8bbwe\winget.exe" upgrade --accept-source-agreements --accept-package-agreements --all --silent
2022-06-16 17:00:01.521 [CORE] IsCOMCall:0; Caller: winget-cli
2022-06-16 17:00:01.522 [CLI ] WinGet invoked with arguments: 'upgrade' '--accept-source-agreements' '--accept-package-agreements' '--all' '--silent'
2022-06-16 17:00:01.523 [CLI ] Found subcommand: upgrade
2022-06-16 17:00:01.523 [CLI ] Leaf command to execute: root:upgrade
2022-06-16 17:00:01.524 [CLI ] Executing command: upgrade
2022-06-16 17:00:01.532 [REPO] GetCurrentSourceRefs: Source named 'microsoft.builtin.desktop.frameworks' from origin Default is hidden and is dropped.
2022-06-16 17:00:01.532 [REPO] Default source requested, multiple sources available, adding all to source references.
2022-06-16 17:00:01.532 [REPO] Adding to source references msstore
2022-06-16 17:00:01.533 [REPO] Adding to source references winget
2022-06-16 17:00:01.534 [REPO] Source past auto update time [5 mins]; it has been at least 438 mins
2022-06-16 17:00:01.535 [REPO] Source past auto update time [5 mins]; it has been at least 437 mins
2022-06-16 17:00:12.758 [REPO] Multiple sources available, creating aggregated source.
2022-06-16 17:00:12.758 [REPO] Adding to aggregated source: msstore
2022-06-16 17:00:12.758 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2022-06-16 17:00:13.048 [REPO] Response status: 200
2022-06-16 17:00:13.049 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information
2022-06-16 17:00:13.203 [REPO] Response status: 200
2022-06-16 17:00:13.203 [REPO] Adding to aggregated source: winget
2022-06-16 17:00:13.208 [REPO] Opening SQLite Index for Read at 'C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft/WinGet\State\Microsoft.PreIndexed.Package\Microsoft.Winget.Source_8wekyb3d8bbwe\index.db'
2022-06-16 17:00:13.208 [SQL ] Opening SQLite connection: 'C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft/WinGet\State\Microsoft.PreIndexed.Package\Microsoft.Winget.Source_8wekyb3d8bbwe\index.db' [1, 0]
2022-06-16 17:00:13.212 [REPO] Opened SQLite Index with version [1.3], last write [2022-06-16 10:30:24.000]
2022-06-16 17:00:13.255 [REPO] Creating PredefinedInstalledSource with filter [None]
2022-06-16 17:00:13.255 [REPO] Creating new SQLite Index [4294967295.4294967295] at ':memory:'
2022-06-16 17:00:13.255 [SQL ] Opening SQLite connection: ':memory:' [6, 0]
2022-06-16 17:00:13.282 [REPO] Examining ARP entries for Machine | X64
2022-06-16 17:00:13.290 [REPO] Examining ARP entries for Machine | X86
2022-06-16 17:00:13.299 [REPO] Examining ARP entries for User | X64

=============================================================

2022-06-20 11:37:53.125 [CORE] WinGet, version [1.2.0], activity [{8CA40935-CB82-468B-8D89-9B29B19F5569}]
2022-06-20 11:37:53.128 [CORE] OS: Windows.Desktop v10.0.19044.1766
2022-06-20 11:37:53.128 [CORE] Command line Args: "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.17.10941.0_x64__8wekyb3d8bbwe\winget.exe" upgrade --accept-source-agreements --accept-package-agreements --all --silent --verbose-logs
2022-06-20 11:37:53.128 [CORE] IsCOMCall:0; Caller: winget-cli
2022-06-20 11:37:53.128 [CLI ] WinGet invoked with arguments: 'upgrade' '--accept-source-agreements' '--accept-package-agreements' '--all' '--silent' '--verbose-logs'
2022-06-20 11:37:53.128 [CLI ] Found subcommand: upgrade
2022-06-20 11:37:53.128 [CLI ] Leaf command to execute: root:upgrade
2022-06-20 11:37:53.129 [CORE] Setting action: Get, Type: Secure, Name: admin_settings
2022-06-20 11:37:53.129 [CORE] Admin settings was not found
2022-06-20 11:37:53.129 [CLI ] Executing command: upgrade
2022-06-20 11:37:53.132 [CORE] Setting action: Get, Type: Secure, Name: user_sources
2022-06-20 11:37:53.134 [CORE] Setting action: Get, Type: Standard, Name: sources_metadata
2022-06-20 11:37:53.138 [YAML] Detected UTF-8
2022-06-20 11:37:53.140 [REPO] GetCurrentSourceRefs: Source named 'microsoft.builtin.desktop.frameworks' from origin Default is hidden and is dropped.
2022-06-20 11:37:53.140 [REPO] Default source requested, multiple sources available, adding all to source references.
2022-06-20 11:37:53.140 [REPO] Adding to source references msstore
2022-06-20 11:37:53.140 [REPO] Adding to source references winget
2022-06-20 11:37:53.143 [CORE] Setting action: Get, Type: Secure, Name: user_sources
2022-06-20 11:37:53.143 [CORE] Setting action: Get, Type: Standard, Name: sources_metadata
2022-06-20 11:37:53.143 [YAML] Detected UTF-8
2022-06-20 11:37:53.143 [REPO] Source past auto update time [5 mins]; it has been at least 25 mins
2022-06-20 11:37:53.143 [CORE] Setting action: Set, Type: Standard, Name: sources_metadata
2022-06-20 11:37:53.144 [REPO] Source past auto update time [5 mins]; it has been at least 5437 mins

Environment

Windows Package Manager v1.2.10941
Windows: Windows.Desktop v10.0.19044.1766
Package: Microsoft.DesktopAppInstaller v1.17.10941.0
o-l-a-v commented 2 years ago

Probably a related issue:

Maybe this project can help you out:

Here is a script I've made and run on a regular basis to update certain apps. It scripts around a lot of the limitations and problems Winget currently has. Not pretty, but it works for me.

denelon commented 2 years ago

We are working on a COM interface that will be accessible via the system context. The issue is related to the fact that the Windows Package Manager is delivered as a part of the App Installer as an MSIX package.

Similar Issues:

denelon commented 2 years ago

Also somewhat related:

fnginfosec commented 2 years ago

Thanks for the suggestions. I'll look into them in the meantime :)