Cannot find the symmetric key ‘SCSSOKey’ causing K2 server to restart automatically during upgrade

Hi there,

I had come across this issue during fresh k2 platform installation which drove me crazy for sometime, thus I thought of sharing this one, would be helpful of someone out there.

Error scenario:

During the K2 blackpearl installation, K2 database configuration status results Warning, and when you try to repair the blackpearl, as soon as the installer reached the K2 artefacts configuration window, windows server automatically restarts.

When you go and check the error logs and event viewer logs, you can see the below error messages logged by SourceCode.Logging application;

Error message

———————————————————————————————————————————————————————–

0 System.Data.SqlClient.SqlException (0x80131904): Cannot find the symmetric key ‘SCSSOKey’, because it does not exist or you do not have permission.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

   at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)

   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)

   at System.Data.SqlClient.SqlDataReader.TryNextResult(Boolean& more)

   at System.Data.SqlClient.SqlDataReader.NextResult()

   at SourceCode.Hosting.Server.Runtime.HostLoadBalancedServerManager.Poll()

ClientConnectionId:2a603a25-24a5-4dcf-b650-3a74be80c3fb

Error Number:15151,State:1,Class:16

———————————————————————————————————————————————————————–

The above issue is due to master key and symmetric key for K2 database is not exist or might be corrupted in the SQL server. I assume you are aware of Database level security, To know more about Database encryption Click Here – DB Encryption

Troubleshooting Steps

Every database has Master Key to it, so as K2 database must also have master key generated in the server.

to check the symmetric key details against to K2 database, run the below script;

Capture

it should give the below result;

Capture

If the above query returns nothing, it means the symmetric key for K2 database is corrupted (doesn’t exist).

We need to manually create them by running the below command;

Before you run the below scripts against to K2 database, please make sure to take complete database backup.

Script to create Master key and symmetric key

Capture

Once Master key is created and linked, now before you run K2 installer in repair mode, make sure K2HostServer.exe is stopped working from TaskManager. Once you kill the K2HostServer.exe, now you are good to run the K2 installer in repair mode which will repair whole K2 database.


Leave a comment