Using Debian Jessie and GnuPG 2, each time I try to use GnuPG 2 (gpg2) or gpg-connect-agent together with an OpenPGP smartcard (in my case a YubiKey), the operation fails with a message$ gpg-connect-agent --hex scd apdu 00 f1 00 00 /byeERR 67108983 No SmartCard daemon <GPG Agent>$ gpg2 --card-statusERR 67108983 No SmartCard daemon <GPG Agent>When using the legacy GnuPG 1 (gpg), everything works fine.What's going wrong here?
Why do GnuPG 2 and gpg-connect-agent fail with ERR 67108983 No SmartCard daemon?
debian;smartcard;gnupg;yubikey;openpgp
scdaemon is missingGnuPG 2 connects to the card through gpg-agent, which again does not include smart card capabilities, but accesses them through another application. This can be configured and has a system-dependent default, from man gpg-agent:--scdaemon-program filename      Use program filename as the Smartcard daemon.  The default is      installation dependent and can be shown with the gpgconf command.Doing so reveals GnuPG tries to run /usr/lib/gnupg2/scdaemon:$ gpgconfgpg:GPG fr OpenPGP:/usr/bin/gpg2gpg-agent:GPG Agent:/usr/bin/gpg-agentscdaemon:Smartcard Daemon:/usr/lib/gnupg2/scdaemon[snip]But this is not available:$ /usr/lib/gnupg2/scdaemonbash: /usr/lib/gnupg2/scdaemon2: No such file or directoryInstalling scdaemonA quick query through apt-cache reveals that Debian pulled the scdaemon  out of the gnupg2 package, likely because it introduces a bunch of new dependencies GnuPG otherwise wouldn't have:Package: scdaemonSource: gnupg2Version: 2.1.10-3Installed-Size: 538Maintainer: Debian GnuPG Maintainers <pkg-gnupg-maint@lists.alioth.debian.org>Architecture: amd64Replaces: gpgsm (<< 2.0.18-2)Depends: gnupg-agent (= 2.1.10-3), libassuan0 (>= 2.2.0), libc6 (>= 2.15),  libgcrypt20 (>= 1.6.1), libgpg-error0 (>= 1.14), libksba8 (>= 1.2.0),  libnpth0 (>= 0.90), libusb-0.1-4 (>= 2:0.1.12)Breaks: gpgsm (<< 2.0.18-2)Description-en: GNU privacy guard - smart card support GnuPG is GNU's tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. It includes an advanced key management facility and is compliant with the proposed OpenPGP Internet standard as described in RFC4880. . This package contains the smart card program scdaemon, which is used by gnupg-agent to access OpenPGP smart cards.Installing it with sudo apt-get install scdaemon resolves the issue.