14

We've had some nasty time sync problems on our Windows Server 2008 R2 servers lately.

I traced this back to something very simple: the Windows Time Service was not started! The time can't possibly sync via NTP when the time service isn't running...

The Windows Time Service was set to start "automatically" in the services control panel, which I double and triple checked. I also checked the event logs and I didn't see any service failures or anything like that. In fact, it looked a heck of a lot like the Windows Time Service never started up automatically after the weekly Windows Updates were installed and the servers were rebooted. (this is set to happen every Saturday at 7 PM.)

The minute I started the Time Service, the time synced fine.

So, then, the question: why would a service set to start "Automatically" ... not be started automatically? That seems sort of crazy to me.

Jeff Atwood
  • 12,994
  • 20
  • 74
  • 92

4 Answers4

11

W32time will not start automatically if the PC is not in a domain. Damn Microsoft!

Try to run this: sc triggerinfo w32time start/networkon stop/networkoff

Ben Pilbrow
  • 11,995
  • 5
  • 35
  • 57
ARPcPro
  • 134
  • 1
  • 2
  • confirmed here http://www.mcbsys.com/techblog/2010/09/windows-time-stops-even-when-set-to-start-automatically/ so I will accept your answer -- thanks! – Jeff Atwood Jan 09 '11 at 21:25
4

One possible explanation, from this thread:

The way I understood it, basically the service won't be turned on until you or a task or a piece of hardware or network, start an event to turn it on. When you try to update the time, you call on the service and trigger the event 'Start xyz service'. It can also turn the service off when finished. That's very simplified. It is one reason why seven is faster, because many services are only running when needed instead of running all the time waiting for something to use them. In effect you don't have to try to decide which services you need or don't, they can take care of themselves.

He's talking about the new kernel in Windows 7.

Since Windows Server 2008 R2 and Windows 7 do share the same kernel, I wonder if the resolution is the same?

They recommend setting the service to automatic/delayed start to fix this.

I still maintain it's downright insane that a service set to automatic wouldn't be started ... and I don't fully understand the semantic difference between a delayed auto-start and an auto-start, but if it works, I guess I won't complain.

Jeff Atwood
  • 12,994
  • 20
  • 74
  • 92
  • While on windows 7 that may be the case. I have a hard time believing they would have the same system in win 2k8, especially with a machine on a domain as time sync is so vital to authentication. – Zypher Feb 05 '10 at 00:59
  • well, I have 100% confirmed that this is a service set to Automatic that was inexplicably NOT running. The odd thing is that *all* the other services set to Automatic (delayed start or not), save "Software Protection", are running.. what's special about w32time that prevents it from running automatically? – Jeff Atwood Feb 05 '10 at 01:06
1

Unfortunately with windows time you have manually turn on logging.

There is no good answer to "what would cause a service to not start automatically." The only real reason is that a dependency did not start correctly, or there was some sort of crash in the service when it started. And without logs, well your guess is as good as ours.

I would suggest turning on windows time logging for the next couple of patch cycles. If the service comes up you're all good, if it doesn't you have something to work from.

Just as a note, I have seen more than once services decide to just not start for no good reason after a patch, but work just fine after that first reboot.


Started to write a comment, then ran out of space.

You would actually get some information from this log.

  1. If there is no log at all, it's not even trying to start. And you can start researching from there, every little scrap of info helps on these types of problems.

  2. Since it's a debug log you are turning on with the above link you should get something if it tries to start. You'll at least have a better idea of why it is failing to start successfully.

You've discovered one of the great pains of being a sysadmin: You need logs to tell you where to start looking, but the service isn't getting to a point that it can generate logs. A classic chicken and the egg problem.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
Zypher
  • 36,995
  • 5
  • 52
  • 95
  • I don't think logging would necessarily help in this case, because it's not even running to log. And, once the service is running it works great! The real question is, why *isn't* it running? – Jeff Atwood Feb 05 '10 at 01:07
  • Are you on a domain? What are the time rules for your domain? – Trevoke Feb 05 '10 at 14:42
0

Thanks, i have set some services that weren't starting on Windows Server 2016 to delayed and it worked, but, i couldn't do that for the antivirus service, as it's protected from modification.

However, i found this work-around, which worked, even if it was for 2008 R2: https://support.microsoft.com/en-us/help/922918/a-service-does-not-start-and-events-7000-and-7011-are-logged-in-windows-server-2003-windows-server-2008-and-windows-server-2008-r2

Probably that will make any service start, without setting them to delayed start. It worked for the antivirus, that's for sure.

I'll paste the most useful part of the work-around here:

To work around this problem, modify the registry to increase the default time-out value for the service control manager. To increase this value to 60 seconds, follow these steps:

Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
In the right pane, locate the ServicesPipeTimeout entry.

Note: If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:

    On the Edit menu, point to New, and then click DWORD Value.
    Type ServicesPipeTimeout, and then press ENTER. 
Right-click ServicesPipeTimeout, and then click Modify.
Click Decimal, type 60000, and then click OK.

This value represents the time in milliseconds before a service times out.
Restart the computer.
fsr
  • 1
  • 1