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.53k stars 1.39k forks source link

WebView2 dependency in MSIX fails to install on Azure Windows 11 22H2 Pro Gen2 #4473

Open AliveDevil opened 1 month ago

AliveDevil commented 1 month ago

Brief description of your issue

On Azure Windows 11 22H2 Pro Gen2 VM installation of MSIX fails, when including WebView2 external dependency. This works fine on non-Azure machines.

Steps to reproduce

<Package>
  <Dependencies>
    <!--
      Refer to Directory.Packages.props (WebView2Version)
      https://learn.microsoft.com/uwp/schemas/appxpackage/uapmanifestschema/element-win32dependencies-externaldependency
    -->
    <win32dependencies:ExternalDependency Name="Microsoft.WebView2" Publisher="CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" MinVersion="114.0.1823.32" Optional="false" />
  </Dependencies>

Expected behavior

Installation succeeds by installing WebView2.

Actual behavior

Installation fails with generic error.

[Mon May 13 12:10:21 2024]{9140} PackageDependencyInstaller -> Required missing external dependencies count: 1
[Mon May 13 12:10:21 2024]{9140} GoToState -> GoToDeployingState
[Mon May 13 12:10:21 2024]{9140} MainPage -> Installing Package Dependencies
[Mon May 13 12:10:21 2024]{9140} ProgressReporter -> Package Dependencies Progress
[Mon May 13 12:10:21 2024]{9140} ProgressReporter -> Progress Type: [Installing required frameworks 0%...]
[Mon May 13 12:10:21 2024]{9140} Failed to connect to external dependency catalog
[Mon May 13 12:10:21 2024]{9140} PackageDependencyInstaller -> Reporting error from Windows Package Manager catalog connect - 0x80070005
[Mon May 13 12:10:21 2024]{9140} GoToState -> DeploymentErrorState
[Mon May 13 12:10:21 2024]{9140} Toaster->ShowToast [Error]
[Mon May 13 12:10:21 2024]{9140} Toaster->Toast Error Data [<toast launch="App Installer" activationType="background" duration ="short"><visual><binding template = "ToastGeneric"><text>*** installation failed</text><text>App Installer failed to connect to the winget source for external package dependencies. Please report at https://aka.ms/winget-cli</text></binding></visual></toast>]

Log files:

Environment

winget --info ```shell Windows Package Manager v1.7.11261 Copyright (c) Microsoft Corporation. All rights reserved. Windows: Windows.Desktop v10.0.22631.3527 System Architecture: X64 Package: Microsoft.DesktopAppInstaller v1.22.11261.0 Winget Directories ----------------------------------------------------------------------------------------------------------------------- Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag… User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett… Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links Portable Links Directory (Machine) C:\Program Files\WinGet\Links Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages Portable Package Root C:\Program Files\WinGet\Packages Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages Installer Downloads %USERPROFILE%\Downloads 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 Admin Setting State -------------------------------------------------- LocalManifestFiles Disabled BypassCertificatePinningForMicrosoftStore Disabled InstallerHashOverride Disabled LocalArchiveMalwareScanOverride Disabled ```
github-actions[bot] commented 1 month ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

stephengillie commented 1 month ago

It sounds like Microsoft.EdgeWebView2Runtime might have an issue. Installing it in a WIndows 11 VM ended with:

2024-05-13 07:43:52.016 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/packageManifests/--accept-package-agreements?Market=US 2024-05-13 07:43:52.079 [REPO] Response status: 200 2024-05-13 07:43:52.086 [REPO] Opening database for ReadWrite at 'C:\Users\User\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db' 2024-05-13 07:43:52.087 [REPO] Opened SQLite Index with version [1.6], last write [2024-05-13 07:42:19.000] 2024-05-13 07:43:52.108 [CLI ] No app found matching input criteria 2024-05-13 07:43:52.115 [CLI ] Terminating context: 0x8a150014 at C:__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\WorkflowBase.cpp:3c8

This should probably be moved to the winget-pkgs repo, because it's only impacting 1 package.

Trenly commented 1 month ago

It sounds like Microsoft.EdgeWebView2Runtime might have an issue. Installing it in a WIndows 11 VM ended with:

2024-05-13 07:43:52.016 [REPO] Sending http GET request to: storeedgefd.dsx.mp.microsoft.com/v9.0/packageManifests/--accept-package-agreements?Market=US 2024-05-13 07:43:52.079 [REPO] Response status: 200 2024-05-13 07:43:52.086 [REPO] Opening database for ReadWrite at 'C:\Users\User\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db' 2024-05-13 07:43:52.087 [REPO] Opened SQLite Index with version [1.6], last write [2024-05-13 07:42:19.000] 2024-05-13 07:43:52.108 [CLI ] No app found matching input criteria 2024-05-13 07:43:52.115 [CLI ] Terminating context: 0x8a150014 at C:__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\WorkflowBase.cpp:3c8

This should probably be moved to the winget-pkgs repo, because it's only impacting 1 package.

@stephengillie - on your VM can you try with --source winget ? It seems to work on my VM

@AliveDevil - I see you have listed Microsoft.WebView2 as the dependency, have you tried Microsoft.EdgeWebView2Runtime? I don't see Microsoft.WebView2 as a valid package in WinGet at all

AliveDevil commented 1 month ago

@Trenly yes, I did try that and AppInstaller refuses to install the package. Can get you the exact error tomorrow morning (CEST). The Microsoft.WebView2 dependency is supposed to be set like that and the only valid external dependency allowed.

stephengillie commented 1 month ago

@stephengillie - on your VM can you try with --source winget ? It seems to work on my VM

Edit: I thought it proceeded normally, but was mistaken. My Windows 11 VM is somewhat behind on updates. Correction to above - I had a bug in my testing setup. Tested again before adding --source winget - and got this before and after:

2024-05-13 11:21:20.877 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/packageManifests/Microsoft.EdgeWebView2Runtime?Market=US
2024-05-13 11:21:20.938 [REPO] Response status: 200
2024-05-13 11:21:20.943 [REPO] Opening database for ReadWrite at 'C:\Users\User\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-05-13 11:21:20.945 [REPO] Opened SQLite Index with version [1.6], last write [2024-03-19 10:48:19.000]
2024-05-13 11:21:20.967 [REPO] Finding installed package from available package using system reference search: Query:[none] Include:ProductCode='microsoft edgewebview'[Exact] Include:NormalizedNameAndPublisher='microsoftedgewebview2runtime'+'microsoft'[Exact]
2024-05-13 11:21:20.969 [CLI ] Found one app. App id: Microsoft.EdgeWebView2Runtime App name: Microsoft Edge WebView2 Runtime
2024-05-13 11:21:20.969 [CLI ] Found installed package, converting to upgrade flow
2024-05-13 11:21:20.978 [REPO] Attempting to open pinning database: C:\Users\User\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db
2024-05-13 11:21:20.978 [REPO] ... opening existing pinning database
2024-05-13 11:21:20.978 [REPO] Opening database for Read at 'C:\Users\User\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\pinning.db'
2024-05-13 11:21:20.979 [REPO] Opened Pinning Index with version [1.0], last write [2024-01-04 12:47:12.000]
2024-05-13 11:21:20.980 [CLI ] Terminating context: 0x8a15002b at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UpdateFlow.cpp:bc
AliveDevil commented 1 month ago

This is the log output with <win32dependencies:ExternalDependency name="Microsoft.EdgeWebView2Runtime" …: AppInstaller-2024-05-14-09-42-47.739.log AppInstaller-2024-05-14-09-42-48.163.log WinGetCOM-2024-05-14-09-42-50.156.log

stephengillie commented 1 month ago

TImeline:

48 seconds - Unable to read Group Policy

[Tue May 14 09:42:48 2024]{12036} GroupPoliciesAppServiceClient -> Unable to read Group Policy from registry (0x00000002)

AppInstaller-2024-05-14-09-42-48.163.log

51 seconds - Failed to find dependency

[Tue May 14 09:42:51 2024]{2068} Failed when attempting to find the external dependency: Microsoft.EdgeWebView2Runtime [Tue May 14 09:42:51 2024]{2068} PackageDependencyInstaller -> Reporting error from Windows Package Manager package search for Microsoft.EdgeWebView2Runtime - 0xa0040002

AppInstaller-2024-05-14-09-42-47.739.log

51.047 seconds - File write error:

2024-05-14 09:42:50.802 [REPO] Reading MSI UpgradeCodes 2024-05-14 09:42:50.989 [REPO] Reading MSI UpgradeCodes 2024-05-14 09:42:51.047 [FAIL] C:__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\1_0\Interface_1_0.cpp(197)\WindowsPackageManager.dll!00007FFEB87174CC: (caller: 00007FFEB871E129) Exception(1) tid(20ec) 800700B7 Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist. A file cannot be created if it already exists.

WinGetCOM-2024-05-14-09-42-50.156.log

JohnMcPMS commented 1 month ago

Could you try the following on the VM:

> winget source add test https://cdn.winget.microsoft.com/platform
> winget install Microsoft.WebView2 -s test

This is a manual version of what is happening in the background and will hopefully give us better error details.

stephengillie commented 1 month ago

This was successful in my VM. I'm interested to hear if it was in @AliveDevil's environment also.

image

AliveDevil commented 1 month ago

The winget installation of WebView2 works, log^1 attached.

AppInstaller still refuses to install the MSIX with the external dependency: AppInstaller-2024-05-15-08-44-28.432.log AppInstaller-2024-05-15-08-44-29.298.log

JohnMcPMS commented 1 month ago

Does this system have UAC disabled and the user is a member of the Administrator group?

AliveDevil commented 1 month ago

Confirmed: UAC is enabled (and on the default state). User is member of the local Administrators group.

System Screenshot ![RDP](https://github.com/microsoft/winget-cli/assets/734738/23a15e26-872b-473c-a92b-858c210f241a)
JohnMcPMS commented 1 month ago

Everything is pointing at some problem connecting to the COM server (although launching it just fine), and the only known issue would have been the UAC disabled. It could be the same issue though, just manifesting some other way.

COM traces are likely the best way forward, but they will probably have information similar to what you have been redacting in your responses. I can tell you how to collect them and you can take a shot at analyzing them, or send them along in a more secure fashion if you are comfortable.

You will need this file: tools/COMTrace/ComTrace.wprp

Then:

[Get AppInstaller ready to Install, but don't Install yet]
> wpr.exe -start <local path to the .wprp file> -filemode
[Click the Install button, wait for it to fail]
> wpr.exe -stop com_trace.etl

You can inspect the resulting .etl file with: https://learn.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-analyzer

This should contain the reason for the failure, probably on the first (chronologically) trace line with the 0x80070005 error (although it is possible that the root cause has some other HRESULT).

AliveDevil commented 1 month ago

Attached com_trace.etl (unfiltered) for:

com_trace.zip

JohnMcPMS commented 1 month ago

Yes, it does indeed look like another instance of the same issue, based on:

Call security blocked activation call: CLSID:{C53A4F16-787E-42A4-B304-29EFFB4BF597}, Client PID (image):1360 (C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.22.11261.0_x64__8wekyb3d8bbwe\AppInstaller.exe), Server PID (image): 0x254c (C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.22.11261.0_x64__8wekyb3d8bbwe\WindowsPackageManagerServer.exe)

@yao-msft was going to be looking at fixing this soon, although it isn't clear what exactly is the ACL mismatch in this case. I don't think there is a short-term mitigation that you can do beyond simply avoiding the feature.

AliveDevil commented 1 month ago

Interesting that I ever encountered this now on the Azure image.

My own test VMs - created using Convert-WindowsImage - don't exhibit this issue (neither 22621, nor 22631).

JohnMcPMS commented 1 month ago

Indeed, I'm contacting experts internally to see if they can help understand the issue better.

JohnMcPMS commented 1 month ago

Experts suggest a dump of the server process (WindowsPackageManagerServer.exe) if you can get it after the install attempt fails. Also the contents of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole, but that is only helpful if the information in the process dump doesn't make sense.

JohnMcPMS commented 1 month ago

They also suggest killing the server process just before attempting as a test (if it isn't running, then that answers the question as well).

AliveDevil commented 1 month ago

So, I created the memory dump of WindowsPackageManagerServer, but even compressed this file exceeds the maximum allowed file size (25 MiB) with 33 MiB. Any preferred way of sharing that file?

Steps were:

AliveDevil commented 1 month ago

WindowsPackageManagerServer memory dump, link valid until the end of the week: https://1drv.ms/u/s!AqDF3R6HxnoJjLk_MNE2l2MtonKX0Q?e=ZWmESH

JohnMcPMS commented 1 month ago

Sorry about the delay, some other things came up. I think we understand what we have to do to fix this (thank you for the process dump), but now we are curious as to why it is happening. If you are able and willing, could you confirm whether the WindowsPackageManagerServer process is elevated or not from Task Manager > Details and enabling the Elevated column.

AliveDevil commented 1 month ago

No worries for the delay.

The WindowsPackageManagerServer is indeed elevated.

yao-msft commented 1 day ago

The issue should be fixed with this pr https://github.com/microsoft/winget-cli/pull/4577 It's included in this pre-release https://github.com/microsoft/winget-cli/releases/tag/v1.8.1762