microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
381 stars 243 forks source link

New-BCContainer: MSSQL$SQLEXPRESS Error 17182 "Unable to initialize SSL support." #1074

Closed sasha-kuzmin closed 4 years ago

sasha-kuzmin commented 4 years ago

OS version: Windows 10 Enterprise 1809 (17763.12.17) Docker version: 2.3.0.3

Script:

$imageName = "mcr.microsoft.com/businesscentral/onprem:16.1.12629.12805-fi-ltsc2019"
$navcredential = New-Object System.Management.Automation.PSCredential -argumentList "admin", (ConvertTo-SecureString -String "*" -AsPlainText -Force)
$containerName = 'ppp'
New-BCContainer -accept_eula `
                 -imageName $imageName `
                 -containerName $containerName `
                 -dns '8.8.8.8' `
                 -useBestContainerOS `
                 -auth NavUserPassword `
                 -Credential $navcredential ` 
                 -updateHosts `
                 -locale 'fi-FI' `
        -alwaysPull `
                 -memoryLimit 6g `
                 -isolation hyperv `
        -licenseFile 'c:\x.flf'

Output:

NavContainerHelper is version 0.7.0.10
NavContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - ltsc2019
Docker Client Version is 19.03.8
Docker Server Version is 19.03.8
Removing container ppp
Removing C:\ProgramData\NavContainerHelper\Extensions\ppp
Using image mcr.microsoft.com/businesscentral/onprem:16.1.12629.12805-fi-ltsc2019
Creating Container ppp
Version: 16.1.12629.12805-fi
Style: onprem
Platform: 16.0.12630.12758
Generic Tag: 0.0.9.99
Container OS Version: 10.0.17763.973 (ltsc2019)
Host OS Version: 10.0.17763.1217 (ltsc2019)
A better Generic Container OS exists for your host (mcr.microsoft.com/dynamicsnav:10.0.17763.1217-generic)
Using generic image mcr.microsoft.com/dynamicsnav:10.0.17763.1217-generic
Generic Container OS Version: 10.0.17763.1217 (ltsc2019)
Generic Tag of better generic: 0.1.0.6
Using locale fi-FI
Using process isolation
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Files in C:\ProgramData\NavContainerHelper\Extensions\ppp\my:
- AdditionalOutput.ps1
- MainLoop.ps1
Creating container ppp from image mcr.microsoft.com/dynamicsnav:10.0.17763.1217-generic
6f7368a35a29fb5799a8a25f72552b97f0897579feca499e1255ad0cdabd59e1
Waiting for container ppp to be ready
Installing Business Central
Installing Url Rewrite
Installing OpenXML
Installing DotNetCore
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
Copying Web Client Files
Copying Client Files
Copying ModernDev Files
Copying PowerShell Scripts
Copying Test Assemblies
Copying Applications
Copying ReportBuilder
Changing Database Server Collation to Finnish_Swedish_100_CI_AS
Copying Cronus database
**A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections (provider: TCP Provider, error: 0 - The remote computer refused the network connection.)**
at <ScriptBlock>, C:\Run\navinstall.ps1: line 165
at <ScriptBlock>, C:\Run\start.ps1: line 209
at <ScriptBlock>, <No file>: line 1
Initialization of container ppp failed
At C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper\0.7.0.10\ContainerHandling\Wait-NavContainerReady.ps1:44 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...larputki failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container ppp failed

EventLog Errors: (1) Event ID 17182 from source MSSQL$SQLEXPRESS The following information was included with the event: 139f 80 Unable to initialize SSL support. The group or resource is not in the correct state to perform the requested operation. The request is not supported (2) ID 17182 from source MSSQL$SQLEXPRESS The following information was included with the event: 139f 1 Initialization failed with an infrastructure error. Check for previous errors. The group or resource is not in the correct state to perform the requested operation. The request is not supported (3) Event ID 17826 from source MSSQL$SQLEXPRESS (4) Event ID 17120 from source MSSQL$SQLEXPRESS If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: FRunCommunicationsManager The request is not supported

sasha-kuzmin commented 4 years ago

New-NAVContainer version that works fine for me:

$imageName = "mcr.microsoft.com/businesscentral/onprem:16.1.12629.12805-fi-ltsc2019"
$navcredential = New-Object System.Management.Automation.PSCredential -argumentList "admin", (ConvertTo-SecureString -String "*" -AsPlainText -Force)
$containerName = 'ppp'
new-navcontainer -accept_eula `
                -containername $containerName `
                -auth NavUserPassword `
                -credential $navcredential `
                -imageName $imageName `
                -updatehosts `
                -isolation hyperv `
                -alwayspull

Thanks in advance.

freddydk commented 4 years ago

There are a lot of differences in the two. In the first sample, you have a space after the ` character after $navcredential This means that the remaining parameters are ignored. You are also running -useBestContainerOS (to replatform in order to run process isolation) and then -isolation hyperv.

With the latest navcontainerhelper (from today) there is a function called New-BcContainerWizard which will help you generate the script you need.

based on what I can see above - you probably should run:

$artifactUrl = Get-BCArtifactUrl -type OnPrem -country fi -version 16.1.12629.12805 -select Closest
$navcredential = New-Object System.Management.Automation.PSCredential -argumentList "admin", (ConvertTo-SecureString -String "*" -AsPlainText -Force)
$containerName = 'ppp'
New-BCContainer `
    -accept_eula `
    -containerName $containerName `
    -updateHosts `
    -artifactUrl $artifactUrl `
    -auth UserPassword `
    -Credential $navcredential

note - using artifacts instead of images (see the latest blog posts on https://freddysblog.com for more info.)

sasha-kuzmin commented 4 years ago

Hi Freddy, thanks for feedback and noting this extra space.

Actually the first script has had multiple variations, e.g. with and without -credential (e.g. using windows auth), -useBestContainerOS, -isolation, -dns, but at the end of the day the result was the same - SQLEXPRESS error while copying database, with the 4 errors in the event log. The solution with New-NavContainer was found after I have posted the issue already. Based on New-NavContainer output I could assume that it generates self-signed certificate, that could be used for SSL support potentially, while New-BCContainer does not (or does it silently)

Here is the result of execution latest update:

$artifactUrl = Get-BCArtifactUrl -type OnPrem -country fi -version 16.1.12629.12805 -select Closest
$navcredential = New-Object System.Management.Automation.PSCredential -argumentList "admin", (ConvertTo-SecureString -String "*" -AsPlainText -Force)
$containerName = 'ppp'
New-BCContainer `
    -accept_eula `
    -containerName $containerName `
    -updateHosts `
    -artifactUrl $artifactUrl `
    -auth UserPassword `
    -Credential $navcredential
NavContainerHelper is version 0.7.0.11
NavContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - ltsc2019
Docker Client Version is 19.03.8
Docker Server Version is 19.03.8
Removing container ppp
Removing ppp from host hosts file
Removing C:\ProgramData\NavContainerHelper\Extensions\ppp
Using image mcr.microsoft.com/dynamicsnav:10.0.17763.1217-generic
Downloading application artifact /onprem/16.1.12629.12805/fi
Downloading C:\Users\alekuz\AppData\Local\Temp\f957ca42-cd61-43e6-8145-08020223ea16.zip
Unpacking application artifact to tmp folder
Renaming tmp folder
Downloading platform artifact /onprem/16.1.12629.12805/platform
Downloading C:\Users\alekuz\AppData\Local\Temp\40df7ad8-fe9d-4957-9c8c-6147bbc06083.zip
Retrying download...
Downloading C:\Users\alekuz\AppData\Local\Temp\40df7ad8-fe9d-4957-9c8c-6147bbc06083.zip
Unpacking platform artifact to tmp folder
Renaming tmp folder
Trying to get exclusive access to c:\bcartifacts.cache\onprem\16.1.12629.12805\platform-tmp - waiting 10 seconds and retrying...
Renaming tmp folder
Downloading Prerequisite Components
Downloading c:\bcartifacts.cache\onprem\16.1.12629.12805\platform\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi
Downloading c:\bcartifacts.cache\onprem\16.1.12629.12805\platform\Prerequisite Components\Microsoft Report Viewer 2015\ReportViewer.msi
Downloading c:\bcartifacts.cache\onprem\16.1.12629.12805\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
Downloading c:\bcartifacts.cache\onprem\16.1.12629.12805\platform\Prerequisite Components\Microsoft Report Viewer 2015\SQLSysClrTypes.msi
Downloading c:\bcartifacts.cache\onprem\16.1.12629.12805\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
Creating Container ppp
Version: 16.1.12629.12805-fi
Style: onprem
Generic Tag: 0.1.0.6
Container OS Version: 10.0.17763.1217 (ltsc2019)
Host OS Version: 10.0.17763.1217 (ltsc2019)
Using locale fi-FI
Using process isolation
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Files in C:\ProgramData\NavContainerHelper\Extensions\ppp\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container ppp from image mcr.microsoft.com/dynamicsnav:10.0.17763.1217-generic
7d01799420d01a3f12eaab2361074889999376b685f61bce0f4d3cf0b80ce17e
Waiting for container ppp to be ready
Using artifactUrl https://bcartifacts.azureedge.net/onprem/16.1.12629.12805/fi
Copying Platform Artifacts
Copying Application Artifacts
Copying Database
Copy Licensefile
Copying Installers
Copying Applications
Access to the path 'C:\$tmp$' is denied.
at <ScriptBlock>, C:\Run\start.ps1: line 186
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts.azureedge.net/onprem/16.1.12629.12805/fi
Copying Platform Artifacts
Copying Application Artifacts
Copying Database
Copy Licensefile
Copying Installers
Copying Applications
Access to the path 'C:\$tmp$' is denied.
at <ScriptBlock>, C:\Run\start.ps1: line 186
at <ScriptBlock>, <No file>: line 1
Initialization of container ppp failed
At C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper\0.7.0.11\ContainerHandling\Wait-NavContainerReady.ps1:44 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...ppp failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container ppp failed

Thanks for your help, Sasha.

freddydk commented 4 years ago

Does the problem still exist?

sasha-kuzmin commented 4 years ago

I have solved the problem by using New-NavContainer. Cannot reproduce the test now. I could try tomorrow or you can close the issue just.

Thank you for your help, Sasha.