jenkins can’t connect to slaves after update to 2.55 or higher

Jenkins is a continuous integration tool, which is written in Java and provides very useful toolchain for DevOps software cycle.
After update to version 2.55 my master server was unable to connect to it’s own slaves. I began receiving messages like this after an update whilst trying to connect to slave:

ERROR: Connection terminated Unexpected termination of the channel
	at hudson.remoting.SynchronousCommandTransport$
Caused by:
	at hudson.remoting.ObjectInputStreamEx.(
	at hudson.remoting.SynchronousCommandTransport$
ERROR: Socket connection to SSH server was lost

This stacktrace refers to remoting issue, which is wrong, because according to changelog, from this version it requires java 8. Although it isn’t said in clear, this requirement is mandatory only for slave jar files, server installation works well on Java 7 and even Java 6 (I checked both). And if we try to connect to our obsolete slave with the new slave.jar, connection will fail with this stack trace even if the required Java is installed on slave machine.

Therefore we have two ways now: we can update and/or make the Java 8 default on slave machines or downgrade Jenkins or somehow use the obsolete slave.jar. Second option is way more complicated and should be used only in case you cannot use modern java on your host.
I’ll skip java installation as perfectly described process in many HOWTO’s.
So, we have two installed JDKs:

# update-java-alternatives --list
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64

Now, we need to change default option to desired one:

# update-java-alternatives --set java-1.8.0-openjdk-amd64                                                                                                                                                                         
update-alternatives: error: no alternatives for                                                                                                                                                                        
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/

Since we rarely use Firefox on deployment servers, this message can be dismissed. Now our Jenkins slave must operate as usual.

Leave a Reply

Your email address will not be published. Required fields are marked *