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

SSH agent not starting because of wrong cd command

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 2.289.3
      SSH Agent Plugin 1.23

      When Jenkins tries to open connection to the SSH agent it uses the command "cd "D:\Jenkins" && java -jar remoting.jar -workDir D:\Jenkins -jar-cache D:\Jenkins/remoting/jarCache"

      If the working folder is not in C drive, the cd command will not work, as it needs to be:

      d:

      cd "D:\Jenkins"

       

      instead of just cd "D:\Jenkins"

       

      [08/09/21 10:22:24] [SSH] Checking java version of java
      [08/09/21 10:22:24] [SSH] java -version returned 1.8.0_301.
      [08/09/21 10:22:24] [SSH] Starting sftp client.
      [08/09/21 10:22:24] [SSH] Copying latest remoting.jar...
      Source agent hash is *************. Installed agent hash is *************
      Verified agent jar. No update is necessary.
      Expanded the channel window size to 4MB
      [08/09/21 10:22:24] [SSH] Starting agent process: cd "D:\Jenkins" && java -jar remoting.jar -workDir D:\Jenkins -jar-cache D:\Jenkins/remoting/jarCache
      Error: Unable to access jarfile remoting.jar
      Agent JVM has terminated. Exit code=1
      [08/09/21 10:22:24] Launch failed - cleaning up connection
      [08/09/21 10:22:24] [SSH] Connection closed.

          [JENKINS-66334] SSH agent not starting because of wrong cd command

          I had the same issue when setting up an agent for a Windows machine that shall not be located o the C-drive.

          The way how I get it working was the use the "Prefix Start Agent Command" to add the change of the drive before the start command. Adding "D: && " should work when you want to run the agent on the D-drive.

          Roland Gärtner added a comment - I had the same issue when setting up an agent for a Windows machine that shall not be located o the C-drive. The way how I get it working was the use the "Prefix Start Agent Command" to add the change of the drive before the start command. Adding "D: && " should work when you want to run the agent on the D-drive.

          ioana added a comment -

          pegasus77 Thanks man, that works indeed, I didn't think to click the advanced button and didn't know there was a way to add to that cmd line. 

           

          Also what I did that worked was to copy just the remoting.jar file in C:\Users*user*

          ioana added a comment - pegasus77  Thanks man, that works indeed, I didn't think to click the advanced button and didn't know there was a way to add to that cmd line.    Also what I did that worked was to copy just the remoting.jar file in C:\Users*user*

            Unassigned Unassigned
            ioana ioana
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: