I start gpg-agent.service with option --homedir to use my authen subkey, restart on-failure, gpg-agent work well, but if when I do push/pull/clone on remote repo, when gpg's asking for passphrase with pinentry-tty, I interrupt it with ^C constantly three times to make it fail.

The things go on, I keep doing other push/pull/clone and keep interrupting it and sometime gpg asks for second of new push/pull/clone with pinentry-tty but sometime just one time and it fails in mysterious way with the same message:

sign_and_send_pubkey: signing failed: agent refused operation

Because I had restart on-failure and pkill, if I start new shell, gpg-agent works again, the question is how to make gpg-agent never refusing its operation to sign and send pubkey (meaning ask for passphrase and doing its job).

I highly suspect that this is intended to force gpg-agent fail to protect its from exploit or something else.

Log from journal:

Dec 06 07:05:35 localhost gpg-agent[7042]: gpg-agent (GnuPG) 2.2.11 starting in supervised mode.
Dec 06 07:05:35 localhost gpg-agent[7042]: using fd 3 for browser socket (/run/user/1000/gnupg/S.gpg-agent.browser)
Dec 06 07:05:35 localhost gpg-agent[7042]: using fd 4 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Dec 06 07:05:35 localhost gpg-agent[7042]: using fd 5 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Dec 06 07:05:35 localhost gpg-agent[7042]: using fd 6 for extra socket (/run/user/1000/gnupg/S.gpg-agent.extra)
Dec 06 07:05:35 localhost gpg-agent[7042]: listening on: std=4 extra=6 browser=3 ssh=5
Dec 06 07:05:51 localhost gpg-agent[7042]: scdaemon[7072]: pcsc_establish_context failed: no service (0x8010001d)
Dec 06 07:05:52 localhost pinentry-tty[7075]: Remote error from secret service: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:05:52 localhost gpg-agent[7042]: Failed to lookup password for key s/<key_here> with secret service: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:05:52 localhost gpg-agent[7042]: cbreak failure, exiting
Dec 06 07:05:52 localhost gpg-agent[7042]: failed to unprotect the secret key: Invalid IPC response
Dec 06 07:05:52 localhost gpg-agent[7042]: failed to read the secret key
Dec 06 07:05:52 localhost gpg-agent[7042]: ssh sign request failed: Invalid IPC response <Pinentry>
Dec 06 07:05:55 localhost sshd[4285]: Received disconnect from 192.168.75.1 port 8202:11: disconnected by user
Dec 06 07:05:55 localhost sshd[4285]: Disconnected from user USER 192.168.75.1 port 8202
Dec 06 07:06:04 localhost gpg-agent[7042]: scdaemon[7072]: pcsc_establish_context failed: no service (0x8010001d)
Dec 06 07:06:05 localhost pinentry-tty[7148]: Remote error from secret service: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:06:05 localhost gpg-agent[7042]: Failed to lookup password for key s/<key_here> with secret service: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:06:31 localhost gpg-agent[7042]: failed to unprotect the secret key: No passphrase given
Dec 06 07:06:31 localhost gpg-agent[7042]: failed to read the secret key
Dec 06 07:06:31 localhost gpg-agent[7042]: ssh sign request failed: No passphrase given <GPG Agent>
Dec 06 07:06:40 localhost gpg-agent[7042]: can't connect my own socket: IPC connect call failed
Dec 06 07:06:40 localhost gpg-agent[7042]: this process is useless - shutting down
Dec 06 07:06:44 localhost gpg-agent[7042]: gpg-agent (GnuPG) 2.2.11 stopped
Dec 06 07:06:44 localhost gpg-agent[7042]: scdaemon[7072]: scdaemon (GnuPG) 2.2.11 stopped
Dec 06 07:06:44 localhost systemd[526]: gpg-agent.service: Control process exited, code=exited status=1
Dec 06 07:06:44 localhost systemd[526]: gpg-agent.service: Failed with result 'exit-code'.
Dec 06 07:06:44 localhost systemd[526]: gpg-agent.service: Service RestartSec=100ms expired, scheduling restart.
Dec 06 07:06:44 localhost systemd[526]: gpg-agent.service: Scheduled restart job, restart counter is at 1.

part of log that gpg-agent start refuse to do its job:

Dec 06 07:33:27 localhost pinentry-tty[12402]: Remote error from secret service: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:33:27 localhost gpg-agent[12397]: Failed to lookup password for key s/<key_here> with secret service: The name org.freedesktop.secrets was not provided by any .service files
Dec 06 07:33:27 localhost gpg-agent[12397]: cbreak failure, exiting
Dec 06 07:33:27 localhost gpg-agent[12397]: failed to unprotect the secret key: Invalid IPC response
Dec 06 07:33:27 localhost gpg-agent[12397]: failed to read the secret key
Dec 06 07:33:27 localhost gpg-agent[12397]: ssh sign request failed: Invalid IPC response <Pinentry>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.