powershell - 为什么使用 Chocolatey/PowerShell DSC 时 OpenSSL 安装会挂起?

标签 powershell azure openssl dsc chocolatey

我正在尝试使用以下 Powershell DSC 脚本从 Chocolatey 安装 OpenSSL:

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

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

使用 ARM 模板中的 Powershell DSC 扩展将此 DSC 推送到 Azure 中的新 VM。 问题是 OpenSSL 无提示安装程序挂起并且不允许 DSC 完成。以下是 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...

我尝试获取 OpenSSL Light 安装过程的内存转储。以下是DebugDiag分析结果:

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. 

知道是什么原因造成的吗?我可以在虚拟机上本地运行 DSC,但不能通过 Powershell DSC 扩展。 是否有解决方法或更好的方法来使用 DSC 静默安装 OpenSSL?

提前致谢。

最佳答案

由于 Powershell DSC 是由本地配置管理器在 SYSTEM 帐户下运行的,因此默认的 choco 缓存目录访问存在问题。我能够通过设置自定义 choco 缓存路径来解决此问题。更多信息请点击:https://github.com/chocolatey/choco/wiki/How-To-Change-Cache

关于powershell - 为什么使用 Chocolatey/PowerShell DSC 时 OpenSSL 安装会挂起?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37036907/

相关文章:

azure - 如何在 Pyspark 中关闭值中的科学记数法?

c - Valgrind:禁用条件跳转(或整个库)检查

php - cURL 出现 SSL 依赖错误 libssl.so Ubuntu 32 位中需要 libcrypto.so

arrays - Powershell 字节数组到 INT

powershell - 使用通用参数在本地或远程执行Powershell脚本

azure - 如何避免键查找

c - 如何在已安装 OpenSSL 的 Linux 中使用 BoringSSL?

html - azure 上的无服务器 PowerShell 脚本返回 html 以在浏览器中显示

powershell - 导入Csv,更改1个字段,然后导出

.net - 转义 Azure 存储 Blob 名称的正确方法