Windows Server Essentials being difficult again…

The other day I realised that my home server hadn’t sent me it’s daily “Health Report” email. Having done the usual simple test of “is the server up?” and “what happens if I reboot it?”, I ended up digging through the Event Log and Google to work out what was wrong. In case this happens to me again, or happens to you, here’s what I found:

The symptoms…

While I wasn’t seeing the health emails, nothing much else appeared obviously wrong. I was still getting my daily “backup has succeeded” email. My son’s Minecraft server was happy, and my Git, RSS and music services were running fine.

Checking the Services admin tool, I noticed that the “Windows Server Essentials Management Service” was stopped. Trying to start it did not succeed, and each attempt put two events into the Event Log. The first was a standard “Windows could not start that service” message:

Faulting application name: SharedServiceHost.exe, version: 6.3.9600.16384, time stamp: 0x5215ca62
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x80131623
Fault offset: 0x00007ff8be8f2746
Faulting process id: 0x15f4
Faulting application start time: 0x01d1cead9c3cbcf9
Faulting application path: C:\Windows\System32\Essentials\SharedServiceHost.exe
Faulting module path: unknown
Report Id: dbae03fc-3aa0-11e6-8113-c03fd5600a64
Faulting package full name: 
Faulting package-relative application ID: 

“SharedServiceHost.exe” is indeed the binary for the failed service:

Stopped Service

Each of these event messages was accompanied by a bigger error about the actual failure that occurred:

Application: SharedServiceHost.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unhandled exception in OnStart: System.ArgumentNullException: The empty string '' is not a valid local name.
Parameter name: name
   at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
   at System.Xml.XmlUTF8TextReader.VerifyNCName(String s)
   at System.Xml.XmlUTF8TextReader.ReadQualifiedName(PrefixHandle prefix, StringHandle localName)
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlBaseReader.MoveToContent()
   at System.Xml.XmlBaseReader.IsStartElement()
   at System.Xml.XmlBaseReader.IsStartElement(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
   at ReadArrayOfDevicePropertyFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadKeyValueOfstringArrayOfDevicePropertyoy2JKP7OFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
   at ReadArrayOfKeyValueOfstringArrayOfDevicePropertyoy2JKP7OFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
   at Microsoft.WindowsServerSolutions.Common.Devices.DataContractObjectStore`1.Load(String path, IEnumerable`1 knownTypes)
   at Microsoft.WindowsServerSolutions.Common.Devices.DataContractObjectStore`1.Load()
   at Microsoft.WindowsServerSolutions.Common.Devices.DevicesXmlDataStore.Read()
   at Microsoft.WindowsServerSolutions.Common.Devices.DevicesProviderDataManager.ReadFromDataStore()
   at Microsoft.WindowsServerSolutions.Common.Devices.DevicesProviderDataManager.DoLoadDeviceData()
   at Microsoft.WindowsServerSolutions.Common.Devices.DeviceManagementActivity.CreateBackend()
   at Microsoft.WindowsServerSolutions.Common.Devices.DeviceManagementActivity.CreateProviderHosts()
   at Microsoft.WindowsServer.Essentials.WindowsService.WseServiceBase.CreateProviderHosts()
   at Microsoft.WindowsServerSolutions.Common.ProviderFramework.ProviderServiceBase._OpenHosts()
   at Microsoft.WindowsServer.Essentials.WindowsService.WseServiceBase.OnStartInner(String[] args)
   at Microsoft.WindowsServerSolutions.Common.ProviderFramework.ProviderServiceBase.OnStart(String[] args)
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.WindowsServerSolutions.Common.ProviderFramework.ProviderServiceBase.OnStart(System.String[])
   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

But how do I fix it?

Armed with that information, I spent a bit of time Googling about these errors. There were assorted threads on Microsoft’s support forums and similar places describing issues with this particular service. Most of the threads (this one for example) offered three potential solutions:

  1. The server’s backup catalog is corrupted
    Sounded plausible, and can supposedly be fixed by running “wbadmin delete catalog” from a command prompt. But this machine had a lot of important data on it which I need to back up regularly. I wasn’t keen on this approach as it means you lose all of your current server backup history, and have to re-do the backup from scratch afterwards.
  2. There may be a physical problem with the server’s disk
    Again plausible – I did have a failed hard drive in this machine before. But running disk checking commands like “DISM.EXE” or “sfc /scannow” did not report errors or fix the problem.
  3. The “DevicesInfo.xml” file may be corrupted
    Now this one seemed very likely – as the stack trace above is being thrown by code in System.Xml – so something wrong with an XML document seems like it could be the cause.

So putting the first option aside, I went looking in the folder C:\ProgramData\Microsoft\Windows Server\Data there is indeed a file of the name specified with a backup:

Xml File

Removing “DevicesInfo.xml” and renaming “DevicesInfo.xml.bak” worked ok (though it requires elevated privileges). And with that done clicking “Start” for the broken service now works. Success!

So what was wrong with the file?

Well running a diff between the working file and the broken one gives this:

Diff of the files

That looks to me like at some point the process stopped while saving the file, as the right hand (broken) copy just stops without closing the attributes and tags properly.

I had a power cut recently – my money’s on that…
Maybe I should invest in a UPS?

Advertisements

2 thoughts on “Windows Server Essentials being difficult again…

    • I was authenticated as an administrative account when I investigated the issue, so I was already elevated. Otherwise I think you’d need access to admin credentials to use “Run as” when starting explorer and your text editor.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s