Seems like the --homedir is lost between gpgconf and gpg-connect-agent:
$ export GNUPGHOME=/tmp/foo $ gpgconf --list-dirs | grep agent-socket agent-socket:/run/user/1000/gnupg/d.e4eiyium4hwx3rfwiz5r1won/S.gpg-agent $ gpgconf --homedir=/tmp/bar --list-dirs | grep agent-socket agent-socket:/run/user/1000/gnupg/d.chpsd6ko5dz3abqx9h317bj5/S.gpg-agent $ gpgconf --homedir=/tmp/bar --create-socketdir $ test -d /run/user/1000/gnupg/d.chpsd6ko5dz3abqx9h317bj5 ; echo $? 0 $ gpgconf --homedir=/tmp/bar --launch gpg-agent gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 gpgconf: error running '/usr/bin/gpg-connect-agent NOP': General error $ strace -f -e trace=connect -- gpgconf --homedir=/tmp/bar --launch gpg-agent strace: Process 27236 attached [pid 27236] connect(3, {sa_family=AF_UNIX, sun_path="/run/user/1000/gnupg/d.e4eiyium4hwx3rfwiz5r1won/S.gpg-agent"}, 61) = -1 ENOENT (No such file or directory) [pid 27236] +++ exited with 1 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27236, si_uid=1000, si_status=1, si_utime=0, si_stime=0} --- gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1 gpgconf: error running '/usr/bin/gpg-connect-agent NOP': General error +++ exited with 1 +++ $ gpg --version gpg (GnuPG) 2.2.12 libgcrypt 1.8.4 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Home: /tmp/foo Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2