Troubleshooting Issues with GPG

Applicable Products

1. GPG does not detect the YubiKey

If gpg --card-status does not return information about your key as expected (e.g. you receive the error message “no such device”), follow the sections below to troubleshoot.

YubiKey Troubleshooting

  1. Using YubiKey Manager, ensure that either CCID (if you have a YubiKey 4 Series or NEO) or OpenPGP (if you have a YubiKey 5 Series) is checked under Interfaces. Security Key Series devices do not support OpenPGP (see Applicable Products above).

  2. Remove and reinsert the YubiKey. Sometimes, the GPG agent does not correctly detect if the YubiKey is plugged in.

  3. Force GPG agent to restart by running gpgconf --kill gpg-agent in Command Prompt (Windows) or Terminal (macOS / Linux).

GPG Options

If GPG is still not detecting the YubiKey, you may need to change some of GPG’s options. Using a text editor, add the line “reader-port Yubico Yubikey” (if you have a YubiKey 4 Series or NEO), or "reader-port Yubico Yubi" (if you have a YubiKey 5 Series), without quotes, to the scdaemon.conf file. If the file does not exist, create it.

  • On Windows, the path to this file is: %APPDATA%\gnupg\scdaemon.conf

  • On macOS and Linux, the path to this file is: ~/.gnupg/scdaemon.conf

After making this change, reboot your computer to ensure it takes affect. 

Additional Troubleshooting

If you are running a distribution of Linux that uses systemd, you may need to start and enable the pcsc daemon, which can be done by running the following commands.

#systemctl start pcscd
#systemctl enable pcscd

2. Failure when importing OpenPGP key into YubiKey

If you run keytocard under the gpg --card-edit feature and it fails, this usually indicates you are using a large key (4096bit) and an older version of GPG. For large keys you need to use GPG v2.0 or newer which you can verify by running gpg --version. On some systems, both GPG v1.x and GPG v2.x exist simultaneously and you need to access GPG v2 by running gpg2 instead of gpg.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.