FATAL "Mixlib ShellOut CommandTimeout" on Chef Windows/knife winrm when installing SQL Server

I see that other people have experience this same issue, but I don’t see a resolution I can readily adopt.

Getting “FATAL: Mixlib::ShellOut::CommandTimeout: dsc_script[InstallSQLServer] (SQLServer::sqlserver line 28) had an error: Mixlib::ShellOut::CommandTimeout: command timed out” when trying to use DSC to install SQL Server. As expected, this takes a fair amount of time to complete.

I’ve already bumped up the winrm command timeout to 300000, which does not seem to have any effect (this seems to be something in the Chef client, not WinRM, that’s triggering the timeout).

How do I set the Mixlib::ShellOut::CommandTimeout value?

MYSERVER.mydomain.com [2016-06-17T13:30:17-07:00] INFO: Processing windows_task[chef-client] action create (SQLServer::default line 7)
MYSERVER.mydomain.com [2016-06-17T13:30:18-07:00] INFO: windows_task[chef-client] task created
MYSERVER.mydomain.com [2016-06-17T13:30:18-07:00] INFO: Processing dsc_script[NetFramework35Core] action run (SQLServer::sqlserver line 7)
MYSERVER.mydomain.com [2016-06-17T13:30:41-07:00] INFO: Processing dsc_script[NetFramework45Core] action run (SQLServer::sqlserver line 18)
MYSERVER.mydomain.com [2016-06-17T13:30:46-07:00] INFO: Processing dsc_script[InstallSQLServer] action run (SQLServer::sqlserver line 28)
MYSERVER.mydomain.com [2016-06-17T13:40:56-07:00] ERROR: DSC operation failed: command timed out:
MYSERVER.mydomain.com ---- Begin output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com STDOUT:
MYSERVER.mydomain.com STDERR:
MYSERVER.mydomain.com ---- End output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com
MYSERVER.mydomain.com ProcessId: 1016
MYSERVER.mydomain.com app_name: C:\Windows\System32\WindowsPowerShell\v1.0\/powershell.exe
MYSERVER.mydomain.com command_line: powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 }
MYSERVER.mydomain.com timeout: 600
MYSERVER.mydomain.com
MYSERVER.mydomain.com
MYSERVER.mydomain.com ================================================================================
MYSERVER.mydomain.com Error executing action `run` on resource 'dsc_script[InstallSQLServer]'
MYSERVER.mydomain.com ================================================================================
MYSERVER.mydomain.com
MYSERVER.mydomain.com Mixlib::ShellOut::CommandTimeout
MYSERVER.mydomain.com --------------------------------
MYSERVER.mydomain.com command timed out:
MYSERVER.mydomain.com ---- Begin output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com STDOUT:
MYSERVER.mydomain.com STDERR:
MYSERVER.mydomain.com ---- End output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com
MYSERVER.mydomain.com ProcessId: 1016
MYSERVER.mydomain.com app_name: C:\Windows\System32\WindowsPowerShell\v1.0\/powershell.exe
MYSERVER.mydomain.com command_line: powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 }
MYSERVER.mydomain.com timeout: 600
MYSERVER.mydomain.com
MYSERVER.mydomain.com Resource Declaration:
MYSERVER.mydomain.com ---------------------
MYSERVER.mydomain.com # In c:/chef/cache/cookbooks/SQLServer/recipes/sqlserver.rb
MYSERVER.mydomain.com
MYSERVER.mydomain.com  28: dsc_script 'InstallSQLServer' do
MYSERVER.mydomain.com  29:   command 'c:\temp\installSQL.ps1'
MYSERVER.mydomain.com  30: end
MYSERVER.mydomain.com
MYSERVER.mydomain.com Compiled Resource:
MYSERVER.mydomain.com ------------------
MYSERVER.mydomain.com # Declared in c:/chef/cache/cookbooks/SQLServer/recipes/sqlserver.rb:28:in `from_file'
MYSERVER.mydomain.com
MYSERVER.mydomain.com dsc_script("InstallSQLServer") do
MYSERVER.mydomain.com   action [:run]
MYSERVER.mydomain.com   retries 0
MYSERVER.mydomain.com   retry_delay 2
MYSERVER.mydomain.com   default_guard_interpreter :default
MYSERVER.mydomain.com   declared_type :dsc_script
MYSERVER.mydomain.com   cookbook_name "SQLServer"
MYSERVER.mydomain.com   recipe_name "sqlserver"
MYSERVER.mydomain.com   command "c:\\temp\\installSQL.ps1"
MYSERVER.mydomain.com end
MYSERVER.mydomain.com
MYSERVER.mydomain.com Platform:
MYSERVER.mydomain.com ---------
MYSERVER.mydomain.com x64-mingw32
MYSERVER.mydomain.com
MYSERVER.mydomain.com
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] INFO: Running queued delayed notifications before re-raising exception
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] ERROR: Running exception handlers
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] ERROR: Exception handlers complete
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
MYSERVER.mydomain.com [2016-06-17T13:40:57-07:00] FATAL: Mixlib::ShellOut::CommandTimeout: dsc_script[InstallSQLServer] (SQLServer::sqlserver line 28) had an error: Mixlib::ShellOut::CommandTimeout: command timed out:
MYSERVER.mydomain.com ---- Begin output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com STDOUT:
MYSERVER.mydomain.com STDERR:
MYSERVER.mydomain.com ---- End output of powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 } ----
MYSERVER.mydomain.com
MYSERVER.mydomain.com ProcessId: 1016
MYSERVER.mydomain.com app_name: C:\Windows\System32\WindowsPowerShell\v1.0\/powershell.exe
MYSERVER.mydomain.com command_line: powershell.exe -executionpolicy bypass -noprofile -noninteractive -command "trap [Exception] {write-error -exception ($_.Exception.Message);exit 1};$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path C:/Users/username/AppData/Local/Temp/chef-dsc-script20160617-2676-15966zi -wait -erroraction 'continue' -force
MYSERVER.mydomain.com    4> 'C:/Users/username/AppData/Local/Temp/verbose20160617-2676-1wcx3co'";if ( ! $? ) { exit 1 }
MYSERVER.mydomain.com timeout: 600
ERROR: Failed to execute command on MYSERVER.mydomain.com return code 1

dsc_script has a timeout property that you can set to the number of seconds it’ll wait.

https://docs.chef.io/resource_dsc_script.html

@Steven_Murawski just tested and confirmed that works. I cannot believe it was that simple. Where is the “buy Steven his beverage of choice” button in this thing?! :smiley:

Big thanks. Apologies for the stupid question - the Mixlib::ShellOut::CommandTimeout and then digging around in the forums sent me in a totally different direction.