If SSH operations have been attempted while the OpenPGP card is unplugged
scdaemon may need to be restarted for it to recover the key.
The card reader is a PC/SC compatible Todos Argos Mini II reader. Driver source
0. gpg-agent running with --enable-ssh-support
- card inserted
[shows SSH key]
- remove card
[shows no keys]
- insert card
[still shows no keys]
- Other operations such as "gpg --clearsign" still finds the card and is
successful. But it appears gpg now bypasses the agent and accesses the card
- Restart scdaeon
pkill -9 scdaemon; pkill -HUP gpg-agent
[now finds key again]
If the same is done, but skipping "ssh-add -L" in step 2 the nscdaemon finds the
card again, and the pin cache is cleared just like expected.
In this broken state .gnupg/reader_0.status reports "ACTIVE".
Also pcsc-wrapper is no longer running when this happens.
pcsc_scan properly identifies the card as removed / inserted OpenPGP.
Last lines of the logs says:
scdaemon: PC/SC RESET failed: no smartcard (0xffffffff8010000c)
scdaemon: no supported card application found: General error
gpg-agent: error getting serial number of card: General error
gpg-agent: ssh request handler for request_identities (11) ready
and scdaemon closes the connection to pcsc-wrapper.