Pieter Vogelaar
Pieter Vogelaar

Reputation: 405

Powershell is unable to load shared library 'libmi' for error message on Alpine linux 3.20 (arm64)

I have a Docker container for PowerShell on my laptop (MacBook Pro arm64) that runs this image:

FROM alpine:3.20

RUN apk update && \
    apk add --no-cache \
      openssh \
      powershell

The pwsh command to run PowerShell works fine. Also PowerShell remoting over SSH to a Windows Server works fine. But if a command produces an error I get the error that omi is unable to load.

/ # pwsh -Command "& { Invoke-Command -HostName <username>@<ipaddress> -ScriptBlock { Add-DnsServerResourceRecordA -Name 'foo1' -ZoneName 'my.zone' -IPv4Address '10.1.0.101' } }"
OperationStopped: Unable to load shared library 'libmi' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
Error loading shared library /usr/lib/powershell/libmi.so: No such file or directory
Error loading shared library /usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.7/libmi.so: No such file or directory
Error loading shared library libmi.so: No such file or directory
Error loading shared library /usr/lib/powershell/liblibmi.so: No such file or directory
Error loading shared library /usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.7/liblibmi.so: No such file or directory
Error loading shared library liblibmi.so: No such file or directory
Error loading shared library /usr/lib/powershell/libmi: No such file or directory
Error loading shared library /usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.7/libmi: No such file or directory
Error loading shared library libmi: No such file or directory
Error loading shared library /usr/lib/powershell/liblibmi: No such file or directory
Error loading shared library /usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.7/liblibmi: No such file or directory
Error loading shared library liblibmi: No such file or directory

If I run that same PowerShell command on the actual Windows Server directly, I get the error that I expect:

Add-DnsServerResourceRecordA: Failed to create resource record foo1 in zone my.zone on server domcon1.

The DNS record already exists, so this is a correct error message.

I would like to retrieve this error message in the Docker container. Is it possible to fix this?

Upvotes: 1

Views: 234

Answers (0)

Related Questions