java.io.IOException: Cannot run program "sh" (in directory "d:\jenkins"): CreateProcess error=2, The system cannot find the file specified

Jenkins JIRA | MeTAlMollY | 4 years ago
  1. 0

    I want to execute a batch script on my Windows XP slaves, before the slave gets connected. But this fails, as the slave-setup only supports shell. From Jenkins configuration -> Slave setups |prepare script|-| |setup files directory|D:\jenkins_slavesetup| |setup script after copy|.\launch-slave.bat| |deploy on save now|disabled| |Label Expression|SlaveA| {code} Executing script '.\launch-slave.bat' on SlaveA [jenkins] $ sh -xe C:\Temp\hudson7567579782678732298.sh The system cannot find the file specified ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins java.io.IOException: Cannot run program "sh" (in directory "d:\jenkins"): CreateProcess error=2, The system cannot find the file specified 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:716) at hudson.Launcher$ProcStarter.start(Launcher.java:345) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:941) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:908) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 16 more {code} When I override the Shell executable to 'cmd'. I get the following. {code} Executing script '.\launch-slave.bat' on SlaveA [jenkins] $ cmd -xe C:\Temp\hudson6054783183706487524.sh Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. d:\jenkins>script executed successfully. slave setup done. Slave successfully connected and online {code} But the commands from the launch-slave.bat file are not executed. Expected is something like the following command is executed. This is equal to the Execute Windows batch command from the Build step. {code} [jenkins] $ cmd /c call C:\Temp\hudson6746024923916378374.bat {code}

    Jenkins JIRA | 4 years ago | MeTAlMollY
    java.io.IOException: Cannot run program "sh" (in directory "d:\jenkins"): CreateProcess error=2, The system cannot find the file specified
  2. 0

    I want to execute a batch script on my Windows XP slaves, before the slave gets connected. But this fails, as the slave-setup only supports shell. From Jenkins configuration -> Slave setups |prepare script|-| |setup files directory|D:\jenkins_slavesetup| |setup script after copy|.\launch-slave.bat| |deploy on save now|disabled| |Label Expression|SlaveA| {code} Executing script '.\launch-slave.bat' on SlaveA [jenkins] $ sh -xe C:\Temp\hudson7567579782678732298.sh The system cannot find the file specified ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins java.io.IOException: Cannot run program "sh" (in directory "d:\jenkins"): CreateProcess error=2, The system cannot find the file specified 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:716) at hudson.Launcher$ProcStarter.start(Launcher.java:345) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:941) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:908) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 16 more {code} When I override the Shell executable to 'cmd'. I get the following. {code} Executing script '.\launch-slave.bat' on SlaveA [jenkins] $ cmd -xe C:\Temp\hudson6054783183706487524.sh Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. d:\jenkins>script executed successfully. slave setup done. Slave successfully connected and online {code} But the commands from the launch-slave.bat file are not executed. Expected is something like the following command is executed. This is equal to the Execute Windows batch command from the Build step. {code} [jenkins] $ cmd /c call C:\Temp\hudson6746024923916378374.bat {code}

    Jenkins JIRA | 4 years ago | MeTAlMollY
    java.io.IOException: Cannot run program "sh" (in directory "d:\jenkins"): CreateProcess error=2, The system cannot find the file specified
  3. 0

    'docker build' fails on Linux Jenkins slave with jenkins 1.590

    GitHub | 2 years ago | gcarre
    java.io.IOException: Cannot run program "docker" (in directory "\home\jenkins\jenkins\workspace\gcarre\docker"): error=2, No such file or directory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    problems with hg plugin

    Google Groups | 5 years ago | Matt Fair
    java.io.IOException: Cannot run program "hg" (in directory "...."): error=2, No such file or directory
  6. 0

    [JENKINS-24788] Cannot run program "/bin/java" on maven 3 projects - Jenkins JIRA

    jenkins-ci.org | 5 months ago
    java.io.IOException: Cannot run program "/bin/java" (in directory "/shn/builder/workspace/build-shnproxy-trunk"): java.io.IOException: error=2, No such file or directory

  1. eti22 1 times, last 1 month ago
  2. asdasd 24 times, last 3 months ago
  3. rexgreenza 8 times, last 3 months ago
  4. Benj-AD 1 times, last 4 months ago
  5. Akshay 4 times, last 6 months ago
95 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    CreateProcess error=2, The system cannot find the file specified

    at java.lang.ProcessImpl.create()
  2. Java RT
    ProcessBuilder.start
    1. java.lang.ProcessImpl.create(Native Method)
    2. java.lang.ProcessImpl.<init>(Unknown Source)
    3. java.lang.ProcessImpl.start(Unknown Source)
    4. java.lang.ProcessBuilder.start(Unknown Source)
    4 frames
  3. Hudson
    Launcher$RemoteLaunchCallable.call
    1. hudson.Proc$LocalProc.<init>(Proc.java:244)
    2. hudson.Proc$LocalProc.<init>(Proc.java:216)
    3. hudson.Launcher$LocalLauncher.launch(Launcher.java:716)
    4. hudson.Launcher$ProcStarter.start(Launcher.java:345)
    5. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:941)
    6. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:908)
    6 frames
  4. Hudson :: Remoting Layer
    InterceptingExecutorService$1.call
    1. hudson.remoting.UserRequest.perform(UserRequest.java:118)
    2. hudson.remoting.UserRequest.perform(UserRequest.java:48)
    3. hudson.remoting.Request$2.run(Request.java:326)
    4. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    4 frames
  5. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    2. java.util.concurrent.FutureTask.run(Unknown Source)
    3. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    5. java.lang.Thread.run(Unknown Source)
    5 frames