I use pam_gnupg to start gpg-agent. (Generally, that works well on Devuan system) But when the agent need to query for passphrase, it fails as pinentry fails to read .Xauthority.
I use pinentry-qt but I also had it with other pinentry.
The strange thing is, when I kill the agent and start it manually (or in xinit), it works well and pinentry has no troubles.
I already try with disabled caps-use-flag but without any success.
I checked the gpg-agent and environment, user, rights and caps are fully correct. I cannot find differences to when I start it manually.
My system does not use elogind. The file itself is reachable and accessable by my own user.
Steps to Reproduce:
1. Start gpg-agent via pam (Not manually!)
2. Try to use a key that is in agent
It fails and when straced, you can see that pinentry cannot access the .Xauthority file.
It shows a pinentry window
Gentoo does not support pam_gnupg, therefore all possible failures are on you.