3
votes

I am trying to install OpenSSL from Chocolatey using following Powershell DSC script:

cChocoInstaller installChoco
{
    InstallDir = "c:\choco"
}           

cChocoPackageInstaller installOpenSSL
{
    Name = "openssl.light"
    DependsOn = "[cChocoInstaller]installChoco"
}

This DSC is pushed to a new VM in Azure using Powershell DSC extension in an ARM template. The problem is that the OpenSSL silent installer hangs and does not let the DSC to complete. Following is the log from Chocolatey:

2016-05-04 19:15:22,254 [INFO ] - Installing the following packages:
2016-05-04 19:15:22,270 [INFO ] - openssl.light
2016-05-04 19:15:22,270 [INFO ] - By installing you accept licenses for the packages.
2016-05-04 19:15:29,067 [INFO ] - 
OpenSSL.Light v1.0.2.20160504 (forced)
2016-05-04 19:15:29,130 [DEBUG] - Contents of 'c:\choco\lib\OpenSSL.Light\tools\chocolateyInstall.ps1':
2016-05-04 19:15:29,161 [DEBUG] - $packageId = 'OpenSSL.Light'

#default is to plop in c:\ -- yuck!
$installDir = Join-Path $Env:ProgramFiles 'OpenSSL'

$params = @{
  packageName = $packageId;
  fileType = 'exe';
  #InnoSetup - http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
  silentArgs = '/silent', '/verysilent', '/sp-', '/suppressmsgboxes',
    "/DIR=`"$installDir`"";
  url = 'https://slproweb.com/download/Win32OpenSSL_Light-1_0_2h.exe'
  url64bit = 'https://slproweb.com/download/Win64OpenSSL_Light-1_0_2h.exe'
}

Install-ChocolateyPackage @params

if (!$Env:OPENSSL_CONF)
{
  $configPath = Join-Path $installDir 'bin\openssl.cfg'

  if (Test-Path $configPath)
  {
    [Environment]::SetEnvironmentVariable(
      'OPENSSL_CONF', $configPath, 'User')

    Write-Output "Configured OPENSSL_CONF variable as $configPath"
  }
}

2016-05-04 19:15:29,177 [DEBUG] - Calling command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'c:\choco\helpers\chocolateyInstaller.psm1'; & 'c:\choco\helpers\chocolateyScriptRunner.ps1' -packageScript 'c:\choco\lib\OpenSSL.Light\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters ''"']
2016-05-04 19:15:31,404 [INFO ] -  Downloading OpenSSL.Light 64 bit
2016-05-04 19:15:31,404 [INFO ] -    from 'https://slproweb.com/download/Win64OpenSSL_Light-1_0_2h.exe'
2016-05-04 19:15:40,526 [INFO ] -  Installing OpenSSL.Light...

I tried to take a memory dump of the OpenSSL Light Setup process. Following is the result of DebugDiag analysis:

Error    

Description Recommendation 

The following threads in OpenSSL.LightInstall.DMP are displaying a message box. The call to display the message box originated from OpenSSL_LightInstall+9745.

The text of the message being displayed is:
The system cannot find the path specified.


( 0 )

100.00% of threads blocked (1 threads)

 Server-side applications should not have any UI elements since they are supposed to run without any user intervention. Moreover, service applications run in non-interactive desktops, so no one can actually see the message box and dismiss it. This causes the application to hang.

Please follow up with vendor OpenSSL Win64 Installer Team  for problem resolution concerning the following file: C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Temp\chocolatey\OpenSSL.Light\1.0.2.20160504\OpenSSL.LightInstall.exe. 

Any idea what is causing this? I am able to run the DSC locally on the VM, only not via Powershell DSC extension. Is there a workaround or better way to install OpenSSL silently using DSC?

Thanks in advance.

2

2 Answers

2
votes

Since Powershell DSC was running by Local Configuration Manager under SYSTEM account, there was an issue with the default choco cache directory access. I was able to resolve this issue by setting a custom choco cache path. More information here: https://github.com/chocolatey/choco/wiki/How-To-Change-Cache

0
votes

Are you possibly running into memory issues? Does this call happen over WinRM and/or PowerShell remoting?