Error auto-installing maven tool

We recently changed jenkins agent nodes for more updated ones (updated OS and libraries) and we have found that now we cannot automatically install maven tools. We have another environment with the old nodes and the same jenkins version and it works here.

It doesn’t seem to be a connectivity issue since if we try to download maven, unpack it and move to the target path using sh commands inside a pipeline it works, but when we try to use it as a Tool and select “install automatically from apache” it show the following error:

Unpacking https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip to /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven-3.9.4 on slave-test-02
ERROR: Failed to download https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip from agent; will retry from controller
java.io.IOException: No such file or directory
	at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.base/java.io.File.createTempFile(File.java:2129)
	at java.base/java.io.File.createTempFile(File.java:2175)
	at hudson.FilePath.unzip(FilePath.java:701)
	at hudson.FilePath$Unpack.invoke(FilePath.java:1084)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to slave-test-02
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
		at hudson.remoting.Channel.call(Channel.java:1003)
		at hudson.FilePath.act(FilePath.java:1192)
		at hudson.FilePath.act(FilePath.java:1181)
		at hudson.FilePath.installIfNecessaryFrom(FilePath.java:1044)
		at hudson.FilePath.installIfNecessaryFrom(FilePath.java:980)
		at hudson.tools.ZipExtractionInstaller.performInstallation(ZipExtractionInstaller.java:86)
		at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:70)
		at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
		at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:221)
		at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:683)
		at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:496)
		at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:157)
		at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:138)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
Caused: java.io.IOException: Failed to unpack https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip (0 bytes read)
	at hudson.FilePath$Unpack.invoke(FilePath.java:1089)
	at hudson.FilePath$Unpack.invoke(FilePath.java:1072)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:377)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	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)

We don’t know what else we can check to solve this.

These are your key lines in the output. It looks like this web site isn’t accessible from your agent. Can you test that by logging into the agent directly?

Perhaps check if your old nodes had an outbound proxy available to the agent account not configured on the new ones? Remember that an agent uses a non-interactive shell so environment variables may not be set or set properly.

ps: latest maven is now 3.9.6

I found the solution!, problem was that we had configured jenkins process startup with a java parameter where we indicated a route that no longer exists in the new agent, we realized that when doing a “ps -a” and check that our jenkins process was with this parameter “-Dtmp. out.dir=…”

Logs are not really usseful in these case…

Now we are facing another issue with config file parameter… where jenkins cannot copy the maven settings.xml (defined in managed file) to the agent workspace… Again logs doesn’t show anything, pipeline just get stucked copying until timeout… I have to investigate this.

Thanks.