Jenkins Windows 10 agent won't start, says 'Terminated'

I am trying to launch a Windows 10 Jenkins agent by pressing the Launch button at the node page:


When I do that, my browser asks me to download the jenkins-agent.jnlp file, which I save in my Downloads folder. I then start the agent by running a Windows cmd window as Administrator, going into the directory where I saved the jenkins-agend.jnlp file, and typing

jenkins-agent.jnlp

I then see the Jenkins agent window coming up, but after a few seconds it says “Terminated”.
I have no idea in what logs to look to know why it is failing. However, if I also download the agent.jar file and start the agent from the command line using the command

C:\Users\barvan34887.TREALITYSVS\Downloads>java -jar agent.jar -jnlpUrl http://jenkins.trealitysvs.net/computer/s%2Debl%2Djnks06%2D19/jenkins-agent.jnlp -secret 6897b4c167a2895b47fc83cacfa5edce7b4512846f802a6ae87dded9d65630cf
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: s-ebl-jnks06-19
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Mar 10, 2022 4:15:07 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.11
Mar 10, 2022 4:15:07 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\barvan34887.TREALITYSVS\.jenkins\cache\jars
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://jenkins.trealitysvs.net/]
Mar 10, 2022 4:15:07 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: jenkins.trealitysvs.net
  Agent port:    32775
  Identity:      b5:68:27:19:d1:73:7c:53:e1:f1:a3:a5:51:f0:d3:70
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins.trealitysvs.net:32775
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Mar 10, 2022 4:15:07 PM org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
INFO: Waiting for ProtocolStack to start.
Mar 10, 2022 4:15:07 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: b5:68:27:19:d1:73:7c:53:e1:f1:a3:a5:51:f0:d3:70
Mar 10, 2022 4:15:08 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected

Since I want to install this as a Windows service so that the agent starts automatically, I would like to get the first method working, so that I can select “Install as Service” from the menu.

What am I doing wrong? Or where to look for logfiles that could give an indication on what’s wrong?
My Jenkins version is 2.318 and java version is

C:\WINDOWS\system32>java -version
java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) Client VM (build 25.321-b07, mixed mode)

In the meanwhile, I have found how to enable the Java console, and it shows me the following error:

Mar 10, 2022 4:32:24 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: s-ebl-jnks06-19
Mar 10, 2022 4:32:24 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.11
Mar 10, 2022 4:32:24 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\barvan34887.TREALITYSVS\.jenkins\cache\jars
Mar 10, 2022 4:32:24 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Mar 10, 2022 4:32:24 PM org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
INFO: Waiting for ProtocolStack to start.
Mar 10, 2022 4:32:26 PM hudson.remoting.UserRequest perform
WARNING: LinkageError while performing UserRequest:hudson.slaves.SlaveComputer$SlaveInitializer@43b015f3
java.lang.ExceptionInInitializerError
	at hudson.slaves.SlaveComputer$SlaveInitializer.call(SlaveComputer.java:1050)
	at hudson.slaves.SlaveComputer$SlaveInitializer.call(SlaveComputer.java:1041)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "hudson.util.RingBufferLogHandler.defaultSize" "read")
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
	at java.lang.System.getProperty(Unknown Source)
	at java.lang.Integer.getInteger(Unknown Source)
	at java.lang.Integer.getInteger(Unknown Source)
	at hudson.util.RingBufferLogHandler.<clinit>(RingBufferLogHandler.java:39)
	... 11 more

Several alternatives are offered in

https://issues.jenkins.io/browse/JENKINS-67000

Alternatives include:

  • Install Jenkins 2.332.1 that includes the fix
  • Use a batch file or powershell script to start the agent instead of starting from the jnlp file. Define a service that runs the batch file
  • Switch to use the Microsoft OpenSSH service on the Windows computer to run the agent

Thanks. I was indeed suffering the JENKINS-67000 issue, and upgrading to some version higher than 2.332.1 fixed the problem.