Just a note on one issue to pin down exact error cause. You may see the situation when K2 host service is unable to start failing on Initializing Role Provider step for provider with label “K2” with the following error:
Error 2001 Error Starting Host Server: Data at the root level is invalid. Line 1, position 1.;Error Invoking 'StartHostServer' : SourceCode.HostServerLib: Data at the root level is invalid. Line 1, position 1.
Here is screenshot:
So if you read a few line above the error itself it should give you a clue – as we see that it fails attempting to initialize Role Provider with label “K2″… Already guessed what is wrong here?
So it seems that something wrong with security label K2, likely with RoleInit XML field. Tried to enable ADUM logging maybe? If yes just review SQL query you used to do this, likely it has some minor error causing above mentioned issue. Correct it & re-run SQL script and your K2 service is back up and running again 🙂