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

File not found error when using --source=cygwin to install packages #2953

Closed
4 tasks done
egor-tensin opened this issue Jan 2, 2023 · 3 comments
Closed
4 tasks done

Comments

@egor-tensin
Copy link

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

New versions of choco cannot install packages w/ --source cygwin. It looks like this:

wtf

Adding --noop shows that choco for some reason doesn't set the root installation directory in the command line:

noop

What is Expected?

Packages should be installed, obviously.

How Did You Get This To Happen?

  1. Install a new version of Chocolatey (1.2.0+).
  2. Install Cygwin using choco install cygwin -y --package-parameters='/InstallDir:C:\cg'
  3. Run choco install cmake --source=cygwin.

This doesn't happen if after installing Chocolatey you downgrade it using choco install chocolatey --version 1.1.0 --allow-downgrade -y.

In both cases (with a new and an older version), I can see that choco reads HKLM\Software\Cygwin\setup\rootdir using procmon.

System Details

  • Operating System: 10.0.20348.0
  • Windows PowerShell version: 5.1.20348.1366
  • Chocolatey CLI Version: 1.2.1
  • Chocolatey Licensed Extension version: 1.2.1
  • Chocolatey License type:
  • Terminal/Emulator: CMD

Installed Packages

Chocolatey v1.2.1
chocolatey 1.2.1
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
Cygwin 3.4.3
sysinternals 2022.11.28
5 packages installed.

Output Log

2023-01-02 01:05:24,617 1156 [DEBUG] - XmlConfiguration is now operational
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'WebPiService' for type 'ISourceRunner' from assembly 'choco'
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'WindowsFeatureService' for type 'ISourceRunner' from assembly 'choco'
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'CygwinService' for type 'ISourceRunner' from assembly 'choco'
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'PythonService' for type 'ISourceRunner' from assembly 'choco'
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'RubyGemsService' for type 'ISourceRunner' from assembly 'choco'
2023-01-02 01:05:24,680 1156 [DEBUG] - Adding new type 'SystemStateValidation' for type 'IValidation' from assembly 'choco'
2023-01-02 01:05:24,836 1156 [DEBUG] - Registering new command 'template' in assembly 'choco'
2023-01-02 01:05:24,836 1156 [DEBUG] - Registering new command 'upgrade' in assembly 'choco'
2023-01-02 01:05:24,836 1156 [DEBUG] - Registering new command 'export' in assembly 'choco'
2023-01-02 01:05:24,836 1156 [DEBUG] - Registering new command 'list' in assembly 'choco'
2023-01-02 01:05:24,836 1156 [DEBUG] - Registering new command 'info' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'help' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'config' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'features' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'new' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'outdated' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'pack' in assembly 'choco'
2023-01-02 01:05:24,851 1156 [DEBUG] - Registering new command 'pin' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'push' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'apikey' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'source' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'uninstall' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'unpackself' in assembly 'choco'
2023-01-02 01:05:24,883 1156 [DEBUG] - Registering new command 'install' in assembly 'choco'
2023-01-02 01:05:25,023 1156 [INFO ] - ============================================================
2023-01-02 01:05:25,211 1156 [INFO ] - Chocolatey v1.2.1
2023-01-02 01:05:25,242 1156 [DEBUG] - Chocolatey is running on Windows v 10.0.20348.0
2023-01-02 01:05:25,258 1156 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2023-01-02 01:05:25,258 1156 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2023-01-02 01:05:25,289 1156 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install cmake --source cygwin --debug --verbose
2023-01-02 01:05:25,305 1156 [DEBUG] - Received arguments: install cmake --source cygwin --debug --verbose
2023-01-02 01:05:25,367 1156 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2023-01-02 01:05:25,398 1156 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2023-01-02 01:05:25,414 1156 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2023-01-02 01:05:25,476 1156 [DEBUG] - Performing validation checks.
2023-01-02 01:05:25,492 1156 [DEBUG] - Global Configuration Validation Checks:
2023-01-02 01:05:25,492 1156 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
2023-01-02 01:05:25,492 1156 [DEBUG] - System State Validation Checks:
2023-01-02 01:05:25,492 1156 [DEBUG] -  Reboot Requirement Checks:
2023-01-02 01:05:25,492 1156 [DEBUG] -  - Pending Computer Rename = Checked
2023-01-02 01:05:25,508 1156 [DEBUG] -  - Pending Component Based Servicing = Checked
2023-01-02 01:05:25,508 1156 [DEBUG] -  - Pending Windows Auto Update = Checked
2023-01-02 01:05:25,508 1156 [DEBUG] -  - Pending File Rename Operations = Ignored
2023-01-02 01:05:25,508 1156 [DEBUG] -  - Pending Windows Package Installer = Checked
2023-01-02 01:05:25,508 1156 [DEBUG] -  - Pending Windows Package Installer SysWow64 = Checked
2023-01-02 01:05:25,523 1156 [INFO ] - 2 validations performed. 2 success(es), 0 warning(s), and 0 error(s).
2023-01-02 01:05:25,539 1156 [DEBUG] - The source 'cygwin' evaluated to a 'cygwin' source type
2023-01-02 01:05:25,555 1156 [DEBUG] - 
NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
2023-01-02 01:05:25,570 1156 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\Administrator\AppData\Local\Temp\2\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='cygwin'|SourceType='cygwin'|Debug='True'|Verbose='True'|
Trace='False'|Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='True'|DisableCompatibilityChecks='False'|
AcceptLicense='False'|AllowUnofficialBuild='False'|Input='cmake'|
AllVersions='False'|SkipPackageInstallProvider='False'|
SkipHookScripts='False'|PackageNames='cmake'|Prerelease='False'|
ForceX86='False'|OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|PinPackage='False'|
Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.20348.0'|
Information.PlatformName='Windows Server 2016'|
Information.ChocolateyVersion='1.2.1.0'|
Information.ChocolateyProductVersion='1.2.1'|
Information.FullName='choco, Version=1.2.1.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='Administrator'|
Information.UserDomainName='EC2AMAZ-VDKJE1B'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='True'|Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\Users\Administrator'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
ListCommand.LocalOnly='False'|ListCommand.IdOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.ByTagOnly='False'|ListCommand.IdStartsWith='False'|
ListCommand.OrderByPopularity='False'|ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|
2023-01-02 01:05:25,586 1156 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
2023-01-02 01:05:25,586 1156 [DEBUG] - Running list with the following filter = ''
2023-01-02 01:05:25,601 1156 [DEBUG] - --- Start of List ---
2023-01-02 01:05:25,836 1156 [DEBUG] - chocolatey 1.2.1
2023-01-02 01:05:25,851 1156 [DEBUG] - chocolatey-compatibility.extension 1.0.0
2023-01-02 01:05:25,851 1156 [DEBUG] - chocolatey-core.extension 1.4.0
2023-01-02 01:05:25,867 1156 [DEBUG] - Cygwin 3.4.3
2023-01-02 01:05:25,867 1156 [INFO ] - Installing the following packages:
2023-01-02 01:05:25,867 1156 [INFO ] - cmake
2023-01-02 01:05:25,867 1156 [INFO ] - By installing, you accept licenses for the packages.
2023-01-02 01:05:25,914 1156 [DEBUG] - Calling command ['"cygwinsetup.exe" --quiet-mode --no-desktop --no-startmenu --root  --local-package-dir \packages --site http://mirrors.kernel.org/sourceware/cygwin/ --packages cmake']
2023-01-02 01:05:25,961 1156 [WARN ] - 
Chocolatey installed 0/0 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2023-01-02 01:05:25,961 1156 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2023-01-02 01:05:25,976 1156 [ERROR] - Chocolatey had an error occur:
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at chocolatey.infrastructure.commands.CommandExecutor.execute_static(String process, String arguments, Int32 waitForExitInSeconds, String workingDirectory, Action`2 stdOutAction, Action`2 stdErrAction, Boolean updateProcessPath, Boolean allowUseWindow, Boolean waitForExit)
   at chocolatey.infrastructure.commands.CommandExecutor.execute(String process, String arguments, Int32 waitForExitInSeconds, String workingDirectory, Action`2 stdOutAction, Action`2 stdErrAction, Boolean updateProcessPath, Boolean allowUseWindow)
   at chocolatey.infrastructure.app.services.CygwinService.install_run(ChocolateyConfiguration config, Action`1 continueAction)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.perform_source_runner_function[T](ChocolateyConfiguration config, Func`2 function)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.install_run(ChocolateyConfiguration config)
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
   at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Container container)
   at chocolatey.console.Program.Main(String[] args)
2023-01-02 01:05:25,976 1156 [DEBUG] - Exiting with 1

Additional Context

No response

@egor-tensin egor-tensin added the Bug label Jan 2, 2023
@pauby
Copy link
Member

pauby commented Jan 2, 2023

cygwinsetup doesn't appear to be an executable that can be called either because it's no longer there or it's not on the path. So this:

Calling command ['"cygwinsetup.exe" --quiet-mode --no-desktop --no-startmenu --root  --local-package-dir \packages --site http://mirrors.kernel.org/sourceware/cygwin/ --packages cmake']

Isn't going to work. The workaround would obviously be to install the cmake package natively in cygwin for the time being.

@egor-tensin
Copy link
Author

The workaround would obviously be to install the cmake package natively in cygwin for the time being.

Sure. The issue is for a fairly useful script, which uses choco to install Cygwin & packages programmatically.

@gep13 gep13 added this to the 1.3.0 milestone Jan 12, 2023
vexx32 added a commit to vexx32/choco that referenced this issue Feb 13, 2023
Previously there was a change to make ISourceRunner instances managed
as transient instead of singletons. This is reasonable for most things,
but it means we cannot rely on storing state in instance fields for
ISourceRunner instances.

This change ensures that the state data created by
ensure_source_app_installed() can be kept around for the followup call
to install_run() by storing it in a static field that all instances
can make use of.

We may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
vexx32 added a commit to vexx32/choco that referenced this issue Feb 14, 2023
PCurrently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time.

This change ensures that the state data created by
ensure_source_app_installed() can be kept around for the followup call
to install_run() by storing it in a static field that all instances
can make use of.

We may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
vexx32 added a commit to vexx32/choco that referenced this issue Feb 14, 2023
Currently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time.

This change ensures that the state data created by
ensure_source_app_installed() can be kept around for the followup call
to install_run() by storing it in a static field that all instances
can make use of.

We may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
vexx32 added a commit to vexx32/choco that referenced this issue Feb 14, 2023
Currently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time across separate invocations from the
ChocolateyPackageService.

This change ensures that the RootDirectory is always null-checked and
set if not present.

In future, we may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
@vexx32 vexx32 changed the title Cannot install packages with Cygwin as source File not found error when using --source=cygwin to install packages Feb 14, 2023
vexx32 added a commit to vexx32/choco that referenced this issue Feb 14, 2023
Currently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time across separate invocations from the
ChocolateyPackageService.

This change ensures that the RootDirectory is always null-checked and
set if not present.

In future, we may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
vexx32 added a commit to vexx32/choco that referenced this issue Feb 14, 2023
Currently, ISourceRunner instances seem to be managed as transient.
This is reasonable for many things, but it means we cannot rely on
storing state in instance fields for ISourceRunner instances at the
current time across separate invocations from the
ChocolateyPackageService.

This change ensures that the RootDirectory is always null-checked and
set if not present.

In future, we may want to discuss a design improvement/refactor to ensure that we
aren't losing any other critical state data between these invocations
for any other ISourceRunners.
gep13 added a commit that referenced this issue Feb 15, 2023
(#2953, #3026) Ensure CygwinService can find the correct RootDirectory
@vexx32 vexx32 closed this as completed Feb 15, 2023
@vexx32
Copy link
Member

vexx32 commented Feb 15, 2023

🎉 This issue has been resolved in version 1.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

gep13 added a commit that referenced this issue Feb 16, 2023
* support/1.x:
  (#3026) Deprecate CygwinService public methods
  (#2953) CygwinService: always set RootDirectory
  (tests) Enable local source
  (maint) Remove/Fix some comments mentioning WebPI
  (#2958) Deprecate WebPI source runner
  (#2981) Deprecate install with direct file path
  (#2985) Deprecate features/sources in `config list`
  (#2983) Deprecate `--remove` option for apikey cmd
  (#2930) Update GenerateDocs.ps1 for choco-theme
  (build) Update Github workflow action versions
  (maint) Add GitReleaseManager.yaml
  (build) Add GitVersion.yml file
  (build) Add missing Criteria
  (build) Update to latest Chocolatey.Cake.Recipe
  (build) Add parameter to not build AWS projects
  (#2870) Update sln and csproj files
  (#2870) Adds No7zip build to recipe.cake

# Conflicts:
#	GenerateDocs.ps1
#	GitVersion.yml
#	gitreleasemanager.yaml
#	src/chocolatey.resources/helpers/ChocolateyTabExpansion.ps1
#	tests/chocolatey-tests/commands/choco-install.Tests.ps1
#	tests/chocolatey-tests/commands/choco-list.Tests.ps1
t-w added a commit to t-w/ADFlib that referenced this issue Mar 9, 2024
The original stopped working, it tries to install chocolatey 1.1.0
due to some bug (explained there in the comment), but that bug
seems fixed (according to:
chocolatey/choco#2953).
So using action with disabled downgrading chocolatey.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants