Docker Community Forums

Share and learn in the Docker community.

Appcrash KERNELBASE.dll error when I try to use Microsoft Office in Docker Container

docker

(Georgyturevich) #1

Hello,

I’m building a Docker Windows container with Microsoft Office 2013 using following Dockerfile:

FROM microsoft/windowsservercore

## Setup package management.
ENV chocolateyUseWindowsCompression=false
RUN powershell -Command "iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex; Install-PackageProvider -Name chocolatey -Force"

## Installing office
RUN powershell choco install officeproplus2013 --version 15.0.4827 -y

ENTRYPOINT powershell

When I try to create Microsoft Word COM object from Powershell console

$Word = New-Object -ComObject Word.Application

I get following error after 30 seconds:

New-Object : Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT:
0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
At line:1 char:9
+ $Word = New-Object -ComObject Word.Application
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

The same command works fine when I install Office in the same way and try to execute it on the virtual machine created from Windows Server 2016 Base image on AWS.

In Windows Event log I see following records in Application logname:

Message            : Fault bucket 108441132345, type 1                                                                                                
                     Event Name: APPCRASH                                                                                                             
                     Response: Not available                                                                                                          
                     Cab Id: 0                                                                                                                        
                                                                                                                                                      
                     Problem signature:                                                                                                               
                     P1: WINWORD.EXE                                                                                                                  
                     P2: 15.0.4569.1504                                                                                                               
                     P3: 52c5eccd                                                                                                                     
                     P4: KERNELBASE.dll                                                                                                               
                     P5: 10.0.14393.206                                                                                                               
                     P6: 57dace38                                                                                                                     
                     P7: c06d007e                                                                                                                     
                     P8: 000da732                                                                                                                     
                     P9:                                                                                                                              
                     P10:                                                                                                                             
                                                                                                                                                      
                     Attached files:                                                                                                                  
                     \\?\C:\Windows\Temp\WER44FE.tmp.csv                                                                                              
                     \\?\C:\Windows\Temp\WER450F.tmp.txt                                                                                              
                                                                                                                                                      
                     These files may be available here:                                                                                               
                     C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_WINWORD.EXE_3ff88aa40f6b7d16af04dad69537b6eb893d5_9d40f520_e5f6451e  
                                                                                                                                                      
                     Analysis symbol:                                                                                                                 
                     Rechecking for solution: 0                                                                                                       
                     Report Id: facfa21b-edbb-402e-8916-3fbbcfe06244                                                                                  
                     Report Status: 4104                                                                                                              
					 
					 
					 EventID            : 1001
MachineName        : b68a674c1cba
Data               : {}
Index              : 418
Category           : (0)
CategoryNumber     : 0
EntryType          : Information
Message            : Fault bucket , type 0
                     Event Name: APPCRASH
                     Response: Not available
                     Cab Id: 0


                     Problem signature:
                     P1: WINWORD.EXE
                     P2: 15.0.4569.1504
                     P3: 52c5eccd
                     P4: KERNELBASE.dll
                     P5: 10.0.14393.206
                     P6: 57dace38
                     P7: c06d007e
                     P8: 000da732
                     P9:
                     P10:


                     Attached files:


                     These files may be available here:
                     C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_WINWORD.EXE_3ff88aa40f6b7d16af04dad69537b6eb893d5_9d40f520_ae0a41f1


                     Analysis symbol:
                     Rechecking for solution: 0
                     Report Id: facfa21b-edbb-402e-8916-3fbbcfe06244
                     Report Status: 4100
                     Hashed bucket:
Source             : Windows Error Reporting
ReplacementStrings : {, 0, APPCRASH, Not available...}
InstanceId         : 1001
TimeGenerated      : 12/5/2016 1:52:26 PM
TimeWritten        : 12/5/2016 1:52:26 PM
UserName           :
Site               :
Container          :








EventID            : 1000                                                                                                                                                                                         
MachineName        : b68a674c1cba                                                                                                                                                                                 
Data               : {}                                                                                                                                                                                           
Index              : 417                                                                                                                                                                                          
Category           : Application Crashing Events                                                                                                                                                                  
CategoryNumber     : 100                                                                                                                                                                                          
EntryType          : Error                                                                                                                                                                                        
Message            : Faulting application name: WINWORD.EXE, version: 15.0.4569.1504, time stamp: 0x52c5eccd                                                                                                      
                     Faulting module name: KERNELBASE.dll, version: 10.0.14393.206, time stamp: 0x57dace38                                                                                                        
                     Exception code: 0xc06d007e                                                                                                                                                                   
                     Fault offset: 0x000da732                                                                                                                                                                     
                     Faulting process id: 0x5ae4                                                                                                                                                                  
                     Faulting application start time: 0x01d24efecf6dbf33                                                                                                                                          
                     Faulting application path: C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.EXE                                                                                                      
                     Faulting module path: C:\Windows\System32\KERNELBASE.dll                                                                                                                                     
                     Report Id: facfa21b-edbb-402e-8916-3fbbcfe06244                                                                                                                                              
                     Faulting package full name:                                                                                                                                                                  
                     Faulting package-relative application ID:                                                                                                                                                    
Source             : Application Error                                                                                                                                                                            
ReplacementStrings : {WINWORD.EXE, 15.0.4569.1504, 52c5eccd, KERNELBASE.dll...}                                                                                                                                   
InstanceId         : 1000                                                                                                                                                                                         
TimeGenerated      : 12/5/2016 1:52:25 PM                                                                                                                                                                         
TimeWritten        : 12/5/2016 1:52:25 PM                                                                                                                                                                         
UserName           :                                                                                                                                                                                              
Site               :                                                                                                                                                                                              
Container          :                                                                                                                                                                                              


Content of the Report.wer file which was attached to the error event

Version=1
EventType=APPCRASH
EventTime=131254397111571055
ReportType=2
Consent=1
UploadTime=131254397117750833
ReportIdentifier=00af6f34-bb21-11e6-a94c-c1ade9024feb
IntegratorReportIdentifier=f48b4b89-7ac0-4b8b-8714-5827be5c2a54
WOW64=1
NsAppName=WINWORD.EXE
AppSessionGuid=000056c0-0390-0014-0d3e-cec22d4fd201
TargetAppId=W:0000da39a3ee5e6b4b0d3255bfef95601890afd80709!0000da39a3ee5e6b4b0d3255bfef95601890afd80709!WINWORD.EXE
TargetAppVer=2016//09//27:07:41:29!1e4b16!WINWORD.EXE
BootId=4294967295
Response.BucketId=294fbccdff50bb44d2891850764ece57
Response.BucketTable=1
Response.LegacyBucketId=108548871343
Response.type=4
Sig[0].Name=Application Name
Sig[0].Value=WINWORD.EXE
Sig[1].Name=Application Version
Sig[1].Value=15.0.4871.1000
Sig[2].Name=Application Timestamp
Sig[2].Value=57ea22a9
Sig[3].Name=Fault Module Name
Sig[3].Value=KERNELBASE.dll
Sig[4].Name=Fault Module Version
Sig[4].Value=10.0.14393.321
Sig[5].Name=Fault Module Timestamp
Sig[5].Value=57f4c291
Sig[6].Name=Exception Code
Sig[6].Value=c06d007e
Sig[7].Name=Exception Offset
Sig[7].Value=000da6f2
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=10.0.14393.2.0.0.400.8
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
DynamicSig[22].Name=Additional Information 1
DynamicSig[22].Value=2beb
DynamicSig[23].Name=Additional Information 2
DynamicSig[23].Value=2beba6fb4680d73a8c78ca7c24ccdb46
DynamicSig[24].Name=Additional Information 3
DynamicSig[24].Value=34b8
DynamicSig[25].Name=Additional Information 4
DynamicSig[25].Value=34b85e01dbe9529312a819250a584bb2
UI[2]=C:\Program Files\Microsoft Office 15\Root\Office15\WINWORD.EXE
UI[5]=Check online for a solution (recommended)
UI[6]=Check for a solution later (recommended)
UI[7]=Close
UI[8]=Microsoft Word stopped working and was closed
UI[9]=A problem caused the application to stop working correctly. Windows will notify you if a solution is available.
UI[10]=&Close
LoadedModule[0]=C:\Program Files\Microsoft Office 15\Root\Office15\WINWORD.EXE
LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\Windows\System32\KERNEL32.DLL
LoadedModule[3]=C:\Windows\System32\KERNELBASE.dll
LoadedModule[4]=C:\Windows\system32\apphelp.dll
LoadedModule[5]=C:\Program Files\Microsoft Office 15\Root\Office15\AppVIsvSubsystems32.dll
LoadedModule[6]=C:\Program Files\Microsoft Office 15\Root\Office15\MSVCR100.dll
LoadedModule[7]=C:\Windows\System32\ADVAPI32.dll
LoadedModule[8]=C:\Windows\System32\msvcrt.dll
LoadedModule[9]=C:\Program Files\Microsoft Office 15\Root\Office15\AppVIsvStream32.dll
LoadedModule[10]=C:\Windows\System32\sechost.dll
LoadedModule[11]=C:\Windows\System32\RPCRT4.dll
LoadedModule[12]=C:\Windows\System32\USER32.dll
LoadedModule[13]=C:\Program Files\Microsoft Office 15\Root\Office15\c2r32.dll
LoadedModule[14]=C:\Windows\System32\win32u.dll
LoadedModule[15]=C:\Windows\System32\SspiCli.dll
LoadedModule[16]=C:\Windows\System32\CRYPTBASE.dll
LoadedModule[17]=C:\Windows\System32\GDI32.dll
LoadedModule[18]=C:\Windows\System32\bcryptPrimitives.dll
LoadedModule[19]=C:\Windows\System32\gdi32full.dll
LoadedModule[20]=C:\Windows\System32\SHELL32.dll
LoadedModule[21]=C:\Windows\System32\cfgmgr32.dll
LoadedModule[22]=C:\Windows\SYSTEM32\USERENV.dll
LoadedModule[23]=C:\Windows\System32\windows.storage.dll
LoadedModule[24]=C:\Windows\System32\ucrtbase.dll
LoadedModule[25]=C:\Windows\System32\combase.dll
LoadedModule[26]=C:\Windows\System32\profapi.dll
LoadedModule[27]=C:\Windows\System32\powrprof.dll
LoadedModule[28]=C:\Windows\System32\shlwapi.dll
LoadedModule[29]=C:\Windows\System32\kernel.appcore.dll
LoadedModule[30]=C:\Windows\System32\shcore.dll
LoadedModule[31]=C:\Windows\System32\ole32.dll
LoadedModule[32]=C:\Windows\System32\oleaut32.dll
LoadedModule[33]=C:\Windows\System32\msvcp_win.dll
LoadedModule[34]=C:\Program Files\Microsoft Office 15\Root\Office15\wwlib.dll
LoadedModule[35]=C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.14393.321_none_baab3cb4359688b4\gdiplus.dll
LoadedModule[36]=C:\Program Files\Microsoft Office 15\Root\Office15\oart.dll
LoadedModule[37]=C:\Program Files\Microsoft Office 15\Root\Office15\MSVCP100.dll
LoadedModule[38]=C:\Windows\SYSTEM32\d2d1.dll
LoadedModule[39]=C:\Windows\SYSTEM32\CRYPT32.dll
LoadedModule[40]=C:\Windows\SYSTEM32\MSASN1.dll
LoadedModule[41]=C:\Program Files (x86)\Common Files\Microsoft Shared\Office15\mso.dll
LoadedModule[42]=C:\Windows\SYSTEM32\MSIMG32.dll
LoadedModule[43]=C:\Windows\SYSTEM32\WTSAPI32.dll
LoadedModule[44]=C:\Windows\SYSTEM32\WINSTA.dll
LoadedModule[45]=C:\Windows\SYSTEM32\dxgi.dll
LoadedModule[46]=C:\Windows\SYSTEM32\msi.dll
LoadedModule[47]=C:\Windows\SYSTEM32\bcrypt.dll
LoadedModule[48]=C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.14393.447_none_89c64d28dafea4b9\Comctl32.dll
LoadedModule[49]=C:\Program Files (x86)\Common Files\Microsoft Shared\Office15\MSPTLS.DLL
LoadedModule[50]=C:\Windows\SYSTEM32\UxTheme.dll
LoadedModule[51]=C:\Windows\SYSTEM32\d3d11.dll
LoadedModule[52]=C:\Windows\SYSTEM32\d3d10warp.dll
State[0].Key=Transport.DoneStage1
State[0].Value=1
FriendlyEventName=Stopped working
ConsentKey=APPCRASH
AppName=Microsoft Word
AppPath=C:\Program Files\Microsoft Office 15\Root\Office15\WINWORD.EXE
NsPartner=windows
NsGroup=windows8
ApplicationIdentity=BA43D6538E2E0AA779B61DB4AA39A3A7
MetadataHash=-627680739

I have read a lot of information. But most of solutions are about full Windows versions and are using mostly GUI.

I also tried to use following commands:

sfc /scannow

and

regsvr32 KERNELBASE.dll

But it did not help :frowning:

I would like to ask advice about what can be a reason of such error? How I can troubleshoot using Powershell remote connection to the Docker container?

Thank you in advance!

PS: Output of ‘docker version’ command:

Client:
 Version:      1.12.2-cs2-ws-beta
 API version:  1.25
 Go version:   go1.7.1
 Git commit:   050b611
 Built:        Tue Oct 11 02:35:40 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.12.2-cs2-ws-beta
 API version:  1.25
 Go version:   go1.7.1
 Git commit:   050b611
 Built:        Tue Oct 11 02:35:40 2016
 OS/Arch:      windows/amd64

(2opremio) #2

Did you manage to solve this? I am having the same problem (with Office 2016, docker 1.13 and microsoft/windowsservercore:10.0.14393.953).


(Georgyturevich) #3

Hi @2opremio

Yes. I sorted out this issue with help of procmon tool.

I installed Office 2013 on the host machine. Run procmon tool, started listening in procmon, run this ps comand
$Word = New-Object -ComObject Word.Application
stoped listening in procmon. So I took a list of all DLLs which were called during com object initialization. Then I checked if all these DLLs exist inside container and found that some were missing.

When I copied them to the container it started to work for me! Finally I am performing following command during image build

    copy-item "$configFolder\SPP.dll" "C:\Windows\SysWOW64\" -Force
    copy-item "$configFolder\AcGenral.dll" "C:\Windows\AppPatch\" -Force
    copy-item "$configFolder\SrClient.dll" "C:\Windows\SysWOW64\" -Force
    copy-item "$configFolder\hhctrl.ocx" "C:\Windows\SysWOW64\" -Force
    Regsvr32 /s "C:\Windows\SysWOW64\hhctrl.ocx"
    copy-item "$configFolder\edputil.dll" "C:\Windows\SysWOW64\" -Force
    copy-item "$configFolder\hlink.dll" "C:\Windows\SysWOW64\" -Force
    copy-item "$configFolder\MSACM32.dll" "C:\Windows\SysWOW64\" -Force

    # This DLLs are required for initializing Word COM objects
    copy-item "$configFolder\d3d10_1.dll" "C:\Windows\SysWOW64\" -Force
    copy-item "$configFolder\d3d10_1core.dll" "C:\Windows\SysWOW64\" -Force

If you use Office 2016 then it can be another list of DLLs or something else. But you can start with investigation with help of procmon utility.

I hope this information will help you!


(2opremio) #4

Fantastic! I will give that a try. Thanks a lot.


(2opremio) #5

Your tip got me further. After copying the following DLLs using your ProcMon suggestion …

C:/Windows/System32/ResourcePolicyClient.dll
C:/Windows/System32/d3d10_1.dll
C:/Windows/System32/d3d10_1core.dll
C:/Windows/System32/OnDemandConnRouteHelper.dll
C:/Windows/System32/dsreg.dll
C:/Windows/System32/rasadhlp.dll

WINWORD.exe doesn’t crash (tasklist shows it running happily), but I cannot create documents.

Documents.Open() results in an null document:

PS C:\> $Word = New-Object -ComObject Word.Application
PS C:\> New-Item example.txt



Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        3/30/2017  10:52 AM              0 example.txt


PS C:\> $Doc = $Word.Documents.Open('C:\example.txt')
PS C:\> $Doc
PS C:\>

Did you do anything else to get it to work?

I tried importing the following registry entry in order to tweak the DCOM permissions, but it didn’t help:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AppID\{00020906-0000-0000-C000-000000000046}]
@="Microsoft Word 97 - 2003 Document"
"AuthenticationLevel"=dword:00000001
"RunAs"="User Manager\\ContainerAdministrator"

(Georgyturevich) #6

Hi @2opremio

I see following commands after the MS office installation

    Log "Creating missing directories"
    mkdir -Force C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\
    mkdir -Force C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\INetCookies\
    mkdir -Force C:\Windows\SysWOW64\config\systemprofile\Documents
    mkdir -Force C:\Windows\SysWOW64\config\systemprofile\Desktop

As I remember I saw some strange error messages about missing directories in event logs.

Btw, did you see some errors in event logs (Get-EventLog, Get-WinEvent) ?


(2opremio) #7

That really helped, thanks a lot!

Yep, I did see some errors. But there a lot of other errors from seemingly unrelated Windows services (the microsoft/windowsservercore images don’t seem all that polished).


(2opremio) #8

@georgyturevich Did you manage to run Excel this way? If so, would you mind sharing your Dockerfile?

For me, Excel hangs when calling ExportAsFixedFormatsimilarly to https://stackoverflow.com/questions/25252451/excel-2013-com-api-hangs-exportasfixedformat-under-service-account

Here is a powershell script which reproduces the problem. It works when run on the host but hangs on $WB.ExportAsFixedFormat when run on a container:

$inputFile = 'C:\sample.xlsx'
$outputFile = 'C:\output.pdf'

$xlFixedFormat = 'Microsoft.Office.Interop.Excel.xlFixedFormatType' -as [type]
$Excel = New-Object -ComObject Excel.Application
$WB = $Excel.Workbooks.Open($inputFile)
$WB.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, $outputFile) 

You need to add your own C:\sample.xlsx for it to work.

I have tried to change the DCOM permissions, as suggested in the Stackoverflow comments, but there is no HKEY_CLASSES_ROOT\WOW6432Node\AppID\{00020812-0000-0000-C000-000000000046} nor HKEY_CLASSES_ROOT\AppID\{00020812-0000-0000-C000-000000000046} key.

Any help would be very highly appreciated. Thanks!


(Georgyturevich) #9

Hi @2opremio

Unfortunately, I had a task to convert only doc to pdf files and did not try to convert xls files. So can not help much there (

I would start with collecting DLLs list on the host during executing of your script and comparing this list with image dlls. Also it makes sense to check Get-WinEvents output when you run this script inside image.


(2opremio) #10

I have bad news. Get-WinEvent shows the following error when calling ExportAsFixedFormat inside the container:

TimeCreated                     Id LevelDisplayName Message
-----------                     -- ---------------- -------
6/27/2017 1:38:45 PM           300 Information      Microsoft Excel
                                                    No printers are installed. To install a printer click the File tab, and then click Print. Click No Printers
                                                    Installed, and then click Add Printer. Follow the instructions in the Add Printer dialog box.
                                                    P1: 100964
                                                    P2: 16.0.8201.2102
                                                    P3:
                                                    P4:

As I later confirmed using ProcMon in a windows Host, Excel’s ExportAsFixedFormat uses Window’s Microsoft Print to PDF printer. This printer (or any other printer for that matter) isn’t available in the container and I doubt it can be easily installed (for starters, Windows’ Spooler service is disabled and it fails to start after enabling it manually see https://stackoverflow.com/questions/41565459/windows-2016-docker-container-error ).

So, I am giving up. Unless someone has a an alternative to ExportAsFixedFormat or a way to add a printer to the container (which feels wrong) I will move my code out of the containers.


(Michael Friis) #11

This is an interesting use-case, but it’ll require changes to the Windows base-image. Would you mind opening an issue on the Microsoft Windows containers user-voice? https://windowsserver.uservoice.com/forums/304624-containers


(2opremio) #12

It’s already there https://windowsserver.uservoice.com/forums/304624-containers/suggestions/19686220-provide-office-support-for-containers . Please upvote!


(Lippertmarkus) #13

@2opremio Could you tell me what you did to get $Word.Documents.Open() working without returning a null object? I tried creating the directories like @georgyturevich explained in his response but this didn’t help for Word 2016.


(Anemmas) #14

Hi!

I’ve successfully exported a word document to PDF with the latest image of windows server core using word automation.
I’ve copied all the files @2opremio suggested to add.
Then I added the missing t2embed.dll in the Windows/System32 folder to make it work.


(Muxiao) #15

How did you make Spooler work?


(Anemmas) #16

Here are the first lines of my dockerfile

FROM microsoft/windowsservercore:1709

SHELL ["powershell"]

RUN Install-WindowsFeature Print-Server ; \
    Set-Service spooler -StartupType Automatic ; \
    Start-Service spooler ; \
    Get-Service spooler ; \
    Get-Printer