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

PortableUninstall uninstaller failed: 2316632067 #4542

Open
o-l-a-v opened this issue Jun 5, 2024 · 5 comments
Open

PortableUninstall uninstaller failed: 2316632067 #4542

o-l-a-v opened this issue Jun 5, 2024 · 5 comments
Labels
Command-Uninstall Issue related to WinGet Uninstall Issue-Bug It either shouldn't be doing this or needs an investigation. Portable Issue related to portable package

Comments

@o-l-a-v
Copy link

o-l-a-v commented Jun 5, 2024

Brief description of your issue

I PR-ed Azure CLI ZIP: microsoft/winget-pkgs#156657

Doing so I tested the manifest locally:

# Try validating
winget validate --manifest "<path_to_directory_with_yaml_files>"

# [admin] Enable required settings
winget settings --enable LocalArchiveMalwareScanOverride
winget settings --enable LocalManifestFiles

# Try installing
winget install --manifest "<path_to_directory_with_yaml_files>" --installer-type portable

# [admin] Disable settings that was enabled
winget settings --disable LocalArchiveMalwareScanOverride
winget settings --disable LocalManifestFiles

After I got it working I sent the PR. Then I wanted to uninstall this package. I first tried:

C:\Users\olavb>winget list --id Microsoft.AzureCLI
Name                Id                 Version Source
------------------------------------------------------
Microsoft Azure CLI Microsoft.AzureCLI 2.61.0  winget

C:\Users\olavb>winget uninstall --id Microsoft.AzureCLI
No installed package found matching input criteria.

C:\Users\olavb>

It can list the package, but not uninstall it. I then tried using --manifest switch with winget uninstall.

C:\Users\olavb>winget uninstall --manifest "C:\Users\olavb\OneDrive\IT\Code\PowerShell\CLI\Winget\Winget manifests WIP\Azure CLI v2.61.0"
Found Microsoft Azure CLI [Microsoft.AzureCLI]
Starting package uninstall...
An unexpected error occurred while executing the command:
remove_all: unknown error: "C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI__DefaultSource\Lib"
Uninstall failed with exit code: 0x8a150003 : Executing command failed

C:\Users\olavb>

Here are the last things that happened in the logs from winget uninstall --manifest "C:\Users\olavb\OneDrive\IT\Code\PowerShell\CLI\Winget\Winget manifests WIP\Azure CLI v2.61.0" --verbose --logs (full log was too much for a GitHub comment, and did not provide any useful info anyways as far as I could see):

2024-06-05 21:38:46.734 [CLI ] Found one app. App id: Microsoft.AzureCLI App name: Microsoft Azure CLI
2024-06-05 21:38:46.736 [REPO] Opening database for ReadWrite at 'C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI__DefaultSource\microsoft.azurecli__defaultsource.db'
2024-06-05 21:38:46.736 [REPO] Opened Portable Index with version [1.0], last write [2024-06-05 21:38:13.000]
2024-06-05 21:38:46.982 [REPO] Opening database for ReadWrite at 'C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI__DefaultSource\microsoft.azurecli__defaultsource.db'
2024-06-05 21:38:46.982 [REPO] Opened Portable Index with version [1.0], last write [2024-06-05 21:38:13.000]
2024-06-05 21:38:46.982 [CLI ] Removing directory at C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI__DefaultSource\Lib
2024-06-05 21:38:46.985 [CLI ] Caught std::exception: remove_all: unknown error: "C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI__DefaultSource\Lib"
2024-06-05 21:38:46.986 [CLI ] PortableUninstall uninstaller failed: 2316632067
2024-06-05 21:38:46.987 [CLI ] Terminating context: 0x8a150057 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UninstallFlow.cpp:16a

Steps to reproduce

See above. Manifest available in PR microsoft/winget-pkgs#156657.

Expected behavior

If Winget can add it, it should be able to remove it.

Actual behavior

Winget could add it, but not remove it.

Environment

C:\Users\olavb>winget --info
Windows Package Manager v1.7.11261
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3593
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.11261.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
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                        Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Enabled

C:\Users\olavb>
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jun 5, 2024
Copy link

github-actions bot commented Jun 5, 2024

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!

Open similar issues:

Closed similar issues:

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

@denelon denelon added Command-Uninstall Issue related to WinGet Uninstall Portable Issue related to portable package and removed Needs-Triage Issue need to be triaged labels Jun 5, 2024
@denelon
Copy link
Contributor

denelon commented Jun 5, 2024

Was another version of the CLI installed at the time?

@o-l-a-v
Copy link
Author

o-l-a-v commented Jun 5, 2024

No. Not the MSI installed manually nor with WinGet. Not portable with Scoop.

Had the MSI installed prior to this, but uninstalled it before I started authoring the manifest for adding ZIP.

@o-l-a-v
Copy link
Author

o-l-a-v commented Jun 7, 2024

Now that winget-pkgs have the portable version of Microsoft.AzureCLI in the manifest too, it's easy to reproduce.

C:\Users\olavb>winget install --id Microsoft.AzureCLI --installer-type portable
Found Microsoft Azure CLI [Microsoft.AzureCLI] Version 2.61.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://azcliprod.blob.core.windows.net/zip/azure-cli-2.61.0-x64.zip
  ██████████████████████████████  93.0 MB / 93.0 MB
Successfully verified installer hash
Extracting archive...
Successfully extracted archive
Starting package install...
Command line alias added: "az"
Successfully installed
Notes: Winget installs the 64-bit CLI on 64-bit OS by default now. If you have used the 32-bit CLI before, please follow this guide to migrate to 64-bit version: https://learn.microsoft.com/cli/azure/install-azure-cli-windows#migrate-to-64-bit-azure-cli

C:\Users\olavb>winget list --id Microsoft.AzureCLI
Name                Id                 Version Source
------------------------------------------------------
Microsoft Azure CLI Microsoft.AzureCLI 2.61.0  winget

C:\Users\olavb>winget uninstall --id Microsoft.AzureCLI
No installed package found matching input criteria.

C:\Users\olavb>

I also tried the uninstall string found in the registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe key UninstallString. It gives this error:

C:\Users\olavb>winget uninstall --product-code Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe
Found Microsoft Azure CLI [Microsoft.AzureCLI]
Starting package uninstall...
An unexpected error occurred while executing the command:
remove_all: unknown error: "C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Lib"
Uninstall failed with exit code: 0x8a150003 : Executing command failed

C:\Users\olavb>

Looking inside %LOCALAPPDATA%\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe some stuff has been removed, but far from all. Looking inside logs:

2024-06-07 19:34:45.952 [CLI ] Removing directory at C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Lib
2024-06-07 19:34:45.954 [CLI ] Caught std::exception: remove_all: unknown error: "C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Lib"
2024-06-07 19:34:45.955 [CLI ] PortableUninstall uninstaller failed: 2316632067
2024-06-07 19:34:45.956 [CLI ] Terminating context: 0x8a150057 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UninstallFlow.cpp:16a

It fails to delete directory "lib".

I think this has something to do with long paths. Azure CLI got some paths that are just insanely long. The longest file path I could find had 285 characters in total.

PS C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe> (Get-ChildItem -Recurse).FullName | Sort-Object -Property @{'Expression'={[uint16]$_.'Length'}} -Descending | Select-Object -First 1
C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe\Lib\site-packages\azure\cli\command_modules\dla\vendored_sdks\azure_mgmt_datalake_analytics\catalog\models\data_lake_analytics_catalog_secret_create_or_update_parameters.pyc
PS C:\Users\olavb\AppData\Local\Microsoft\WinGet\Packages\Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe>

Edit: Yes, I have LongPathsEnabled: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later.

@o-l-a-v
Copy link
Author

o-l-a-v commented Jun 7, 2024

Repro on a freshly installed Windows 11 23H2 x64 VM. Every command was run without admin permissions.

Verbose logs from winget uninstall --id Microsoft.AzureCLI, says no such package was found while winget list --id Microsoft.AzureCLI sees it.

WinGet-2024-06-07-22-45-21.546.log

Verbose logs from winget uninstall --product-code Microsoft.AzureCLI_Microsoft.Winget.Source_8wekyb3d8bbwe.

WinGet-2024-06-07-22-47-43.393.log

Seems this throws the error?

@denelon denelon added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-Uninstall Issue related to WinGet Uninstall Issue-Bug It either shouldn't be doing this or needs an investigation. Portable Issue related to portable package
Projects
None yet
Development

No branches or pull requests

2 participants