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.

Richard Dingwall
  • 151
  • 2
  • 3
  • 9

2 Answers2

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"
Richard Dingwall
  • 151
  • 2
  • 3
  • 9
0

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

CoreTech
  • 1,791