Short tip: GPG key generation failes - command get_passphrase failed: Operation cancelled

Recently I stumped upon the following error while creating GPG keys for signing self-created RPM packages :

1can't connect to `/home/su-rpmdev/.gnupg/S.gpg-agent': No such file or directory
2gpg-agent[14392]: command get_passphrase failed: Operation cancelled
3gpg: cancelled by user
4gpg: Key generation canceled.

For creating the RPM packages I created a dedicated user su-rpmdev - it was necessary to create GPG keys for this particular user.

I found the solution for this issue on the following website: [click me!]

(Note you should actually login console/ssh with this user, not sudo to it)

I used the su command to work in the context of the created service user - and that was that reason for this issue. After logging in using SSH creating the GPG keys was working like a charm.

Translations: