Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50638

windows agent via SSH - Slave JVM has terminated. Exit code

    XMLWordPrintable

Details

    Description

      The jar file on the slave fails to start.

      I use "Launch Slave Agents via SSH"

      [04/06/18 15:32:05] [SSH] Opening SSH connection to 192.168.120.187:22.
      
      [04/06/18 15:32:06] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
      
      [04/06/18 15:32:06] [SSH] Authentication successful.
      
      [04/06/18 15:32:06] [SSH] The remote user's environment is:
      
      [04/06/18 15:32:06] [SSH] Checking java version of java
      
      [04/06/18 15:32:06] [SSH] java -version returned 1.8.0_161.
      
      [04/06/18 15:32:06] [SSH] Starting sftp client.
      
      [04/06/18 15:32:06] [SSH] Copying latest slave.jar...
      
      [04/06/18 15:32:06] [SSH] Copied 762,466 bytes.
      
      Expanded the channel window size to 4MB
      
      [04/06/18 15:32:06] [SSH] Starting slave process: cd "D:\CI\jenkins" && java  -jar slave.jar
      
      <===[JENKINS REMOTING CAPACITY]===>Slave JVM has terminated. Exit code=0
      
      [04/06/18 15:32:06] Launch failed - cleaning up connection
      
      [04/06/18 15:32:06] [SSH] Connection closed.
      

      I use Manually trusted key Verification Strategy

      Require manual verification of initinial connection is OFF

      On windows, I use cygwin as bash, and openSSH from microsoft.

      Java version master:

      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
      

      Java version slave:

      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
      Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode, sharing)
      

      The jenkins version is: Jenkins ver. 2.107.2

      Attachments

        Issue Links

          Activity

            Could you try the other one? because seems like the slave.jar process die

            || echo "KO - retcode $?"
            ifernandezcalvo Ivan Fernandez Calvo added a comment - Could you try the other one? because seems like the slave.jar process die || echo "KO - retcode $?"
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited

            I think that I know what happens, clean up the suffix and prefix field and put exactly this one in the prefix field

            /bin/bash -c "cd "/cygdrive/d/CI/jenkins-ssh" && java -Djava.util.logging.config.file=/cygdrive/d/CI/jenkins-ssh/logging.properties -jar slave.jar";
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited I think that I know what happens, clean up the suffix and prefix field and put exactly this one in the prefix field /bin/bash -c "cd " /cygdrive/d/CI/jenkins-ssh " && java -Djava.util.logging.config.file=/cygdrive/d/CI/jenkins-ssh/logging.properties -jar slave.jar" ;
            zack Zack Snyder added a comment -

            Here is the output:
            prefix_output.txt

            I just inserted text into the prefix field.

            zack Zack Snyder added a comment - Here is the output: prefix_output.txt I just inserted text into the prefix field.
            zack Zack Snyder added a comment -

            ifernandezcalvo
            Any update? Or are you now at the end of you knowledge? A tricky problem.

            zack Zack Snyder added a comment - ifernandezcalvo Any update? Or are you now at the end of you knowledge? A tricky problem.
             /bin/bash -c "cd "/cygdrive/d/CI/jenkins-ssh" && java -Djava.util.logging.config.file=/cygdrive/d/CI/jenkins-ssh/logging.properties -jar slave.jar"

            The command line is not correct but does not matter because "/bin/bash -c" does not return any error, it should return at least a syntax error, I do not know what happen on your environment but it is not related with the SSH Slave Plugins it is something in your sshd configuration, on your user login, on your environment initialization files (.bashrc, .profile, ...), or your default shell, I bet that if you put

            /bin/bash -c ls &&

            on your command prefix you would see nothing in the console output.
            You could try to execute a command using the ssh command line, probably it fails

            ssh USERNAME@AGENT_HOST /bin/bash -c ls

            try the same but with -t parameter, it should work

            ssh -t USERNAME@AGENT_HOST /bin/bash -c ls

            I recommend you to check a really good comment from Ben Langton at https://wiki.jenkins.io/display/JENKINS/SSH+slaves+and+Cygwin that explains all the steps that you have to make to configure OpenSSH.

            If you need more help, try in the jenkins user group.

            ifernandezcalvo Ivan Fernandez Calvo added a comment - /bin/bash -c "cd " /cygdrive/d/CI/jenkins-ssh " && java -Djava.util.logging.config.file=/cygdrive/d/CI/jenkins-ssh/logging.properties -jar slave.jar" The command line is not correct but does not matter because "/bin/bash -c" does not return any error, it should return at least a syntax error, I do not know what happen on your environment but it is not related with the SSH Slave Plugins it is something in your sshd configuration, on your user login, on your environment initialization files (.bashrc, .profile, ...), or your default shell, I bet that if you put /bin/bash -c ls && on your command prefix you would see nothing in the console output. You could try to execute a command using the ssh command line, probably it fails ssh USERNAME@AGENT_HOST /bin/bash -c ls try the same but with -t parameter, it should work ssh -t USERNAME@AGENT_HOST /bin/bash -c ls I recommend you to check a really good comment from Ben Langton at https://wiki.jenkins.io/display/JENKINS/SSH+slaves+and+Cygwin that explains all the steps that you have to make to configure OpenSSH. If you need more help, try in the jenkins user group .

            People

              ifernandezcalvo Ivan Fernandez Calvo
              zack Zack Snyder
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: