8. Troubleshooting
🧪 Quick checks
Run these first — they tell you where the problem is:
lsusb | grep -i yubi # is the key on USB?
systemctl status pcscd.socket # is the smartcard daemon running?
ykman info # can ykman talk to it?
gpg --card-status # can GnuPG talk to it?
gpg -K # ssb> = subkey on the YubiKey
echo $SSH_AUTH_SOCK # which SSH agent is used?
ssh-add -L # which keys does the agent offer?
ssh -vvv host # what happens during login?
The YubiKey is not found
gpg --card-status → No such device / Card not present
- Is
pcscdrunning?sudo systemctl enable --now pcscd.socket - Restart scdaemon:
gpgconf --kill scdaemon gpg --card-status - Let scdaemon use
pcscdinstead of its own USB driver — add to~/.gnupg/scdaemon.conf:
thendisable-ccidgpgconf --kill scdaemon. - Fedora: access denied from polkit → add the polkit rule from 1.2 step 4.
ykman works but gpg doesn’t (or the other way around)
Only one program can hold the card at a time. Kill the other one:
gpgconf --kill scdaemon # frees the card for ykman
OpenPGP / SSH through gpg-agent
❌ Wrong SSH agent
echo $SSH_AUTH_SOCK
| ✅ Good | ❌ Wrong |
|---|---|
/run/user/1000/gnupg/S.gpg-agent.ssh | /run/user/1000/keyring/ssh (GNOME Keyring) |
/run/user/1000/gcr/ssh (GNOME gcr, Fedora) | |
/tmp/ssh-XXXX/agent.NNNN (ssh-agent) |
Fix:
pkill ssh-agent
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
and make sure the lines from 5.9 are in your ~/.bashrc / ~/.zshrc.
❌ sign_and_send_pubkey: signing failed / agent refused operation
The agent doesn’t know which terminal to show the PIN prompt in:
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye
❌ ssh-add -L shows no cardno: key
- Is
enable-ssh-supportin~/.gnupg/gpg-agent.conf? Thengpgconf --kill gpg-agent. - Does
gpg --card-statusshow an Authentication key? If not, see 5.6.
❌ Server does not accept the key
Compare the key the agent offers with the one on the server:
gpg --export-ssh-key <KEYID> # on your computer
cat ~/.ssh/authorized_keys # on the server
In ssh -vvv host you want to see:
Offering public key: cardno:...
Server accepts key: cardno:...
Also check permissions on the server: ~/.ssh = 700, authorized_keys = 600.
❌ SSH uses the wrong key
Point IdentityFile at the right public key in ~/.ssh/config (see 5.10). Avoid IdentitiesOnly yes unless you need it.
PIN problems
| Problem | Fix |
|---|---|
| PIV PIN blocked | ykman piv access unblock-pin (needs the PUK) |
| PIV PIN and PUK blocked | ykman piv reset — ⚠️ deletes all PIV keys |
| OpenPGP PIN blocked | gpg --card-edit → admin → passwd → 2 (unblock, needs Admin PIN) |
| OpenPGP Admin PIN blocked | ykman openpgp reset — ⚠️ deletes all OpenPGP keys |
| FIDO2 PIN blocked | ykman fido reset — ⚠️ deletes all FIDO2 credentials (passkeys, SSH -sk keys) |
| See remaining tries | gpg --card-status (PIN retry counter), ykman piv info, ykman fido info |
This is why you keep a backup YubiKey and your PUK / Admin PIN offline.
← 7. Linux login · Overview · 9. Disk encryption and Git signing →