Forum Discussion
md5hash
May 03, 2024Copper Contributor
SCVMM 2022 Install failure - MSSQL database connectivity issue
Hello, I'm trying to install SCVMM 2022 on a brand new Windows Server 2019 system. The SQL database is SQL Server 2016 version 13.0.6435.1. The SQL server is already in use in production with numerous other databases, using the default instance MSSQLSERVER
No issues with prerequisites when I use the Wizard setup.exe, but things have failed so many times now I have switched to using the CLI install method.
I pre-create a new database on the SQL server, named VirtualManagerDB, per the instructions here. The account I want to use as a service account is called COMPANY\CitrixRunAS - it is not a SQL admin account, but it does have dbo privileges just on this one Database. The instructions do not state that I need to give this service account any higher level permissions on the SQL server itself like sysadmin, etc.
Then I setup VMServer.ini to do a CLI install with the following parameters, following this guide:
[OPTIONS]
ProductKey=<redacted>
UserName=Citrix-VMM
CompanyName=Company
SqlInstanceName=MSSQLSERVER$
SqlMachineName=sql1.company.com
CreateNewSqlDatabase=0
SqlDatabaseName=VirtualManagerDB
SqlServerPort=1433
RemoteDatabaseImpersonation=1
CreateNewLibraryShare=1
LibrarySharePath=C:\VMMLibrary
LibraryShareDescription=Citrix VMM Library Files
VmmServiceLocalAccount=0
TopContainerName=OU=VMM,OU=Distributed Key Management,OU=Service,DC=company,DC=com
Upgrade=0
Then, I use the following install script:
setup.exe /server /i /f C:\temp\2022\VMServer.ini /sqldbadmindomain company /sqldbadminName CitrixRunAs /sqldbadminpassword redacted /vmmservicedomain company /vmmserviceusername CitrixRunAs /vmmserviceuserpassword redacted /iacceptsceula
and follow along in the log file located at "C:\ProgramData\vmmlogs\SetupWizard.log"
Things progress fine until right after the Windows Features get checked for.
02:42:02:ProcessInstalls: Install Item VMM management server was successful. We will launch the post process delegate.
02:42:18:Windows feature RSAT-Clustering-PowerShell already enabled, skipping
02:42:20:Windows feature WindowsStorageManagementService already enabled, skipping
02:42:22:Windows feature UpdateServices-API already enabled, skipping
02:42:24:Windows feature FabricShieldedTools already enabled, skipping
02:42:26:Windows feature RSAT-Storage-Replica already enabled, skipping
02:42:26:We are going to impersonate as company\CitrixRunAs.
02:42:26:Out of Impersonation
02:42:26:We are going to impersonate as company\CitrixRunAs.
02:42:26:Out of Impersonation
02:42:26:We are going to impersonate as company\CitrixRunAs.
02:43:33:Out of Impersonation
02:43:33:GetSqlLoginName: TThe login name for the vmm server service is [company\CitrixRunAs]
02:43:33:We are going to impersonate as company\CitrixRunAs.
02:43:33:Out of Impersonation
02:43:33:GetSqlLoginName: TThe login name for the vmm server service is [company\CitrixRunAs]
02:43:33:We are going to impersonate as company\CitrixRunAs.
02:43:34:Out of Impersonation
02:43:34:VMMPostinstallProcessor threw an exception: Threw Exception.Type: Microsoft.VirtualManager.Setup.Exceptions.DatabaseConfigurationException, Exception.Message: Setup could not configure the database VirtualManagerDB.
Ensure service MSSQL$ is started by running "services.msc", find the service, and then verify that the service is started.
02:43:34:StackTrace: at Microsoft.VirtualManager.Setup.DBConfigurator.GrantSetupUserDBAccess(Boolean install)
at Microsoft.VirtualManager.Setup.VirtualMachineManagerHelpers.GrantSetupUserDBAccess(Boolean install)
at Microsoft.VirtualManager.Setup.InstallItemCustomDelegates.PangaeaServerPostinstallProcessor()
02:43:34:InnerException.Type: Microsoft.VirtualManager.DB.CarmineSqlException, InnerException.Message: Unable to connect to the VMM database because of a general database failure.
Ensure that the SQL Server is running and configured correctly, then try the operation again.
02:43:34:InnerException.StackTrace: at Microsoft.VirtualManager.DB.SqlRetryCommand.ExecuteNonQuery()
at Microsoft.VirtualManager.Setup.SetupDatabaseHelper.CreateSqlLogin(String loginName, SqlContext ctx)
at Microsoft.VirtualManager.Setup.SetupDatabaseHelper.CreateSqlLogin(String connStr, String loginName)
at Microsoft.VirtualManager.Setup.DBConfigurator.CreateCarmineLoginAndDBUser(String loginName, String userName)
at Microsoft.VirtualManager.Setup.DBConfigurator.GrantSetupUserDBAccess(Boolean install)
02:43:34:InnerException.Type: System.Data.SqlClient.SqlException, InnerException.Message: User does not have permission to perform this action.
02:43:34:InnerException.StackTrace: 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.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.VirtualManager.DB.SqlRetryCommand.ExecuteNonQuery()
02:43:34:ProcessInstalls: Running the PostProcessDelegate returned false.
02:43:34:ProcessInstalls: Running the PostProcessDelegate for PangaeaServer failed.... This is a fatal item. Setting rollback.
02:43:34:ProcessInstalls: Rollback is set and we are not doing an uninstall so we will stop processing installs
02:43:34:****************************************************************
02:43:34:****Starting*RollBack*******************************************
02:43:34:****************************************************************
Then it begins the rollback process. Some other relevant looking lines here in the rollback:
02:44:04:vitalfailure = Installing, Uninstalling, MicrosoftInstaller, PostInstallItem
02:44:04:FailureReason = Microsoft.VirtualManager.Setup.Exceptions.DatabaseConfigurationException: Setup could not configure the database VirtualManagerDB.
Ensure service MSSQL$ is started by running "services.msc", find the service, and then verify that the service is started. ---> Microsoft.VirtualManager.DB.CarmineSqlException: Unable to connect to the VMM database because of a general database failure.
Ensure that the SQL Server is running and configured correctly, then try the operation again. ---> System.Data.SqlClient.SqlException: User does not have permission to perform this action.
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.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.VirtualManager.DB.SqlRetryCommand.ExecuteNonQuery()
--- End of inner exception stack trace ---
at Microsoft.VirtualManager.DB.SqlRetryCommand.ExecuteNonQuery()
at Microsoft.VirtualManager.Setup.SetupDatabaseHelper.CreateSqlLogin(String loginName, SqlContext ctx)
at Microsoft.VirtualManager.Setup.SetupDatabaseHelper.CreateSqlLogin(String connStr, String loginName)
at Microsoft.VirtualManager.Setup.DBConfigurator.CreateCarmineLoginAndDBUser(String loginName, String userName)
at Microsoft.VirtualManager.Setup.DBConfigurator.GrantSetupUserDBAccess(Boolean install)
--- End of inner exception stack trace ---
at Microsoft.VirtualManager.Setup.DBConfigurator.GrantSetupUserDBAccess(Boolean install)
at Microsoft.VirtualManager.Setup.VirtualMachineManagerHelpers.GrantSetupUserDBAccess(Boolean install)
at Microsoft.VirtualManager.Setup.InstallItemCustomDelegates.PangaeaServerPostinstallProcessor()
*** Carmine error was: DatabaseConfigurationFailed (334)
*** VirtualManagerDB ** MSSQL$ **
[s#2751] ExecuteNonQuery(this: (SqlRetryCommand#[2706]) { cmd = (SqlCommand#e56c6b) System.Data.SqlClient.SqlCommand, errorTitle = (string) "errorTitle", sqlContext = (SqlContext#[d]) { [rw] CreateSqlLoginconstructionIdentity = (WindowsIdentity#974e1f) System.Security.Principal.WindowsIdentity commandList: { n=1 { NQ:"DECLARE @user_Account AS NVARCHAR(MAX)
SELECT @user_Account = SUSER_SNAME(0x0105000000000005150000003F53277FF531D637A224EC6E62760000)
EXEC('create login [' + @user_Account + '] from windows')", @5/3/2024 2:43:34 PM } } , conn = (SqlConnection#151bf1b) { State: Open Database: master DataSource: sql1.ads.ssc.wisc.edu\MSSQLSERVER$,1433 PacketSize: 8000 ServerVersion: 13.00.6435 StatisticsEnabled: False WorkstationId: VMM-2024 } }, behavior = Default, failFast = (bool) False }) in C:\__w\1\s\src\product\common\Utils\Db\SqlRetryCommand.cs:line 331
[s#1b] InstallActionProcessor.DoPostInstallTask() in C:\__w\1\s\src\product\setup\bootstrapper\managed\SetupWiz\HelperClasses\InstallActionProcessor.cs:line 380
[s#1] AccountHelper.IsGMSAUser(userName: (string) "CitrixRunAs", domainLdapDN: (string) "DC=primo") in C:\__w\1\s\src\product\common\Utils\AccountHelper.cs:line 1739
Full call stack from when the exception was thrown: at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
Why are the logs mentioning a MSSQL$ entry? That looks like a SQL instance but I very specifically told it to use the default MSSQLSERVER instance. That bit "Ensure service MSSQL$ is started by running "services.msc", find the service, and then verify that the service is started. ---> Microsoft.VirtualManager.DB.CarmineSqlException: Unable to connect to the VMM database because of a general database failure." is what shows up in the GUI install attempts.
When I go to the SQL server and I look at the contents of VirtualManagerDB database - I can see that new tables were created by the installer. So the installer was able to reach into the correct instance, and the correct database and modify it. But apparently it was not able to modify it enough to be satisfied.
On the SQL server, when I look in services.msc I can see that "SQL Server (MSSQLSERVER)" is a service that is running. Obviously. It's what's running my dozen other databases on this server. But there is no "MSSQL" service and I don't understand why VMM thinks there should be because I explicitly told it to to use MSSQLSERVER!
What could the problem possibly be? I do not think I missed any setup steps.
- md5hashCopper Contributor
I think the issue was that I was using the VMServer.ini parameter wrong.
For the "remotedatabaseimpersonation" parameter which before I had set to 1, thinking that I wanted to create the connection to MSSQL as the CitrixRunAs account, I re-read the description for the VMServer.ini parameter and its 0 and 1 options.
"0: Don't impersonate the administrator account for SQL Server. The user that runs setup.exe must be an administrator for the server that is hosting the SQL Server."
That was probably my issue. The CitrixRunAs account definitely isn't an admin for the MSSQL server; it's intentionally a limited-permission account that is intended to do one thing; be the dbo for the VirtualManagerDB. Once I changed that setting to 0 instead of 1, things worked.
This behavior does seem frustratingly obtuse though. Why does any of the users involved - be it the user doing the install of VMM on the VMM server, or the dbo account, need to be an admin on the SQL server?? This shouldn't be typical. I should just have to grant dbo rights to a service account in the SQL management studio, and then VMM's install should use that. My admin account on the SQL server should not need to be involved; if the SQL admin gives permission to the VMM admin to run a database for VMM on their SQL server, pre-creating the DB and granting DBO permissions should be all that is needed!