TeamCity Build Agent won't upgrade

Shane Courtrille picture Shane Courtrille · Sep 18, 2012 · Viewed 10k times · Source

We are trying to setup a build agent and every time we start it the log shows the following messages:

[2012-09-18 12:52:01,805]   INFO -    jetbrains.buildServer.AGENT - Starting agent shutdown sequence, reason: Restart agent, failed to download upgrade from server 
[2012-09-18 12:52:01,821]   INFO -    jetbrains.buildServer.AGENT - Host configuration for downloading updates: HostConfiguration[host=http://localhost:8000] 
[2012-09-18 12:52:01,821]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/teamcity-agent.xml ==> E:\buildAgent\temp\m8a1mAwTuLIngev3yRUMPUuaYWZFmMSh 
[2012-09-18 12:52:01,849]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/agentSystemInfo.zip ==> E:\buildAgent\update\plugins\agentSystemInfo.zip 
[2012-09-18 12:52:01,880]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/amazonEC2.zip ==> E:\buildAgent\update\plugins\amazonEC2.zip 
[2012-09-18 12:52:01,921]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/ant.zip ==> E:\buildAgent\update\plugins\ant.zip 
[2012-09-18 12:52:02,056]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/antPlugin.zip ==> E:\buildAgent\update\plugins\antPlugin.zip 
[2012-09-18 12:52:02,078]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/assembly-info-patcher.zip ==> E:\buildAgent\update\plugins\assembly-info-patcher.zip 
[2012-09-18 12:52:02,098]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/clearcase-agent.zip ==> E:\buildAgent\update\plugins\clearcase-agent.zip 
[2012-09-18 12:52:02,106]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/commandLineRunner.jar ==> E:\buildAgent\update\plugins\commandLineRunner.jar 
[2012-09-18 12:52:02,118]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/coveragePlugin.zip ==> E:\buildAgent\update\plugins\coveragePlugin.zip 
[2012-09-18 12:52:02,151]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/crashDetector.zip ==> E:\buildAgent\update\plugins\crashDetector.zip 
[2012-09-18 12:52:02,163]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/cvsAgent.zip ==> E:\buildAgent\update\plugins\cvsAgent.zip 
[2012-09-18 12:52:02,183]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/dotCover.zip ==> E:\buildAgent\update\plugins\dotCover.zip 
[2012-09-18 12:52:02,308]   INFO -    jetbrains.buildServer.AGENT - Downloading http://localhost:8000/update/plugins/dotNetPlugin.zip ==> E:\buildAgent\update\plugins\dotNetPlugin.zip 
[2012-09-18 12:52:03,830]   INFO - agent.impl.AgentPortFileWriter - Delete agent runtime file from E:\buildAgent\logs\buildAgent.port 
[2012-09-18 12:52:03,831]   INFO -    jetbrains.buildServer.AGENT - Unregistering from build server: 5 

Has anyone seen anything like this before? We've looked at the server logs and aren't seeing anything on them to indicate what could be wrong.

Answer

Frank picture Frank · Aug 19, 2014

I ran into the same issue. Both the build agent and the server are installed on Windows Server 2012.

I stopped the build agent service and deleted the logs from BuildAgent\logs and restarted the build agent service so I could see a fresh log.

upgrade.log showed me that the build agent received a call from the teamcity server to upgrade. The log also showed the following:

"Please check TeamCity build agent service user have enough permissions to stop and start the service."

Using the Local Security Policy, I granted the build agent service user "logon as a service" rights but this is not sufficient to start and stop a service. By default, only members of the Administrators group can start, stop, pause, resume or restart a service. After I added the build agent service user to the Administrator group and restarted the build agent service, the upgrade finished successfully and the agent connected again.