2

I have a Windows XP SP3 machine with a TeamCity 6.5 Build Agent I am trying to make run under a different account. However, when I try to start it, it fails immediately with the following error:

Error 1053: The service did not respond to the start or control request in a timely fashion.

This error is normally reserved for when services fail to start within 30 seconds, however in my case the error is thrown immediately.

What are the possible reasons that could be causing this error? I have verified everything I can think of:

  • The service runs fine under SYSTEM.
  • It is a domain account.
  • The domain account is not locked out, and the password is set to never expire.
  • The password is entered correctly. (yes ;)
  • The domain account is added to the local Administrators group.
  • The domain account is granted the 'Log on as a service' local security policy.

There is nothing in event log except success audits for the account logging in and out, and the service failed to start error (with no further details, exit codes, or stack traces). No files are produced in the C:\BuildAgent\logs directory, so I don't think the process is even starting at all.

3
  • 1
    Is there another service that it relies on that is not starting/failing?
    – jmreicha
    Oct 6, 2011 at 18:14
  • Hadn't thought of that, but no, the service has no dependencies. Oct 7, 2011 at 8:25
  • Okay. Turned out it was an issue with the service in question. Sorry, should've come clean at the start. Oct 13, 2011 at 17:24

2 Answers 2

3

There were no files created in C:\BuildAgent\logs, but in C:\BuildAgent\launcher\bin\wrapper.log I found the following error message:

FATAL  | wrapper  | 2011/10/13 18:00:08 | Unable to access registry to obtain environment variables - The operation completed successfully. (0x0)

It seems the TeamCity Build Agent is kicked off by the open-source Java Service Wrapper by Tanuki. The error message arises when the wrapper starts up, it pulls all the environment variables from the registry and injects them into the current context for the wrapped-application (source code with error message here).

The wrapper exits immediately if either of the following keys are not present:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\
  • HKEY_CURRENT_USER\Environment\

In my case, the second key was missing, for some reason. But running the following command (in the context of the user in question) populated the required key and the TeamCity build agent was able to start.

runas /user:MYDOMAIN\MyUser REG ADD "HKCU\Environment" /v "Foo" /d "Bar"
1
  • Thank you so much for this solution! I just had to create the key "HKEY_CURRENT_USER\Environment" using regedit and the "TeamCity Build Agent Service" was able to be started again.
    – Dimitri C.
    Mar 26, 2012 at 13:40
0

This could be a permissions issue. Does the service access any resources that the user does not have the rights to use?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .