I’ve been setting up a new VM with TeamCity and Octopus and it was all going great, except today I booted up my VM and saw that Octopus didn’t start. I tried starting the service manually but it just stops instantly.
I’ve checked the Windows logs and this is the error that I get:
2019-07-11 17:26:22.2362 7920 7 FATAL There is an error in XML document (0, 0).
Root element is missing.
System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlReader.MoveToContent()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderXmlSettingsRoot.Read4_octopussettings()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at Octopus.Shared.Configuration.XmlKeyValueStore.LoadSettings(IDictionary`2 settingsToFill)
at Octopus.Shared.Configuration.DictionaryKeyValueStore.Load()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Octopus.Shared.Configuration.DictionaryKeyValueStore.Read(String key)
at Octopus.Shared.Configuration.FlatDictionaryKeyValueStore.Get[TData](String name, TData defaultValue, ProtectionLevel protectionLevel)
at Octopus.Shared.Configuration.HomeConfiguration.get_HomeDirectory()
at Octopus.Shared.Configuration.LoggingConfiguration.get_LogsDirectory()
at Octopus.Shared.Configuration.LogInitializer.InitializeLogs()
at Octopus.Shared.Configuration.ApplicationInstanceSelector.LoadCurrentInstance()
at Octopus.Shared.Configuration.ApplicationInstanceSelector.GetCurrentInstance()
at Octopus.Server.Commands.RunCommand.Start()
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions)
at Octopus.Shared.Startup.WindowsServiceHost.<>c__DisplayClass1_0.<Run>b__0()
at Octopus.Shared.Startup.WindowsServiceAdapter.RunService()
This has been running fine for weeks, so I’m not sure why this is only now starting to occur. I’m also due to be working on getting this VM image working on a production critical server this Saturday.
Sorry to hear that you’re having issues - from the looks of this error, it would point to your OctopusServer.exe.config or perhaps Octopus.Server.exe.nlog files may have been corrupted - is it possible that something may have happened there to cause this to happen? Perhaps a recent Octopus upgrade?
You can check these files by navigating to your installation directory (C:\Program Files\Octopus Deploy\Octopus on a default installation), and opening them from there.
Do you have a backup/snapshot of your Octopus installation directory that you could attempt a restore from?
Hi Justin. I haven’t done an upgrade - this was a fresh install about 2/3 months ago that I’ve been working on, I didn’t do anything out of the ordinary - I was working on a deployment target, turned off the VM and since then I get this error.
I don’t have backups, no (but once this is on the production server we’ll be doing backups). I’ll have a look at the config files, what sort of data do these hold? Will I have lost any my setup such as Accounts and Infrastructure as well? Or should it be relatively safe to reinstall Octopus (if required) and point to my existing SQL server DB?
You should be right to do that, yes! All of your work is stored in the database, so you should be fine to just reinstall and re-point. You will want to make sure you use the same version as you had installed previously to avoid any data issues.
As for the cause of this, I’m not really sure, we’ve only had two cases of this reported ever, and both times they were due to environmental issues that externally impacted the filesystem.
Please let the know if you have any further questions!
We’re just digging into this some more, following another report of this happening, and we’re wondering if you made and changes to your Octopus server via the Octopus.Server.exe CLI before you encountered this issue. I know it was a little while ago now, and we’re just pondering some hypotheses about what could be causing it.