java.io.IOException: Could not copy remoting.jar into '/var/lib/jenkins' on agent

3,475 views
Skip to first unread message

Michael Renner

unread,
Jan 27, 2022, 3:08:10 PM1/27/22
to jenkins...@googlegroups.com
Moin,

a strange problem. For some time now, the remoting.jar can no longer be copied
to the nodes. The error occurs after every Jenkins update (so very often):

[01/27/22 20:35:23] [SSH] Checking java version of java
[01/27/22 20:35:23] [SSH] java -version returned 1.8.0_161.
[01/27/22 20:35:23] [SSH] Starting sftp client.
[01/27/22 20:35:23] [SSH] Copying latest remoting.jar...

java.io.IOException: Could not copy remoting.jar into '/var/lib/jenkins' on
agent
at
hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:739)
at
hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:112)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:
457)
at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:
422)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:
264)
at java.base/
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1128)
at java.base/
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: invalid len argument
at com.trilead.ssh2.SFTPv3Client.read(SFTPv3Client.java:1232)
at
com.trilead.ssh2.jenkins.SFTPClient$SFTPInputStream.read(SFTPClient.java:172)
at
com.google.common.io.ByteStreams.toByteArrayInternal(ByteStreams.java:184)
at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:
224)
at
hudson.plugins.sshslaves.SSHLauncher.readInputStreamIntoByteArrayAndClose(SSHLauncher.java:
797)
at
hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:708)
... 7 more
[01/27/22 20:35:24] Launch failed - cleaning up connection


The file permissions on the nodes are okay and haven't changed since it worked
fine for many years:

renner@boulder:~$ ls -l /var/lib/jenkins/
total 1500
-rw------- 1 jenkins jenkins 144 Aug 6 11:36 dead.letter
drwxr-xr-x 4 jenkins jenkins 4096 Apr 28 2020 remoting
-rw-r--r-- 1 jenkins jenkins 1522173 Jan 21 13:51 remoting.jar
drwxr-xr-x 6 jenkins jenkins 4096 Dec 30 06:17 workspace

What it solves: delete the remoting.jar by hand and relaunch the process on
the node. Then the file can be copied. But not overwritten:

[01/27/22 20:43:33] [SSH] Checking java version of java
[01/27/22 20:43:34] [SSH] java -version returned 1.8.0_161.
[01/27/22 20:43:34] [SSH] Starting sftp client.
[01/27/22 20:43:34] [SSH] Copying latest remoting.jar...
[01/27/22 20:43:35] [SSH] Copied 1,522,173 bytes.


Any hints?
--
|Michael Renner E-mail: michael...@gmx.de |
|81541 Munich Twitter: @dd0ul |
|Germany Don't drink as root! ESC:wq



Senthil Nathan

unread,
Jan 27, 2022, 9:41:52 PM1/27/22
to jenkins...@googlegroups.com
Why is it copying into /var/lib/Jenkins. Is that your agent workspace root. /Var/libs/Jenkins looks like a restricted space.  you can try users home directory as agent root to be sure you have access 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2094600.irdbgypaU6%40solaris.

Michael Renner

unread,
Jan 29, 2022, 10:45:46 AM1/29/22
to jenkins...@googlegroups.com
On Freitag, 28. Januar 2022 03:41:26 CET Senthil Nathan wrote:

Moin,


> Why is it copying into /var/lib/Jenkins. Is that your agent workspace root.

yes, jenkins home is /var/lib/jenkins, so I choose use the same directory and
UID for the executor on remote hosts.


> /Var/libs/Jenkins looks like a restricted space. you can try users home
> directory as agent root to be sure you have access

I created a fresh new jenkins account. A normal user account with normal UID
and GID in /home (but copied the .ssh/authorized_keys and reconfigured the
executor for the new home directory) . But the result is the same. The first
launch works fine (login, copy remoting.jar), but after disableling and
restarting the node agent I get the same error:

Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
[01/29/22 14:40:57] [SSH] Checking java version of /home/jenkins/jdk/bin/java
Couldn't figure out the Java version of /home/jenkins/jdk/bin/java
bash: line 1: /home/jenkins/jdk/bin/java: No such file or directory

[01/29/22 14:40:57] [SSH] Checking java version of java
[01/29/22 14:40:57] [SSH] java -version returned 1.8.0_161.
[01/29/22 14:40:57] [SSH] Starting sftp client.
[01/29/22 14:40:57] [SSH] Copying latest remoting.jar...
java.io.IOException: Could not copy remoting.jar into '/home/jenkins' on agent

I even created a symlink from /usr/bin/java to /home/jenkins/jdk/bin/java.
Same result.

I'm running out of options.

Mark Waite

unread,
Jan 29, 2022, 2:22:10 PM1/29/22
to Jenkins Users
On Saturday, January 29, 2022 at 8:45:46 AM UTC-7 michael wrote:

I'm running out of options.


The Java version you're running is quite old.  You might try an experiment with a recent Java version (like 11.0.14 or 8u322) in case there is something in that old Java version that prevents it.

Since the Java version is outdated, it may be that the operating system where you're running it is also using an outdated set of CA certificates.  You might try updating the CA  certificates and the other operating system packages on the machine.

Slide

unread,
Jan 29, 2022, 6:53:00 PM1/29/22
to Jenkins User Mailing List
Is there more to the stack trace? Can the Jenkins user write to /var/lib/jenkins? 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages