Sql server installation failure


#1

Hi,
I have written a cookbook for sqlserver installation (part of the code is given below). I’m facing such an issue where silent installation is happening (manually without using chef), But same installation through chef not happening.

puts "CD to #{node[:product][:location]}"
execute “starting SQL Server #{node[:sql][:version]} installation on windows” do
cwd node[:product][:location]
command "#{setupfile}setup.exe /CONFIGURATIONFILE=#{responsefile} > sqlserver.txt"
guard_interpreter :powershell_script
timeout 7200
returns [0, 42, 127, 3010]
ignore_failure true
end


#2

Can you share more details about the failure? Perhaps a gist of the chef output or the sqlserver.txt file?


#3

Overall summary:
Final result: Failed: see details below
Exit code (Decimal): -2068774911
Exit facility code: 1201
Exit error code: 1
Exit message: There was an error generating the XML document.
Start time: 2016-12-01 13:59:32
End time: 2016-12-01 13:59:55
Requested action: Install
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.2100.60&EvtType=0xE0C083E6%400xF80B8030&EvtType=0xE0C083E6%400xF80B8030

Setup completed with required actions for features.
Troubleshooting information for those features:
Next step for SQLEngine: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Replication: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Adv_SSMS: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for SSMS: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for SNAC: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for SNAC_SDK: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Writer: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Browser: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Machine Properties:
Machine name: INMBZP5163
Machine processor count: 4
OS version: Future Windows Version
OS service pack:
OS region: United States
OS language: English (United States)
OS architecture: x64
Process architecture: 64 Bit
OS clustered: No

Product features discovered:
Product Instance Instance ID Feature Language Edition Version Clustered

Package properties:
Description: Microsoft SQL Server 2012
ProductName: SQL Server 2012
Type: RTM
Version: 11
SPLevel: 0
Installation location: c:\chef_download\x64\setup
Installation edition: Evaluation

Product Update Status:
User selected not to include product updates.

User Input Settings:
ACTION: Install
ADDCURRENTUSERASSQLADMIN: false
AGTSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
AGTSVCPASSWORD:
AGTSVCSTARTUPTYPE: Disabled
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSERVERMODE: MULTIDIMENSIONAL
ASSVCACCOUNT:
ASSVCPASSWORD:
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS:
ASTEMPDIR: Temp
BROWSERSVCSTARTUPTYPE: Disabled
CLTCTLRNAME:
CLTRESULTDIR:
CLTSTARTUPTYPE: 0
CLTSVCACCOUNT:
CLTSVCPASSWORD:
CLTWORKINGDIR:
COMMFABRICENCRYPTION: 0
COMMFABRICNETWORKLEVEL: 0
COMMFABRICPORT: 0
CONFIGURATIONFILE: c:\chef_download\ConfigurationFile.ini
CTLRSTARTUPTYPE: 0
CTLRSVCACCOUNT:
CTLRSVCPASSWORD:
CTLRUSERS:
ENABLERANU: false
ENU: true
ERRORREPORTING: false
FEATURES: SQLENGINE, REPLICATION, SSMS, ADV_SSMS, SNAC_SDK
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME:
FTSVCACCOUNT:
FTSVCPASSWORD:
HELP: false
INDICATEPROGRESS: true
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL Server
INSTALLSHAREDWOWDIR: C:\Program Files (x86)\Microsoft SQL Server
INSTALLSQLDATADIR:
INSTANCEDIR: C:\Program Files\Microsoft SQL Server
INSTANCEID: MSSQLSERVER
INSTANCENAME: MSSQLSERVER
ISSVCACCOUNT: NT AUTHORITY\NetworkService
ISSVCPASSWORD:
ISSVCSTARTUPTYPE: Automatic
MATRIXCMBRICKCOMMPORT: 0
MATRIXCMSERVERNAME:
MATRIXNAME:
NPENABLED: 0
PID: *****
QUIET: true
QUIETSIMPLE: false
ROLE: AllFeatures_WithDefaults
RSINSTALLMODE: FilesOnlyMode
RSSHPINSTALLMODE: DefaultSharePointMode
RSSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
RSSVCPASSWORD:
RSSVCSTARTUPTYPE: Automatic
SAPWD: *****
SECURITYMODE: SQL
SQLBACKUPDIR:
SQLCOLLATION: SQL_Latin1_General_CP1_CI_AS
SQLSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
SQLSVCPASSWORD:
SQLSVCSTARTUPTYPE: Automatic
SQLSYSADMINACCOUNTS: INMBZP5163\Administrator
SQLTEMPDBDIR:
SQLTEMPDBLOGDIR:
SQLUSERDBDIR:
SQLUSERDBLOGDIR:
SQMREPORTING: false
TCPENABLED: 1
UIMODE: Normal
UpdateEnabled: false
UpdateSource: MU
X86: false

Configuration file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20161201_135859\ConfigurationFile.ini

Detailed results:
Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: SQL Server Replication
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: Management Tools - Complete
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: Management Tools - Basic
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: SQL Client Connectivity
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: SQL Client Connectivity SDK
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: SQL Writer
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Feature: SQL Browser
Status: Failed: see logs for details
Reason for failure: Setup was canceled for the feature.
Next Step: SQL Server Setup was canceled before completing the operation. Try the setup process again.

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20161201_135859\SystemConfigurationCheck_Report.htm

Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented

Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
Message:
There was an error generating the XML document.
HResult : 0x84b10001
FacilityCode : 1201 (4b1)
ErrorCode : 1 (0001)
Data:
DisableWatson = true
Stack:
at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.FlushCache(Boolean removeAllCachedObj)
at Microsoft.SqlServer.Chainer.Infrastructure.NotificationHandler.Invoke(Object notification, Object[] objectArray)
at Microsoft.SqlServer.Configuration.ConfigExtension.ConfigFeatureActionListener.InConfigurationActionExecutionEventHandler(ActionKey key, TextWriter loggingStream)
at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionMetadata.NotifyInExecution(ActionKey actionRunning, TextWriter loggingStream)
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()
at Microsoft.SqlServer.Chainer.TimingConfigAction.Execute(String actionId, TextWriter errorStream)
at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun, ServiceContainer context)
Inner exception type: System.InvalidOperationException
Message:
There was an error generating the XML document.
Stack:
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, XmlSerializerNamespaces namespaces)
at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
Inner exception type: System.Security.Cryptography.CryptographicException
Message:
Access is denied.

        Stack: 
                    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.XmlSerializationWriterSqlEngineSetupPublic.Write7_SqlEngineSetupPublic(String n, String ns, SqlEngineSetupPublic o, Boolean isNullable, Boolean needType)
                    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSqlEngineSetupPublic.Write8_SqlEngineSetupPublic(Object o)

strong text


#4

recipe is given bellow

Cookbook Name:: sqlserverinstall

Recipe:: default

node.default[:product][:folder] = "sqlserver/"
node.default[:product][:file] = "SQLFULL_ENU.iso"
node.default[:product][:extract] = '\SQLFULL_ENU\'
setupfile = node[:product][:location] + "\"
tarfile = node[:product][:location] + “\” + node[:product][:file]
responsefile = node[:product][:location] + “\ConfigurationFile.ini”

puts "#{node[‘machinename’]} ---- node[‘machinename’]"
puts "#{node[‘domain’]} – node[‘domainname’]"
puts “#{node[:sql][‘domain_user’]} – domain_user”

if (!(File.directory?(node[:sql][:installdir])))
include_recipe ‘downloader::default’
template node[:product][:location] + “\ConfigurationFile.ini” do
source "ConfigurationFile2012.ini.erb"
end
puts "Started Installing"
if (!(File.directory?(node[:product][:location] + “\setup.exe”)))
puts "unzipping #{tarfile} "
execute “7zip to unzip all packages” do
cwd node[:product][:location]
command "#{node[:zip][:installdir]}\7z x #{tarfile}"
not_if { ::File.exists?(node[:product][:location] + “\setup.exe”) }
end
else
puts "Already Unzipped files – skipping"
end
puts "#{setupfile}setup.exe /CONFIGURATIONFILE=’#{responsefile}’"
puts "CD to #{node[:product][:location]}"
execute “starting SQL Server #{node[:sql][:version]} installation on windows” do
cwd node[:product][:location]
command 'start /wait setup.exe /CONFIGURATIONFILE=“ConfigurationFile.ini” '
guard_interpreter :powershell_script
timeout 7200
returns [0, 42, 127, 3010]
sleep 7200
ignore_failure true
end

else
puts "Prodcut Installation found on server"
end


#5

What user is running the recipie and under what context is chef running (in a local console, via knife winrm, a service, etc)?

This issue is often the result of insufficient access rights of the account invoking the install,Make sure the account is a local administrator account. Try to avoid using a domain account since some have found this error to occur using a domain account.


#6

I’m using administrative account only . Please check following command
knife bootstrap windows winrm FQDN --winrm-user Administrator --winrm-password password --node-name nodename --run-list ‘recipe[sqlserverinstall]’ --msi-url http://local repo/repo/chef-client-12.16.42-1-x86.msi


#7

Ahh ok this makes sense now. Installing sqlserver is one of the few operations that will not run successfully over a normal winrm session. knife winrm provides an argument --winrm-shell elevated that creates a scheduled task to run the command in and makes it behave like a locally run command. Unfortunately knife bootstrap does not support this shell.

What you can do is bootstrap the node without a run list and then use knife winrm with --winrm-shell elevated to run chef-client and set the runlist to the sql installer.


#8

Thanks a lot, Your suggestion really helped.