Jenkins 2.263.2 Cannot SSH to server from slave node - jenkins

I just upgraded Jenkins from 2.249.2 to 2.263.2. When I tried to build in slave node, I could not SSH to server by SSH Publishers.
Running as SYSTEM
[Office365connector] No webhooks to notify
[EnvInject] - Loading node environment variables.
Building remotely on native-slave in workspace /home/jenkins/jenkins_workspace/workspace/test1
SSH: Connecting from host [native-slave]
SSH: Connecting with configuration [dev] ...
SSH: Disconnecting configuration [dev] ...
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,000 ms]
Another issue is that I could not download artifact from Jenkins slave workspace, the Jenkins webpage just loading
It just happen after I upgraded to new version.
Is there something wrong or what might causing the issue?

Related

Jenkins add new node via ssh

I am successfully able to connect to the agent client server via ssh agent. The issue I am having is after deleting the agent and adding it again as a new agent.
What all so far I have tried on client- 1) restarted sshd 2) removed content from remote dir 3) Changed remote dir
I can see, it is always able to copy the remote.jar but somehow agent is not connecting after 1st time deletion of agent.
INFO: Both error and output logs will be printed to /home/a214p/remoting
<===[JENKINS REMOTING CAPACITY]===>channel started
Remoting version: 4.3
This is a Unix agent
ERROR: null
java.util.concurrent.CancellationException
at java.util.concurrent.FutureTask.report(FutureTask.java:121)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:475)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:296)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[07/20/20 14:28:21] Launch failed - cleaning up connection
[07/20/20 14:28:21] [SSH] Connection closed.
ERROR: Connection terminated
Any help or suggestion?
Have you tried the method described here to add a Jenkins slave via SSH?
Additionally try following order:
remove slave agent from master
kill all Jenkins/java processes running in slave server
gracefully restart jenkins master
re-add slave agent in master

Jenkins add new node

I am trying to set up Jenkins to make a production deployment. The aim is to allow Jenkins execute git clone, build and deployment etc. on production server.
Jenkins is running on Configuration Management Server (CentOs 7) and Production Server is another Server (Centos 7).
I started by creating a new node in Jenkins with configuration below:
Then I added Production Server IP address to Jenkins known host like below
-bash-4.2$ cat /var/lib/jenkins/.ssh/known_hosts
192.168.1.xx ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYblabla=
And I confirmed that on Configuration Management server under Jenkins account I could ssh to Production Server.
But on Jenkins the node status is always like this:
This agent is offline because Jenkins failed to launch the agent process on it.
Node log was like this:
SSHLauncher{host='192.168.1.xx', port=22, credentialsId='service account at w', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[02/12/20 20:57:51] [SSH] Opening SSH connection to 192.168.1.xx:22.
[02/12/20 20:57:51] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for service_account (credentialId:service_account at webi/method:publickey)
[02/12/20 20:57:51] [SSH] Authentication failed.
Authentication failed.
[02/12/20 20:57:51] Launch failed - cleaning up connection
[02/12/20 20:57:51] [SSH] Connection closed.
Could anybody help with following questions:
Do I need to install Jenkins on Production Server as well?
How to configure Jenkins to run pipeline on
new node?
Okay I finally figured out:
There is no need to install Jenkins on Production Server;
The reason for SSH connection failure was wrong credentials for Jenkins set up. Essentially Jenkins will execute an SSH connection thus username/password should be used for this. so what I did was to create a new Credential and Jenkins will copy over a JAR file to /var/jenkins directory.
You would also need to change ownership of /var/jenkins directory!

Jenkins unable to launch slave agent via SSH - disconnected overnight

I have a set of Jenkins slaves that were connected via SSH. They have all been working fine for several months. This morning, I found that all slaves were disconnected, and all had the same error when I tried to launch the agent:
01/05/18 16:27:13] [SSH] Starting slave process: cd "/home/ubuntu/jenkins_slave" && java -jar slave.jar
<===[JENKINS REMOTING CAPACITY]===>channel started
Slave JVM has not reported exit code. Is it still running?
[01/05/18 16:27:20] Launch failed - cleaning up connection
[01/05/18 16:27:20] [SSH] Connection closed.
ERROR: Connection terminated
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2638)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3113)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:853)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:349)
at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:48)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:59)
Caused: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:73)
One common issue I found was a mismatch between Jenkins and Java versions, but I believe mine are compatible (Jenkins server says 2.46.3 and the slaves all have Java 1.7).
Regarding "Is it still running?", I don't see a Jenkins slave process running:
ps aux | grep java
returns nothing.
I have been unable to locate any Jenkins logs on the slave side. All the logs I've found on the master side only reiterate the error pasted above.

Jenkins master fails to connect to the slave over SSH

Jenkins master is running on Amazon instance and slave machine set up on dedicated Soyoustart machine. Worked fine until it was needed to redo the slave setup: reinstalled the OS, installed Java, added masters key to slave authorized_keys and removed/added again the slave in masters known_hosts. Set up new credentials for the slave and configured the node in Jenkins master but it is unable to connect to the slave.
The setup is the the same that is and has been working with other slaves without hiccups. The only thing different is that this time the new slave is the same machine with the IP as the old one was.
It is possible to ssh into the slave from master from CLI(replaced filename and slave IP with placeholder for this post):
$ ssh -i <key-file> jenkins#<slave-ip>
Credentials have been set up :
Node is configured:
Output when connecting to the slave:
[05/17/15 07:30:31] [SSH] Opening SSH connection to <slave-ip>.
Key exchange was not finished, connection is closed.
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins.
java.lang.IllegalStateException: Connection is not established!
at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:1030)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:207)
at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:169)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1173)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:701)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[05/17/15 07:30:31] Launch failed - cleaning up connection
[05/17/15 07:30:31] [SSH] Connection closed.
Version numbers:
Jenkins 1.613
SSH Credentials Plugin 1.11
SSH Slaves plugin 1.9
For those who prefer to dig into code:
SSH Credentials Plugin
SSH Slave Plugin
Trilead SSH
Am I missing something obvious here? What could be causing this? Any known workaround? Or does it look like a bug that needs to be reported?
Please let me know if more information is needed.
I'm running Jenkins master using official Docker image which uses OpenJDK8 and should not need to install JCE.
Apparently this is an unresolved issue in Jenkins/SSH security.
My current workaround is by commenting out MACs and KexAlgorithm line in /etc/ssh/sshd_config of Jenkins Slave and restarting the sshd (service ssh restart on Ubuntu)
UPDATE: the issue has been resolved as of 2017-04-29
I suspect that you need to install the Java Cryptography Extension for your JVM.
Without that the RSA key size is limited and authentication is not being established.
See https://issues.jenkins-ci.org/browse/JENKINS-26495 for more details.

Handshaking of Master Slave In Jenkins shows Connecting but doesn't get Connected

I am trying to establish master slave connection between two system.So I have configured a node Myslave as given in Jenkins Master Slave Documentation(https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines)
But when I try to connect to the master on the slave system the Jenkins Slave Agent shows Connecting to master(i.e my system ip address) but doesn't connect.
There is no error.I am not able to determine the problem.

Resources