Open o-l-a-v opened 3 months 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!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Was another version of the CLI installed at the time?
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.
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.
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?
Brief description of your issue
I PR-ed Azure CLI ZIP: https://github.com/microsoft/winget-pkgs/pull/156657
Doing so I tested the manifest locally:
After I got it working I sent the PR. Then I wanted to uninstall this package. I first tried:
It can list the package, but not uninstall it. I then tried using
--manifest
switch withwinget uninstall
.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):Steps to reproduce
See above. Manifest available in PR https://github.com/microsoft/winget-pkgs/pull/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