Can't get go-agent to register with go-server on localhost

2,187 views
Skip to first unread message

Hugh Acland

unread,
Jul 11, 2016, 11:38:42 AM7/11/16
to go-cd

Hi


I am trying to get go-agent to connect to server on localhost. 


I keep getting this error:


ERROR com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - Couldn't update admin/agent-launcher.jar. Sleeping for 1m. Error: java.lang.Exception: Couldn't access Go Server with base url: http://localhost:8153/go/admin/agent-launcher.jar: java.net.ConnectException: Connection refused
 

I have this in my /etc/default/go-agent:
 
GO_SERVER=127.0.0.1
export GO_SERVER
GO_SERVER_PORT=8153
export GO_SERVER_PORT
AGENT_WORK_DIR=/var/lib/${SERVICE_NAME:-go-agent}
export AGENT_WORK_DIR
DAEMON=Y
VNC=N
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/jre" # SET_BY_GO_INSTALLER__DONT_REMOVE


What am I doing wrong here? I have had this working on other machines before.

thanks

Aravind SV

unread,
Jul 11, 2016, 11:48:16 AM7/11/16
to go...@googlegroups.com
Hello Hugh,

Your messages were caught in the spam filter. I marked them as not spam. That's why the duplicates. Which version of the GoCD server is this on? I'd go to the agent node and try to do a: curl -O http://localhost:8153/go/admin/agent-launcher.jar or a wget http://localhost:8153/go/admin/agent-launcher.jar

Cheers,
Aravind

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hugh Acland

unread,
Jul 11, 2016, 11:55:49 AM7/11/16
to go-cd
Hi Aravind

Thanks, I have managed to do 'curl -O http://localhost:8153/go/admin/agent-launcher.jar' successfully. The version of go-server is:

Go Version: 16.6.0 (3590-af0f8b8ae8a4342ab748ce80224971887f018ccc)


and the go-agent is 16.6.0 3590


(I just downloaded the DEBs from the website)


I really don't see why it is not working on this box. I have just managed to get it working on another VM.


Thanks

Hugh Acland

unread,
Jul 11, 2016, 12:03:23 PM7/11/16
to go-cd
If it helps, these are the processes running on the same box:

go       15750  0.1  1.5 2570568 61316 ?       Sl   15:35   0:01 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar /usr/share/go-agent/agent-bootstrapper.jar 127.0.0.1 8153


go       15767  0.6  6.4 1949232 260744 ?      Sl   15:35   0:10 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Dcruise.console.publish.interval=10 -Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom -Dagent.launcher.version=Unknown -Dagent.plugins.md5=d1a8e4434cbf9868d96efe98147f1c47 -Dagent.binary.md5=M7VLVRjsxWOPUY6+DhkuBw== -Dagent.launcher.md5=dXwGRFnX3o1pgkQggCM/dA== -jar agent.jar https://127.0.0.1:8154/go/


go       16196  1.2 18.5 3775084 751040 ?      Sl   10:56   3:49 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -server -Djava.security.egd=file:/dev/./urandom -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Duser.language=en -Djruby.rack.request.size.threshold.bytes=30000000 -Duser.country=US -Dcruise.config.dir=/etc/go -Dcruise.config.file=/etc/go/cruise-config.xml -Dcruise.server.port=8153 -Dcruise.server.ssl.port=8154 -jar /usr/share/go-server/go.jar

Hugh Acland

unread,
Jul 11, 2016, 12:08:36 PM7/11/16
to go-cd
Is it possible that the agent is caching the start up settings somewhere?

I see from the process that it is: -jar agent.jar https://127.0.0.1:8154/go/

But the /etc/default/go-agent definitely has it as port 8153

thanks

Ketan Padegaonkar

unread,
Jul 11, 2016, 12:15:02 PM7/11/16
to go...@googlegroups.com
On Mon, Jul 11, 2016 at 9:33 PM Hugh Acland <hu...@zuriar.com> wrote:

go       15767  0.6  6.4 1949232 260744 ?      Sl   15:35   0:10 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Dcruise.console.publish.interval=10 -Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom -Dagent.launcher.version=Unknown -Dagent.plugins.md5=d1a8e4434cbf9868d96efe98147f1c47 -Dagent.binary.md5=M7VLVRjsxWOPUY6+DhkuBw== -Dagent.launcher.md5=dXwGRFnX3o1pgkQggCM/dA== -jar agent.jar https://127.0.0.1:8154/go/


This indicates that the agent process is now running, and is connected to the server. The initial error you mention "Couldn't update admin/agent-launcher.jar. Sleeping for 1m" generally happens when the server is booting or is temporarily unavailable. The agent process should eventually connect after a few minutes.

Is it possible that the agent is caching the start up settings somewhere?


No, you normally start the bootstrapper with port 8153, and it'll autodetect the ssl port.

Hugh Acland

unread,
Jul 11, 2016, 12:22:07 PM7/11/16
to go-cd
Thanks, but I have been waiting for it to show up in the server for literally hours!! Something is still not quite right

Hugh Acland

unread,
Jul 11, 2016, 12:34:46 PM7/11/16
to go-cd
OK! I now know what the problem is. I had followed the instructions here: https://docs.go.cd/current/installation/ssl_tls/custom_certificate.html
to run the go-server using a Signed certificate from a proper Authority. 

When I revert back to using the self-signed certificate (by removing the keystore file in /etc/go) then restart the server lo and behold the agent now shows up.

Is this a bug? 

thanks

Ketan Padegaonkar

unread,
Jul 11, 2016, 12:41:33 PM7/11/16
to go...@googlegroups.com
That explains the behavior that we're seeing here. The agent remembers the ssl certificate from the first handshake, and refuses to connect if the certificate changes (unless reconfigured otherwise)

So if you'd like to use your custom SSL certs on the server, you may want to stop the agent and blow away the agent truststore file, it's stored somewhere under /var/lib/go-agent/config.



--

Hugh Acland

unread,
Jul 11, 2016, 12:57:54 PM7/11/16
to go-cd
I have stopped agent, and looked in /var/lib/go-agent/config. There is an agent.jks which I deleted. Then it starts up again but it just writes another agent.jks and still won't register.

The comment at the end of https://www.go.cd/2014/06/05/using-go-cd-with-custom-certificates.html seems to suggest I need to create a trust file???

Barrow Kwan

unread,
Jul 11, 2016, 1:03:04 PM7/11/16
to go...@googlegroups.com, Hugh Acland
Did you see a file called guid.txt?  delete it and try again.

-- 
Barrow Kwan
Sent with Airmail

Hugh Acland

unread,
Jul 11, 2016, 1:13:55 PM7/11/16
to go-cd, hu...@zuriar.com
yup. I've deleted that file and restarted everything. Still no agent. Do I need to explicitly create a trust for the SSL certificate and give it to the agent?

m.kala...@gmail.com

unread,
Oct 5, 2017, 5:58:17 PM10/5/17
to go-cd
Hi Hugh,

I just started with gocd and I am trying to connect agent to server.  I am running into the same issue you ran into (log pasted below).
I am using ec2 instances for both server and agent.  I tried start agent on the same host as the server first, which was failing with the same error.
So, I tried starting agent on different ec2, still getting the same error.

I also tried the suggestion of removing keystore and restarting the server.
I didnot find guid.txt or agent.jks in /var/lib/go-agent folder or its subfolder.

Since this thread is an year old, so I thought of checking if you were able to find any resolution.

2017-10-05 21:52:31,885 ERROR [main] ServerBinaryDownloader:80 - Couldn't update admin/agent-launcher.jar. Sleeping for 1m. Error:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
        at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
        at sun.security.ssl.InputRecord.read(InputRecord.java:527)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
        at com.thoughtworks.go.agent.launcher.ServerBinaryDownloader.fetchUpdateCheckHeaders(ServerBinaryDownloader.java:96)
        at com.thoughtworks.go.agent.launcher.ServerBinaryDownloader.downloadIfNecessary(ServerBinaryDownloader.java:72)
        at com.thoughtworks.go.agent.launcher.AgentLauncherImpl.launch(AgentLauncherImpl.java:79)
        at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.go(AgentBootstrapper.java:84)
        at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.main(AgentBootstrapper.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.thoughtworks.gocd.Boot.run(Boot.java:58)
        at com.thoughtworks.gocd.Boot.main(Boot.java:42)

Thank You,
Ranjith

Bryan MARTIN

unread,
Mar 19, 2020, 5:24:33 AM3/19/20
to go-cd
Hi,

Any news on this subject? i get same error.
Reply all
Reply to author
Forward
0 new messages