Skip to content

Runtime logs to stderr if libgssapi_krb5 is not available #126251

Closed

Description

@mus65

Description

Npgsql 10 started to use GSSAPI encryption for PostgreSQL by default . Npgsql will always try to use GSSAPI first and then fall back to another mechanism if it's not available.

If libgssapi_krb5 is not available on the system (like in the default chiseled containers) this unfortunately causes the runtime to write an error to stderr:

Cannot load library libgssapi_krb5.so.2 
Error: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory

This is coming from pal_gssapi.c.

There has been some discussion about this in npgsql/npgsql#6360 and npgsql apprently can't easily fix this.

This causes some confusion since you get an error on stderr that isn't actually a problem. Would it be an option for the runtime to just not log this message? Since the caller must deal with the TypeInitializationException anyway, I'm not sure this is even needed.

Reproduction Steps

see https://github.com/mus65/libgssapinotfound .

Clone and run:

docker build -t gssapi . && docker run --rm gssapi

Expected behavior

No messages are written to stderr.

Actual behavior

Messages are written to stderr:

Cannot load library libgssapi_krb5.so.2 
Error: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory

Regression?

No response

Known Workarounds

No response

Configuration

.NET 11 Preview 2

Other information

No response

Activity

  1. dotnet-policy-service commented on Mar 28, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung
    See info in area-owners.md if you want to be subscribed.

  2. dotnet-policy-service commented on Mar 28, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @karelz, @dotnet/ncl
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Mar 28, 2026
  4. added this to the 11.0.0 milestone on Mar 28, 2026
  5. wfurt commented on Mar 28, 2026

    @wfurt
    Member

    It would make sense to me. we should emit .NET event IMHO.

  6. dotnet-policy-service commented on Mar 30, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
    See info in area-owners.md if you want to be subscribed.

  7. added a commit that references this issue on Apr 14, 2026
    60815e7
  8. locked and limited conversation to collaborators on May 14, 2026
  9. added a commit that references this issue on Jul 15, 2026
    fd565cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions