microsoft / Windows-Containers

Welcome to our Windows Containers GitHub community! Ask questions, report bugs, and suggest features -- let's work together.
MIT License
423 stars 64 forks source link

Adding WinDbgX into a container, various errors. #515

Closed PipeItToDevNull closed 1 week ago

PipeItToDevNull commented 3 months ago

Related to #418, I am trying to install WinDbgX into a container, seen here: https://github.com/PipeItToDevNull/WinDbg-Container

In initial runs I received failures that seem to be Firewall related: https://github.com/PipeItToDevNull/WinDbg-Container/actions/runs/9939147273/job/27453119531

After attempting to enable the firewall I receive failures that, to me, mean the firewall cannot be turned on: https://github.com/PipeItToDevNull/WinDbg-Container/actions/runs/9939451743/job/27454051971

Would adding .appx packages just never work in containers?

ntrappe-msft commented 3 months ago

Hi @PipeItToDevNull, thanks for bringing up the Issue you're facing. Can you help us get more clarity on what you're trying to do? Do you want to install WinDbgX so you can debug an application inside the container? Or to debug the container itself?

PipeItToDevNull commented 3 months ago

Hi,

I am looking to containerize WinDbgX so that I can process dump files in a SaaS manner. My end goal would be to process BSOD dump files in this container.

PipeItToDevNull commented 2 months ago

This issue still persists, I have not made headway on this.

ntrappe-msft commented 2 months ago

We're triaging this Issue. Thanks for your patience.

johnstep commented 2 months ago

We are investigating the MSIX package installation issue. A workaround is to expand the archives:

# escape=`

FROM mcr.microsoft.com/windows/servercore:ltsc2022
SHELL ["powershell.exe", "-Command $ProgressPreference = 'SilentlyContinue';"]

# Download the MSIX package bundle.
RUN Invoke-WebRequest https://aka.ms/windbg/download -OutFile windbg.appinstaller; `
    Invoke-WebRequest ([xml](Get-Content windbg.appinstaller)).AppInstaller.MainBundle.Uri -OutFile bundle.zip; `
    Remove-Item windbg.appinstaller

# Expand the x64 package to the windbg directory.
RUN Expand-Archive bundle.zip; `
    Remove-Item bundle.zip; `
    Move-Item bundle\windbg_win7-x64.msix windbg.zip; `
    Remove-Item bundle -Recurse; `
    Expand-Archive windbg.zip; `
    Remove-Item windbg.zip
PipeItToDevNull commented 1 month ago

I attempted this method, and manually extracted the packages on my host to take a peak but it appears this installer does not include the required WinDbgX.exe. I am not sure where it could come from.

johnstep commented 1 month ago

I attempted this method, and manually extracted the packages on my host to take a peak but it appears this installer does not include the required WinDbgX.exe. I am not sure where it could come from.

The executable is actually DbgX.Shell.exe, while WinDbgX.exe is an app execution alias defined by the MSIX package. PowerShell does not show the reparse point target, but you can find it from the binary data:

PS C:\> (gcm WinDbgX).Source
C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\WinDbgX.exe

PS C:\> fsutil reparsePoint query (gcm WinDbgX).Source
Reparse Tag Value : 0x8000001b
Tag value: Microsoft

Reparse Data Length: 0x164
Reparse Data:
0000:  03 00 00 00 4d 00 69 00  63 00 72 00 6f 00 73 00  ....M.i.c.r.o.s.
0010:  6f 00 66 00 74 00 2e 00  57 00 69 00 6e 00 44 00  o.f.t...W.i.n.D.
0020:  62 00 67 00 5f 00 38 00  77 00 65 00 6b 00 79 00  b.g._.8.w.e.k.y.
0030:  62 00 33 00 64 00 38 00  62 00 62 00 77 00 65 00  b.3.d.8.b.b.w.e.
0040:  00 00 4d 00 69 00 63 00  72 00 6f 00 73 00 6f 00  ..M.i.c.r.o.s.o.
0050:  66 00 74 00 2e 00 57 00  69 00 6e 00 44 00 62 00  f.t...W.i.n.D.b.
0060:  67 00 5f 00 38 00 77 00  65 00 6b 00 79 00 62 00  g._.8.w.e.k.y.b.
0070:  33 00 64 00 38 00 62 00  62 00 77 00 65 00 21 00  3.d.8.b.b.w.e.!.
0080:  4d 00 69 00 63 00 72 00  6f 00 73 00 6f 00 66 00  M.i.c.r.o.s.o.f.
0090:  74 00 2e 00 57 00 69 00  6e 00 44 00 62 00 67 00  t...W.i.n.D.b.g.
00a0:  00 00 43 00 3a 00 5c 00  50 00 72 00 6f 00 67 00  ..C.:.\.P.r.o.g.
00b0:  72 00 61 00 6d 00 20 00  46 00 69 00 6c 00 65 00  r.a.m. .F.i.l.e.
00c0:  73 00 5c 00 57 00 69 00  6e 00 64 00 6f 00 77 00  s.\.W.i.n.d.o.w.
00d0:  73 00 41 00 70 00 70 00  73 00 5c 00 4d 00 69 00  s.A.p.p.s.\.M.i.
00e0:  63 00 72 00 6f 00 73 00  6f 00 66 00 74 00 2e 00  c.r.o.s.o.f.t...
00f0:  57 00 69 00 6e 00 44 00  62 00 67 00 5f 00 31 00  W.i.n.D.b.g._.1.
0100:  2e 00 32 00 34 00 30 00  37 00 2e 00 32 00 34 00  ..2.4.0.7...2.4.
0110:  30 00 30 00 33 00 2e 00  30 00 5f 00 78 00 36 00  0.0.3...0._.x.6.
0120:  34 00 5f 00 5f 00 38 00  77 00 65 00 6b 00 79 00  4._._.8.w.e.k.y.
0130:  62 00 33 00 64 00 38 00  62 00 62 00 77 00 65 00  b.3.d.8.b.b.w.e.
0140:  5c 00 44 00 62 00 67 00  58 00 2e 00 53 00 68 00  \.D.b.g.X...S.h.
0150:  65 00 6c 00 6c 00 2e 00  65 00 78 00 65 00 00 00  e.l.l...e.x.e...
0160:  30 00 00 00                                       0...
PipeItToDevNull commented 1 month ago

I dug into this as well and discovered that DbgX.Shell.exe is now the executable for WinDbg too, once it left Preview it seems. Sadly this new version removed the command line interface, making this effort of containerization useless. My systems still use the old version and I didnt stop to think that Microsoft would remove such basic functionality.

PipeItToDevNull commented 1 month ago

Another thread about how to do this https://github.com/microsoftfeedback/WinDbg-Feedback/issues/19#issuecomment-1537741148

johnstep commented 1 month ago

I dug into this as well and discovered that DbgX.Shell.exe is now the executable for WinDbg too, once it left Preview it seems. Sadly this new version removed the command line interface, making this effort of containerization useless. My systems still use the old version and I didnt stop to think that Microsoft would remove such basic functionality.

You can still find cdb.exe in Debugging Tools for Windows: https://learn.microsoft.com/windows-hardware/drivers/debugger/debugger-download-tools

PipeItToDevNull commented 1 week ago

Thank you so much for your support and suggested alternatives, the standard debugger does indeed install fine.

I hope to see the primary UWP applications working in containers in the future.