In short, for some operations custom gpg path is ignored and automatically detected one is used. This totally breaks Qubes split-gpg, which use a wrapper around gpg to access keys isolated in another VM. Secret are available only through that wrapper, they are not stored in local keyring.
I'm not sure how many operations are affected, but I can reliably reproduce it with sending pgp-inline message with attachments.
Detailed steps to reproduce (log attached):
Bug number one: after this step, new key is generated locally (using /usr/bin/gpg2), even though alternative path is set in step 3 and that alternative gpg have access to already existing key for this identity. It can be also seen in enigmail log (it's 75F346B33ED2795E). Relevant key listing:
[user@disp9528 ~]$ gpg2 -K
/home/user/.gnupg/pubring.kbx
-----------------------------
sec rsa2048 2018-09-14 [SC] [expires: 2019-09-14]
4F0263E2ED38877B0BC3F7C2A09566B8EBC13766
uid [ultimate] Test <test123@localhost>
ssb rsa2048 2018-09-14 [E] [expires: 2019-09-14]
[user@disp9528 ~]$ qubes-gpg-client-wrapper -K test123@localhost
sec rsa2048 2016-04-18 [SC]
964C242A7D766E44D40DAFCB75F346B33ED2795E
uid [ unknown] test123 <test123@localhost>
ssb rsa2048 2016-04-18 [E]
Send operation aborted.
INV_SGNR 9 0x964C242A7D766E44D40DAFCB75F346B33ED2795E
FAILURE sign-encrypt 17
Logs says /usr/bin/gpg2 was used to access key accessible only via /usr/bin/qubes-gpg-client-wrapper.
I have also automated test for this, using dogtail to interact with Thunderbird. But it's probably useless when not running Qubes OS.
The problem here is that pEp doesn't consider the path to GnuPG configured in Enigmail. That is, as long as pEp is involved, it will use gpg, and it will create a secret key if no secret key is available.
The correct sequence for installing Enigmail with Qubes split-gpg must be:
Any other sequence of installation is bound to ending up in your "error" case by design.
This indeed works, thanks! It would be helpful to add this info near custom gpg path setting, specifically that: