I have a Yubikey and imported my GPG keys onto it, but then my computer wouldn’t let me sign without the Yubikey any more. It would give me things like:

gpg: public key decryption failed: Card error
gpg: decryption failed: No secret key


gpg: deleting secret subkey failed: Not possible with a card based key

When I was trying to delete it and reimport it from a backup. The only thing that worked is something mentioned in the mailing list, namely deleting my private key from the /.gnupg/private-keys-v1.d directory.

The way I found which one it was was that I ran:

grep shadowed *

and the key stub that had been moved on the smart card (Yubikey) was the one that matched. I deleted that one and reimported it and now it works fine.