1

my Jenkins job fails as it gives this error message:

hudson.util.IOException2: Failed to locate Cygwin installation. Is Cygwin installed?
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.getCygwinRoot(CygpathLauncherDecorator.java:138)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.call(CygpathLauncherDecorator.java:142)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.call(CygpathLauncherDecorator.java:112)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.getCygpathExe(CygpathLauncherDecorator.java:104)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.cygpath(CygpathLauncherDecorator.java:86)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.launch(CygpathLauncherDecorator.java:65)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1759)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.util.jna.JnaException: Win32 error: 2 - The system cannot find the file specified
at hudson.util.jna.RegistryKey.check(RegistryKey.java:124)
at hudson.util.jna.RegistryKey.open(RegistryKey.java:223)
at hudson.util.jna.RegistryKey.openReadonly(RegistryKey.java:218)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.getCygwinRoot(CygpathLauncherDecorator.java:127)
... 18 more

Im running Jenkins on windows and want to run the scripts in this github repo: https://github.com/y0u-s/test

I have the Jenkins shell program path set to: C:\cygwin64\bin\bash

I am stuck at this right now, what can I do to resolve this problem?

Richard
  • 11

1 Answers1

0

OK I'm going to be posting this solution in a couple places as this is what worked for me and this issue appears in a couple questions. Unfortunately the solution requires some registry editing.

TLDR Solution:

- Make sure cygwin is installed
- Open regedit.
- Go to HKEY_LOCAL_MACHINE - SOFTWARE - Wow6432Node
- Right click on Wow6432Node New->Key name it Cygwin
- Right click on Cygwin New->Key name it setup
- Right click on setup New->String Value name it rootdir
- Right click on rootdir Modify set it to your cygwin folder mine was "C:\cygwin64"

The reasoning

https://github.com/jenkinsci/cygpath-plugin/blob/master/src/main/java/hudson/plugins/cygpath/CygpathLauncherDecorator.java

Is the Jenkins code for how it finds Cygwin. Line 115 is the start of a for loop where it looks initially in the SOFTWARE\Wow6432Node, then in SOFTWARE for the Cygwin directory. In my case I already had "SOFTWARE\Cygwin\setup\rootdir Only it does not seem to be able to find it. I hazard there is some issue where it exits the loop early or does not check the SOFTWARE directory correctly. Using the solution posted above is an unpleasant work around to this issue.