Debugging disconnected build agents

I installed a build agent on a different box than my teamcity server (where a build agent runs fine). The new build agent is in a disconnected state and I'm trying to figure out how to make it connect.  My conjecture is that the new build agent is trying to apply upgrades and is failing.  I see several stack-traces in the upgrade.log like this, it's not clear to me what it's getting denied access to:

[2009-03-04 11:35:08,972]   INFO - - C:\BuildAgent\bin>..\launcher\bin\TeamCityAgentService-windows-x86-32.exe -t ../conf/wrapper.conf 
[2009-03-04 11:35:08,988]   INFO - - wrapper  | OpenSCManager failed - Access is denied. (0x5)
[2009-03-04 11:35:08,988]  ERROR - r.agent.upgrade.UpgradeRunBase - Failed to start process. Return code was 1 not equal to zero. Failed to start process. Return code was 1 not equal to zero.
    at jetbrains.buildServer.agent.upgrade.UpgradeRunBase.runCmdLine(
    at jetbrains.buildServer.agent.upgrade.NTServiceUpgrade.exec(
    at jetbrains.buildServer.agent.upgrade.NTServiceUpgrade.startAgain(
    at jetbrains.buildServer.agent.upgrade.UpgradeMode$
    at jetbrains.buildServer.agent.upgrade.Upgrade2.main2(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at jetbrains.buildServer.agent.ClazzLoader.callMain2(
    at jetbrains.buildServer.agent.upgrade.Upgrade.main(

And the following in the teamcity-agent.log suggests that the upgrade failure is causing the agent to shutdown:

[2009-03-04 11:28:40,366]   INFO - rocesses.ProcessTreeTerminator - No processes to kill
[2009-03-04 11:28:40,366]   INFO -    jetbrains.buildServer.AGENT - Exit for upgrade
[2009-03-04 11:28:40,366]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent start
[2009-03-04 11:28:40,366]   INFO -    jetbrains.buildServer.AGENT - Unregistering from build server: 2
[2009-03-04 11:28:40,381]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent WebServer start
[2009-03-04 11:28:40,381]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent WebServer finish
[2009-03-04 11:28:40,381]   INFO -    jetbrains.buildServer.AGENT - Shutdown agent finish

I've also verified that there's no firewall blocking the port on the build-agent side (port 9090).  I don't know how the build-agent communicates with the server though, so I don't know what port to verify for that line of communication.  Can someone help me to track down the ports I can verify for that?  I don't think that's the problem but I want to be sure.



Comment actions Permalink

[2009-03-04 11:35:08,988]   INFO - - wrapper  | OpenSCManager failed - Access is denied. (0x5)

It seems the user account under which the build agent service is running does not have enough permissions to update itself via the windows services API. Try to use different user account which has more permissions.

Comment actions Permalink

Thanks, Pavel.  Yes, I stopped the service, made the user and administrator and restarted the service.  Eventually, it succeeded in upgrading itself and connected.

Ideally, though, I'd like a better idea what privileges it lacked so that it doesn't have to run with admin privileges.


Please sign in to leave a comment.