Ran SQLEXPR_x64_ENU.exe /q returned -2067529716

Hi
I am trying to install SQL server using below recipe:

remote_file "#{Chef::Config[:file_cache_path]}/SQLEXPR_x64_ENU.exe" do
  source 'https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/Express%2064BIT/SQLEXPR_x64_ENU.exe'
  checksum '8f712faefee9cef1d15494c9d6cf5ad3b45ec06d0b2c247f8384a221baaadda7'
end
execute 'SQLEXPR_x64_ENU.exe /q' do
  cwd Chef::Config[:file_cache_path]
end

Getting below error:

Preparing: C:\Users\test\AppData\Roaming\chef-workstation\cache\SQLEXPR_x64_ENU\x64\Setup\sql_engine_core_shared_msi\Windows\MS.NET\Fx64\v4.0\AQVP-SAU.DLL...


Preparing: C:\Users\test\AppData\Roaming\chef-workstation\cache\SQLEXPR_x64_ENU\x64\Setup\sql_engine_core_shared_msi\Windows\MS.NET\Fx64\v4.0\MAOAW_HA.DLL...


Preparing: C:\Users\test\AppData\Roaming\chef-workstation\cache\SQLEXPR_x64_ENU\x64\Setup\sql_engine_core_shared_msi\Windows\MS.NET\Fx64\v4.0\R8OVTYPF.NLP...


Preparing: C:\Users\test\AppData\Roaming\chef-workstation\cache\SQLEXPR_x64_ENU\x64\Setup\sql_engine_core_shared_msi\Windows\System32\RXE_LBBQ.DLL...
STDERR: 
---- End output of SQLEXPR_x64_ENU.exe /q ----
Ran SQLEXPR_x64_ENU.exe /q returned -2067529716

You need to have a configuration file to tell sql server how to install specified in your execute block. Sql sever needs you to accept the eula, specify initial database and set the SA password as part of the setup process.

Please see this doc for more information.

Thanks Larryc

I am able to add configuration file and successfully able to install SQL_Server using power shell directly on the chef-node using below script.

start /WAIT /B .\SETUP.EXE /Q /ConfigurationFile=ConfigurationFile.ini

But when I called a same script through below chef recipe:

powershell_script 'RunSqlExpr_bat_file' do
   code <<-EOH
   cd "C:/Software/SQLEXPR_x64_ENU"
   $Install_SQL = .\\RunSqlExpr.bat
   $Install_SQL > C:/Software/SQLEXPR_x64_ENU/result.txt
   EOH
   guard_interpreter :powershell_script
 end

I am getting below error:

Setting: RSINSTALLMODE
Value specified: FilesOnlyMode
New setting source: ConfigFile; previous setting source: NotSpecified
----------------------------------------
Completed Action: ProcessFeatureConfigFileArguments, returned True
----------------------------------------------------------------------
Running Action: ValidateSettingsAgainstScenario
Scenario: Install
Completed Action: ValidateSettingsAgainstScenario, returned True
----------------------------------------------------------------------
Running Action: FinalCalculateSettings
Error: Action "Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction" threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: There was a failure to calculate the applicability of setting CLUSTERNODESSTATUS. ---> Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingApplicabilityException: There was a failure to calculate the applicability of setting CLUSTERNODESSTATUS. ---> Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingChangeabilityException: There was a failure to calculate the changeability of setting CLUSTERNODESSTATUS. ---> Microsoft.SqlServer.Chainer.Infrastructure.UnableRetrieveConfigObjectForSettingException: Unable to retrieve a public configuration object type Microsoft.SqlServer.Configuration.ClusterConfiguration.ClusterNodesStatusPublicConfigObject for setting CLUSTERNODESSTATUS. ---> Microsoft.SqlServer.Chainer.Infrastructure.UnableRetrieveConfigObjectException: Unable to retrieve a public configuration object type Microsoft.SqlServer.Configuration.ClusterConfiguration.ClusterNodesStatusPublicConfigObject. ---> Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException: Exception of type 'System.OutOfMemoryException' was thrown. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.InitIDs()
   at System.Xml.Serialization.TempAssembly.InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, String encodingStyle)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type, String elementXPath)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type, String elementXPath)
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type)
   at Microsoft.SqlServer.Chainer.Infrastructure.PublicConfigurationBridge.GetHostingObject()
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Chainer.Infrastructure.PublicConfigurationBridge.GetHostingObject()
   at Microsoft.SqlServer.Chainer.Infrastructure.SettingBridge.GetHostingObject()
   --- End of inner exception stack trace ---

I have 10 GB vacant in C drive and 60 GB in E drive space on chef-node.
16 GB RAM
Set _JAVA_OPTIONS=-Xmx2046M
JAVA_OPTS=-Xms256m -Xmx512m -XX:MaxPermSize=256m

I don't know why I didnot face the same issue, when run through power-shell directly on chef-node.

Are you trying to run the cookbook against the same node you tested the script on?

Yes Larryc

If you ran that script and installed SQL express already that would explain why its erroring out on cluster configuration. Can you try it on a fresh node?

Hi Larryc

No, I always uninstall the sql server before to run through cookbook.
By the way, I am able to install it on other chef-node2.

Looks like memory issue is there on my chef-node1.

Thanks Larryc for your all inputs.
Hope you guide me in future as you did.

Cool glad it worked out, should try using test kitchen if you aren't it can help track down issues quicker for instances like this where the software you are installing can be quite finicky.

Hi @Larryc

Some time I am getting below error while install MSSQL Server 2014 using chef

check for instance name, got: 'MSSQLSERVER'
Error: Action "Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction" threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: There was an error generating the XML document. ---> Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException: There was an error generating the XML document. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.Security.Cryptography.CryptographicException: Access is denied.
   at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
   at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean needType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object o)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
   at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
   at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(Object objectToSerialize)
   at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateSettings(IEnumerable`1 settingIds)
   at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
   at Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction.ExecuteAction(String actionId)
   at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.<ExecuteActionWithRetryHelper>b__b()
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionWithRetryHelper(WorkflowObject metaDb, ActionKey action, ActionMetadata actionMetadata, TextWriter statusStream)
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.InvokeAction(WorkflowObject metabase, TextWriter statusStream)
   at Microsoft.SqlServer.Setup.Chainer.Workflow.PendingActions.InvokeActions(WorkflowObject metaDb, TextWriter loggingStream)
   at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionEngine.RunActionQueue()
Error: Action "Microsoft.SqlServer.Configuration.BootstrapExtension.ExecuteWorkflowAction" threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: There was an error generating the XML document. ---> Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException: There was an error generating the XML document. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.Security.Cryptography.CryptographicException: Access is denied.
   at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)

Any idea? its urgent

Thanks
Deepak

Please find the configuration_File_install.init file

; SQLSERVER2014 Configuration File
; Generated by Chef Software Chef
[OPTIONS]

; Auto accept the license terms

IACCEPTSQLSERVERLICENSETERMS="True"

; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication.

SECURITYMODE="SQL"
SAPWD="Hello2017"

; Specify whether SQL Server Setup should discover and include product updates. The valid values are True and False or 1 and 0. By default SQL Server Setup will include updates that are found.

UpdateEnabled="False"

; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.

INSTANCEID="MSSQLSERVER"

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

ACTION="Install"

; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.

FEATURES=SQLENGINE,CONN,SSMS,ADV_SSMS,SQL,AS,RS,IS,Tools

; Displays the command line parameters usage

HELP="False"

; Specifies that the detailed Setup log should be piped to the console.

INDICATEPROGRESS="True"

; Setup will not display any user interface.

QUIET="False"

; Setup will display progress only without any user interaction.

QUIETSIMPLE="False"

; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

X86="False"

; Detailed help for command line argument ROLE has not been defined yet.

ROLE="AllFeatures_WithDefaults"

; Detailed help for command line argument ENU has not been defined yet.

ENU="True"

; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.
; UIMode setting cannot be used in conjunction with /Q or /QS
; UIMODE="Normal"

; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

ERRORREPORTING="False"

; Specify the root installation directory for native shared components.

INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"

; Specify the root installation directory for the WOW64 shared components.

INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server"

; Specify the installation directory.

INSTANCEDIR="C:\Program Files\Microsoft SQL Server"

; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

SQMREPORTING="False"

; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

INSTANCENAME="MSSQLSERVER"

; Agent account name

AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Auto-start service after installation.

AGTSVCSTARTUPTYPE="Disabled"

; Startup type for Integration Services.

ISSVCSTARTUPTYPE="Automatic"

; Account for Integration Services: Domain\User or system account.

ISSVCACCOUNT="NT AUTHORITY\NetworkService"

; Controls the service startup type setting after the service has been created.

ASSVCSTARTUPTYPE="Automatic"

; The collation to be used by Analysis Services.

ASCOLLATION="Latin1_General_CI_AS"

; The location for the Analysis Services data files.

ASDATADIR="Data"

; The location for the Analysis Services log files.

ASLOGDIR="Log"

; The location for the Analysis Services backup files.

ASBACKUPDIR="Backup"

; The location for the Analysis Services temporary files.

ASTEMPDIR="Temp"

; The location for the Analysis Services configuration files.

ASCONFIGDIR="Config"

; Specifies whether or not the MSOLAP provider is allowed to run in process.

ASPROVIDERMSOLAP="1"

; A port number used to connect to the SharePoint Central Administration web application.
; The setting 'FARMADMINIPORT' specified is not recognized.
; FARMADMINIPORT="0"

; Startup type for the SQL Server service.

SQLSVCSTARTUPTYPE="Automatic"

; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

FILESTREAMLEVEL="0"

; Set to "1" to enable RANU for SQL Server Express.

ENABLERANU="True"

; Specifies a Windows collation or an SQL collation to use for the Database Engine.

SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"

; Account for SQL Server service: Domain\User or system account.

SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Windows account(s) to provision as SQL Server system administrators.

SQLSYSADMINACCOUNTS="Administrator"

; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.

ADDCURRENTUSERASSQLADMIN="True"

; Specify 0 to disable or 1 to enable the TCP/IP protocol.

TCPENABLED="1"

; Specify 0 to disable or 1 to enable the Named Pipes protocol.

NPENABLED="0"

; Startup type for Browser Service.

BROWSERSVCSTARTUPTYPE="Disabled"

; Specifies which account the report server NT service should execute under.  When omitted or when the value is empty string, the default built-in account for the current operating system.
; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.

RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Specifies how the startup mode of the report server NT service.  When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled

RSSVCSTARTUPTYPE="Automatic"

; Specifies which mode report server is installed in.
; Default value: "FilesOnly"

RSINSTALLMODE="FilesOnlyMode"

It appears to be a permissions issue see here

https://social.msdn.microsoft.com/Forums/windowsserver/en-US/1f6488a0-dccb-4de6-806d-45ca1e507b09/error-installing-sql-server-2014-using-command-line-install-from-win-rm?forum=sqlsetupandupgrade

Not working. same error