chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.31k stars 903 forks source link

Choco Installs Incorrect Platform Version. #3335

Closed klawrawkz closed 1 year ago

klawrawkz commented 1 year ago

Checklist

What You Are Seeing?

Brief description of your issue

Choco installs x86 versions on my System Type: x64-based Win 11 Pro (insider) PC.

My rudimentary understanding of the "expected behavior" is that choco selects the install package most appropriate for the system architecture. In my case though, choco is installing x86-based installs by default.

For example, note that winget correctly installs the x64-based package for Azure Functions Core Tools.

PS C:\whatevs> winget install 'Azure Functions Core Tools'
Found Azure Functions Core Tools [Microsoft.Azure.FunctionsCoreTools] Version 4.0.5348
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://github.com/Azure/azure-functions-core-tools/releases/download/4.0.5348/func-cli-4.0.5348-x64.msi
  ██████████████████████████████   207 MB /  207 MB
Successfully verified installer hash
Starting package install...
Successfully installed

By way of contrast, note that choco installs the x86 version of Azure Functions Core Tools.

choco install azure-functions-core-tools
Chocolatey v2.2.2
Installing the following packages:
azure-functions-core-tools
By installing, you accept licenses for the packages.
Progress: Downloading azure-functions-core-tools 4.0.5348... 100%

azure-functions-core-tools v4.0.5348 [Approved]
azure-functions-core-tools package files install completed. Performing other installation steps.
Downloading azure-functions-core-tools
  from 'https://functionscdn.azureedge.net/public/4.0.5348/Azure.Functions.Cli.win-x86.4.0.5348.zip'
Progress: 100% - Completed download of C:\Users\who-evs\AppData\Local\Temp\chocolatey\azure-functions-core-tools\4.0.5348\Azure.Functions.Cli.win-x86.4.0.5348.zip (233.9 MB).
Download of Azure.Functions.Cli.win-x86.4.0.5348.zip (233.9 MB) completed.
Hashes match.
Extracting C:\Users\who-evs\AppData\Local\Temp\chocolatey\azure-functions-core-tools\4.0.5348\Azure.Functions.Cli.win-x86.4.0.5348.zip to C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools...
C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools

What am I missing here?

System Information

OS Name Microsoft Windows 11 Pro Insider Preview
Version 10.0.23545 Build 23545
Other OS Description    Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-WHATEVS
System Manufacturer Dell Inc.
System Model    Precision 3571
System Type x64-based PC
System SKU  0B10
Processor   12th Gen Intel(R) Core(TM) i7-12800H, 2400 Mhz, 14 Core(s), 20 Logical Processor(s)
BIOS Version/Date   Dell Inc. 1.17.1, 8/28/2023
SMBIOS Version  3.4
Embedded Controller Version 255.255
BIOS Mode   UEFI
BaseBoard Manufacturer  Dell Inc.
BaseBoard Product   07K1M2
BaseBoard Version   A00
Platform Role   Mobile
Secure Boot State   On
PCR7 Configuration  Elevation Required to View
Windows Directory   C:\WINDOWS
System Directory    C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume1
Locale  United States
Hardware Abstraction Layer  Version = "10.0.23545.1000"
  User Name DESKTOP-WHATEVS\who-evs
Time Zone   Eastern Daylight Time
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory   63.7 GB
Available Physical Memory   34.9 GB
Total Virtual Memory    67.7 GB
Available Virtual Memory    29.2 GB
Page File Space 4.00 GB
Page File   C:\pagefile.sys
Kernel DMA Protection   On
Virtualization-based security   Running
Virtualization-based security Required Security Properties  
Virtualization-based security Available Security Properties Base Virtualization Support, Secure Boot, DMA Protection, UEFI Code Readonly, SMM Security Mitigations 1.0, Mode Based Execution Control, APIC Virtualization
Virtualization-based security Services Configured   
Virtualization-based security Services Running  Credential Guard
Windows Defender Application Control policy Enforced
Windows Defender Application Control user mode policy   Off
Device Encryption Support   Elevation Required to View
A hypervisor has been detected. Features required for Hyper-V will not be displayed.    

Steps to reproduce

Install via chocolatey cli e.g.: choco install package-what-evs.

Expected behavior

I expect chocolatey to respect the x64 architecture of my box and install x64 packages by default.

Actual behavior

chocolatey does not respect the x64 architecture of my box and installs x86 packages.

Environment

C:\somewhere-over-the-rainbow> choco config
Chocolatey v2.2.2
cacheLocation =  | Cache location if not TEMP folder. Replaces `$env:TEMP` value for choco.exe process. It is highly recommended this be set to make Chocolatey more deterministic in cleanup.
commandExecutionTimeoutSeconds = 2700 | Default timeout for command execution. '0' for infinite.
containsLegacyPackageInstalls = true |
defaultPushSource =  | Default source to push packages to when running 'choco push' command.
defaultTemplateName =  | Default template name used when running 'choco new' command.
proxy =  | Explicit proxy location.
proxyBypassList =  | Optional proxy bypass list. Comma separated.
proxyBypassOnLocal = true | Bypass proxy for local connections.
proxyPassword =  | Optional proxy password. Encrypted.
proxyUser =  | Optional proxy user.
upgradeAllExceptions =  | A comma-separated list of package names that should not be upgraded when running `choco upgrade all'. Defaults to empty.
webRequestTimeoutSeconds = 30 | Default timeout for web requests.

C:\somewhere-over-the-rainbow> choco feature
Chocolatey v2.2.2
[ ] allowEmptyChecksums - Allow packages to have empty/missing checksums for downloaded resources from non-secure locations (HTTP, FTP). Enabling is not recommended if using sources that download resources from the internet.
[x] allowEmptyChecksumsSecure - Allow packages to have empty/missing checksums for downloaded resources from secure locations (HTTPS).
[x] allowGlobalConfirmation - Prompt for confirmation in scripts or bypass.
[x] autoUninstaller - Uninstall from programs and features without requiring an explicit uninstall script.
[x] checksumFiles - Checksum files when pulled in from internet (based on package).
[ ] disableCompatibilityChecks - Disable Compatibility Checks - Should a warning we shown, before and after command execution, when a runtime compatibility check determines that there is an incompatibility between Chocolatey and Chocolatey Licensed Extension. Available in 1.1.0+
[ ] exitOnRebootDetected - Exit On Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires 'usePackageExitCodes' feature to be turned on. Will exit with either 350 or 1604. When it exits with 350, it means pending reboot discovered prior to running operation. When it exits with 1604, it means some work completed prior to reboot request being detected.
[ ] failOnAutoUninstaller - Fail if automatic uninstaller fails.
[ ] failOnInvalidOrMissingLicense - Fail On Invalid Or Missing License - allows knowing when a license is expired or not applied to a machine.
[ ] failOnStandardError - Fail if install provider writes to stderr. Not recommended for use.
[x] ignoreInvalidOptionsSwitches - Ignore Invalid Options/Switches - If a switch or option is passed that is not recognized, should choco fail?
[ ] ignoreUnfoundPackagesOnUpgradeOutdated - Ignore Unfound Packages On Upgrade Outdated - When checking outdated or upgrades, if a package is not found against sources specified, don't report the package at all.
[ ] logEnvironmentValues - Log Environment Values - will log values of environment before and after install (could disclose sensitive data).
[x] logValidationResultsOnWarnings - Log validation results on warnings - Should the validation results be logged if there are warnings?
[ ] logWithoutColor - Log without color - Do not show colorization in logging output.
[x] powershellHost - Use Chocolatey's built-in PowerShell host.
[ ] removePackageInformationOnUninstall - Remove Stored Package Information On Uninstall - When a package is uninstalled, should the stored package information also be removed?
[x] showDownloadProgress - Show Download Progress - Show download progress percentages in the CLI.
[x] showNonElevatedWarnings - Show Non-Elevated Warnings - Display non-elevated warnings.
[ ] skipPackageUpgradesWhenNotInstalled - Skip Packages Not Installed During Upgrade - if a package is not installed, do not install it during the upgrade process.
[ ] stopOnFirstPackageFailure - Stop On First Package Failure - Stop running install, upgrade or uninstall on first package failure instead of continuing with others. As this will affect upgrade all, it is normally recommended to leave this off.
[ ] useEnhancedExitCodes - Use Enhanced Exit Codes - Chocolatey is able to provide enhanced exit codes surrounding list, search, info, outdated and other commands that don't deal directly with package operations. To see enhanced exit codes and their meanings, please run `choco [cmdname] -?`. With this feature off, choco will exit with 0, 1, or -1  (matching previous behavior).
[ ] useFipsCompliantChecksums - Use FIPS Compliant Checksums - Ensure checksumming done by choco uses FIPS compliant algorithms. Not recommended unless required by FIPS Mode. Enabling on an existing installation could have unintended consequences related to upgrades/uninstalls.
[x] usePackageExitCodes - Use Package Exit Codes - Package scripts can provide exit codes. With this on, package exit codes will be what choco uses for exit when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. With this feature off, choco will exit with 0, 1, or -1 (matching previous behavior).
[x] usePackageRepositoryOptimizations - Use Package Repository Optimizations - Turn on optimizations for reducing bandwidth with repository queries during package install/upgrade/outdated operations. Should generally be left enabled, unless a repository needs to support older methods of query. When disabled, this makes queries similar to the way they were done in earlier versions of Chocolatey.
[ ] useRememberedArgumentsForUpgrades - Use Remembered Arguments For Upgrades - When running upgrades, use arguments for upgrade that were used for installation ('remembered'). This is helpful when running upgrade for all packages. This is considered in preview and will be flipped to on by default in a future release.
[ ] virusCheck - Virus Check - perform virus checking on downloaded files. Licensed versions only.

What is Expected?

choco installs the correct platform version, e.g. x64.

How Did You Get This To Happen?

run choco install.

System Information

OS Name Microsoft Windows 11 Pro Insider Preview
Version 10.0.23545 Build 23545
Other OS Description    Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-WHATEVS
System Manufacturer Dell Inc.
System Model    Precision 3571
System Type x64-based PC
System SKU  0B10
Processor   12th Gen Intel(R) Core(TM) i7-12800H, 2400 Mhz, 14 Core(s), 20 Logical Processor(s)
BIOS Version/Date   Dell Inc. 1.17.1, 8/28/2023
SMBIOS Version  3.4
Embedded Controller Version 255.255
BIOS Mode   UEFI
BaseBoard Manufacturer  Dell Inc.
BaseBoard Product   07K1M2
BaseBoard Version   A00
Platform Role   Mobile
Secure Boot State   On
PCR7 Configuration  Elevation Required to View
Windows Directory   C:\WINDOWS
System Directory    C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume1
Locale  United States
Hardware Abstraction Layer  Version = "10.0.23545.1000"
  User Name DESKTOP-WHATEVS\who-evs
Time Zone   Eastern Daylight Time
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory   63.7 GB
Available Physical Memory   34.9 GB
Total Virtual Memory    67.7 GB
Available Virtual Memory    29.2 GB
Page File Space 4.00 GB
Page File   C:\pagefile.sys
Kernel DMA Protection   On
Virtualization-based security   Running
Virtualization-based security Required Security Properties  
Virtualization-based security Available Security Properties Base Virtualization Support, Secure Boot, DMA Protection, UEFI Code Readonly, SMM Security Mitigations 1.0, Mode Based Execution Control, APIC Virtualization
Virtualization-based security Services Configured   
Virtualization-based security Services Running  Credential Guard
Windows Defender Application Control policy Enforced
Windows Defender Application Control user mode policy   Off
Device Encryption Support   Elevation Required to View
A hypervisor has been detected. Features required for Hyper-V will not be displayed.    

Installed Packages

PS C:\somewhere-over-the-rainbow> choco list
Chocolatey v2.2.2
azure-cli 2.52.0
azure-functions-core-tools 4.0.5348
chocolatey 2.2.2
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-dotnetfx.extension 1.0.1
chocolateygui 2.1.0
chocolatey-visualstudio.extension 1.11.0
chocolatey-windowsupdate.extension 1.0.5
docker 99.0.0
docker-cli 24.0.6
dotnetfx 4.8.0.20220524
fiddler 5.0.20211.51073
KB2919355 1.0.20160915
KB2919442 1.0.20160915
KB2999226 1.0.20181019
KB3033929 1.0.5
KB3035131 1.0.3
microsoft-ui-xaml-2-7 2.7.3
microsoft-vclibs-140-00 14.0.30704
python 3.11.5
python3 3.11.5
python311 3.11.5
ssms 15.0.18390
vcredist140 14.36.32532
vcredist2015 14.0.24215.20170201
visualstudio2019buildtools 16.11.29
visualstudio2019-workload-vctools 1.0.1
visualstudio-installer 2.0.3
winget 1.5.2201
winget-cli 1.5.2201
31 packages installed.

Output Log

no, not really.

Additional Context

nope.

TheCakeIsNaOH commented 1 year ago

My rudimentary understanding of the "expected behavior" is that choco selects the install package most appropriate for the system architecture. In my case though, choco is installing x86-based installs by default.

When a package is using the built-in helper functions (e.g. Install-ChocolateyPackage, Install-ChocolateyZipPackage) and both the 32 and 64 bit urls are passed to the helper, then yes, it should select x64 for 64-bit systems.

However, if a package only passes a single url to the helper, then that is the url that is going to be used.

By default, the azure-functions-core-tools only passes the 32 bit url to Install-ChocolateyZipPackage, instead of letting the helper determine what url to use. https://community.chocolatey.org/packages/azure-functions-core-tools/4.0.5382#files

So for azure-functions-core-tools you appear to be having an issue with a specific package, not with Chocolatey itself. The only people who can fix the behavior are the maintainers of the package.

chocolatey does not respect the x64 architecture of my box and installs x86 packages.

Are there any other packages affected? If so, please list them with the specific install command you are using.

klawrawkz commented 1 year ago

@TheCakeIsNaOH, My original perception was that this symptom was pervasive. After your helpful mention re: azure function only passing the 32 bit url that choco uses, I find that azure function is the only flakey install I captured in my notes. I think this is a non-issue that I'll close. If I chance upon another example of choco installing 32 bit, rather than 64, I'll rehydrate this.

Thanks for the explanation and help.