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

[Bug]: Error when trying to install azure-cli #5300

Closed
3 tasks done
ahrib opened this issue Nov 29, 2023 · 8 comments
Closed
3 tasks done

[Bug]: Error when trying to install azure-cli #5300

ahrib opened this issue Nov 29, 2023 · 8 comments
Labels
bug Something isn't working waiting feedback Waiting for user feedback

Comments

@ahrib
Copy link

ahrib commented Nov 29, 2023

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues/PRs to ensure it has not already been reported or fixed.
  • I have verified that I am using the latest version of Scoop and corresponding bucket.

Package Name

azure-cli

Expected/Current Behaviour

Current behaviour
Having a problem updating or installing the azure-cli package (2.54.0 at time of writing). The last successful version of the package I was able to install was version 2.51.0

The error I receive from the azure-cli installer is "Error writing to file:
C:\users\XXXXXXXX\scoop\apps\azure-cli\2.54.0_tmp\SourceDir\Microsoft SDKs\Azure\SLI2\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"

The Log file referenced by scoop does not exist. (~\scoop\apps\azure-cli\2.54.0\msi.log)

Steps to Reproduce

PS> scoop install azure-cli
Installing 'azure-cli' (2.54.0) [64bit] from main bucket
Loading azure-cli-2.54.0.msi from cache
Checking hash of azure-cli-2.54.0.msi ... ok.
Extracting azure-cli-2.54.0.msi ... ERROR Exit code was 1603!
Failed to extract files from C:\Users\xxxxxxxx\scoop\apps\azure-cli\2.54.0\azure-cli-2.54.0.msi.
Log file:
  ~\scoop\apps\azure-cli\2.54.0\msi.log

Please try again or create a new issue by using the following link and paste your console output:
https://github.com/ScoopInstaller/Main/issues/new?title=azure-cli%402.54.0%3a+decompress+error

Possible Solution

The error I receive from the installer (see current behaviour section) references a very long file path.. possible solution is to change the temp folder where the MSI is extracted to a shorter path

Scoop and Buckets Version

PS>  scoop --version
Current Scoop version:
v0.3.1 - Released at 2022-11-15

'extras' bucket:
49f53d59c (HEAD -> master, origin/master, origin/HEAD) vivaldi: Update to version 6.4.3160.47

'main' bucket:
e84554454 (HEAD -> master, origin/master, origin/HEAD) ripgrep: Update to version 14.0.3

Scoop Config

PS> scoop config

aria2-enabled : False
aria2-options : {--check-certificate=false}
proxy         :
last_update   : 29/11/2023 2:17:11 PM
scoop_branch  : master
scoop_repo    : https://github.com/ScoopInstaller/Scoop

PowerShell Version

PS> $PSVersiontable

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional Softwares

No response

@ahrib ahrib added the bug Something isn't working label Nov 29, 2023
@rob-spoor
Copy link

rob-spoor commented Dec 5, 2023

I have the same issue on one machine but not on another. The difference is the username - 6 characters where it works, 9 where it doesn't. The file it complains about is 261 characters:
C:\Users\xxxxxxxxx\scoop\apps\azure-cli\2.55.0\_tmp\SourceDir\Microsoft SDKs\Azure\CLI2\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. And no, I cannot change my username.

@rob-spoor
Copy link

I managed to install version 2.55.0 by changing decompress.ps1:

    if ($ExtractDir) {
        $OriDestinationPath = $DestinationPath
        #$DestinationPath = "$DestinationPath\_tmp"
        $DestinationPath = "$env:TMP\scoop"
    }

@abatishchev
Copy link

Same error for me

@HUMORCE
Copy link
Member

HUMORCE commented Jan 14, 2024

> scoop checkup
WARN  LongPaths support is not enabled.
  You can enable it by running:
    sudo Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
  (Requires 'sudo' command. Run 'scoop install sudo' if you don't have it.)

Would a enabled long path support solve this issue? OR scoop config use_lessmsi true; scoop install azure-cli; scoop config use_lessmsi false

@HUMORCE HUMORCE added the waiting feedback Waiting for user feedback label Jan 14, 2024
@ahrib
Copy link
Author

ahrib commented Jan 15, 2024

Hi appreciate the suggestions.

LongPaths support is disabled by my organization and I am unable to change this.

running scoop config use_lessmsi true; scoop install azure-cli; scoop config use_lessmsi false (note use of azure-cli not aws-sam-cli) installed the tool successfully - good workaround.

I like rob-spoor's approach as well in the comment #5300 (comment)

@HUMORCE
Copy link
Member

HUMORCE commented Jan 15, 2024

running scoop config use_lessmsi true; scoop install azure-cli; scoop config use_lessmsi false (note use of azure-cli not aws-sam-cli) installed the tool successfully - good workaround.

emmmm, I was working on another issue at the time and got confused.

I like rob-spoor's approach as well in the comment #5300 (comment)

Yes, it is works, but may caused performance issue (when moving extracted files), if users installs Scoop to another disk instead of disk of system partition. And changes to Core code may cause Scoop's self-update fail when next release published.

@rashil2000
Copy link
Member

The official fix for this is enabling LongPath support, if not, using LessMSI as commented earlier.

Closing the issue in this light.

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Apr 30, 2024

Azure CLI is also released as a ZIP package now, but then only for x64.

What about changing the manifest to use ZIP instead? Or add a azure-cli-zip.json manifest?


Edit: Here's a manifest that seems do work at least for installation. Filename azure-cli-zip.json.

{
  "version": "2.60.0",
  "description": "A cross-platform command-line tool to connect to Azure and execute administrative commands on Azure resources",
  "homepage": "https://aka.ms/cli",
  "license": "MIT",
  "notes": [
    "* Known issue:",
    "  - Cannot be extracted due to long path: https://github.com/ScoopInstaller/Main/issues/5300"
  ],
  "architecture": {
    "64bit": {
      "url": "https://azcliprod.blob.core.windows.net/zip/azure-cli-2.60.0-x64.zip",
      "hash": "40891711b9cc31693df7445db5236f8c7a6cae851f9087cace0e0186781a6a73"
    }
  },
  "env_set": {
    "AZURE_CLI_PATH": "$dir\\bin",
    "AzureCLIPath": "$dir\\bin"
  },
  "bin": "bin\\az.cmd",
  "checkver": {
    "github": "https://github.com/Azure/azure-cli",
    "regex": "/releases/tag/azure-cli-([\\d.]+)"
  },
  "autoupdate": {
    "architecture": {
      "64bit": {
        "url": "https://azcliprod.blob.core.windows.net/zip/azure-cli-$version-x64.zip"
      }
    }
  }
}

A PowerShell command to chech whether long paths has been enabled, could be used in post_install maybe?

[bool](
    (Get-ItemPropertyValue -Path 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -ErrorAction 'Ignore') -eq 1
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting feedback Waiting for user feedback
Projects
None yet
Development

No branches or pull requests

6 participants