简体   繁体   中英

Jenkins slave cannot install jdk

I'm trying to run some basic batch command from a Jenkins job on a Windows slave, but it seems that Jenkins can not install jdk.

Since it says CreateProcess error=740, The requested operation requires elevation I tried running the slave being logged in as administrator and completely disabling UAC in Windows with no succes.

Any clues on getting this to work? I'm running Windows 8.

EDIT: I tried setting C:\\Jenkins\\tools\\hudson.model.JDK\\Java_SE_Development_Kit_8u60\\jdk to always run as administrator for all users. This didn't help. When I try to run the jdk locally in cmd.exe, it does run without errors.

Here's the full stack trace:

Installing C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe
[Java_SE_Development_Kit_8u60] $ C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60 /L C:\Jenkins\tools\hudson.model.JDK\install4140010637459422013log
Unknown error (0x2e4)
FATAL: command execution failed
java.io.IOException: Cannot run program "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe" (in directory "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60"): CreateProcess error=740, The requested operation requires elevation
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to ToonBed(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
    at hudson.remoting.Channel.call(Channel.java:778)
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$ProcStarter.join(Launcher.java:389)
    at hudson.tools.JDKInstaller.install(JDKInstaller.java:268)
    at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:141)
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
    at hudson.model.JDK.forNode(JDK.java:132)
    at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:359)
    at hudson.model.Run.getEnvironment(Run.java:2234)
    at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
    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:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)
Build step 'Execute Windows batch command' marked build as failure
Robot results publisher started...
-Parsing output xml:
Installing C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe
[Java_SE_Development_Kit_8u60] $ C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe /s ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60 /L C:\Jenkins\tools\hudson.model.JDK\install2992849421630137437log
Failed!
java.io.IOException: Cannot run program "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60\jdk.exe" (in directory "C:\Jenkins\tools\hudson.model.JDK\Java_SE_Development_Kit_8u60"): CreateProcess error=740, The requested operation requires elevation
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to ToonBed(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1413)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
    at hudson.remoting.Channel.call(Channel.java:778)
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$ProcStarter.join(Launcher.java:389)
    at hudson.tools.JDKInstaller.install(JDKInstaller.java:268)
    at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:141)
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
    at hudson.model.JDK.forNode(JDK.java:132)
    at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:359)
    at hudson.model.Run.getEnvironment(Run.java:2234)
    at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
    at hudson.plugins.robot.RobotPublisher.perform(RobotPublisher.java:234)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1766)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at hudson.remoting.Engine$1$1.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)
Finished: FAILURE

Seems like you don't have access to these files. Maybe run as Adminstrator or change owners?

A possible solution that I know is necessary in some situations, is to enable administrator privileges by: creating a shortcut to the executable, then Right-click shortcut -> Properties -> Advanced -> check "Run as Administrator". Then just target the shortcut in your script, cross your fingers and spin in your chair 3 times.

(Edited due to terrible grammar.)

There may be several possible ways to fix this.
mentioned in jenkins forum
https://wiki.jenkins.io/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM

What eventually worked for me was
Jenkins requires full access to WBEM Scripting Locator (HKEY_CLASSES_ROOT\\CLSID{76A64158-CB41-11D1-8B02-00600806D9B6}).
Default for administrators group is just read.
So we need to change permissions for administrators group to "Full Control".
1. Launch 'regedit.exe' as 'Administrator'
2. Find the following registry key: HKEY_CLASSES_ROOT\\CLSID\\ {76A64158-CB41-11D1-8B02-00600806D9B6}
3. Right click and select 'Permissions'
4. Change owner to administrators group.
5. Change permissions for administrators group --> Grant Full Control.
6. Change owner back to TrustedInstaller (user is "NT Service\\TrustedInstaller")
7. Restart Remote Registry Service
8. Install vcredist 2008 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5582 on the slave
9. Make sure java executable is set in the PATH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM