Skip to content

Necessary permissions in docker using a rootless user for dotnet-* tools #2102

@DOMZE

Description

@DOMZE

Hello,

I'm using the dotnet-dump / dotnet-trace within a docker container, engine running in WSL2, using a rootless user.

dotnet-dump
In my docker file, I added CAP_SYS_PTRACE capabilities to createdump using setcap CAP_SYS_PTRACE=+eip $(find /usr/share -name createdump)
I also start my container with --cap-add=SYS_PTRACE

Once I did that I was able to get passed the error Core dump generation FAILED 0x80004005 due to PTrace(ATTACH, 1) FAILED Operation not permitted

However now I'm getting the error
/usr/share/dotnet/shared/Microsoft.NETCore.App/5.0.4/createdump: error while loading shared libraries: libmscordaccore.so: cannot open shared object file: No such file or directory

chowing recursively the directory /usr/share/dotnet/shared/Microsoft.NETCore.App to a group where my user is in also has no impact.

is root absolutely necessary to create dumps? If this is the case, is running a side-car container my only option to be able to generate dumps if my main application container runs under a rootless user?

dotnet-trace
Using the same rootless user, if I try to create a trace, I get the following error:

No profile or providers specified, defaulting to trace profile 'cpu-sampling'

Provider Name                           Keywords            Level               Enabled By
Microsoft-DotNETCore-SampleProfiler     0x0000F00000000000  Informational(4)    --profile
Microsoft-Windows-DotNETRuntime         0x00000014C14FCCBD  Informational(4)    --profile

[ERROR] System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Diagnostics.Tools.Trace.CollectCommandHandler.Collect(CancellationToken ct, IConsole console, Int32 processId, FileInfo output, UInt32 buffersize, String providers, String profile, TraceFileFormat format, TimeSpan duration, String clrevents, String clreventlevel, String name, String diagnosticPort) in /_/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs:line 163

what permissions is necessary to capture tracing using a rootless user?

Thank you!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions