Skip to main content

Troubleshooting smartcard reader

Check user rights

On debian / Ubuntu, only root and members of group scard can use smart card readers. To add user foo to group scard:

$ adduser foo scard

Check OpenSC version

Check that you have a recent OpenSC version with openssl and pcsc support:

$ opensc-tool --verbose --info
opensc 0.12.2 [gcc 4.4.3]
Enabled features: zlib readline iconv openssl openct pcsc(libpcsclite.so.1)

You need at least OpenSC 0.12.2, which solves several issues. If your system does not provide a recent version of OpenSC, upgrade your distribution or compile from sources using OpenSC svn version.

Check recognition

Check that the card reader is correctly recognized by OpenSC:

$ opensc-tool -l
Readers known about:
Nr. Driver Name
0 pcsc OmniKey CardMan 3121 00 00

At nr. 0 we have our recognized Omnikey CardMan 3121 reader.

Detailed opensc logging

It is a good practice to log to /tmp or /var/log/ during initial configuration.
The only difference is that /tmp is wiped during reboot.

For detailed logging, please edit /etc/opensc/opensc.conf with the following values:

app default {
debug = 9;
debug_file = /tmp/opensc-debug.log;
}

Be warned that the log may contain your PIN code.

Detailed pcsc logging

Start pcsd using detailed logging:

sudo service pcscd stop ; sudo LIBCCID_ifdLogLevel=0x000F pcscd --foreground --debug --apdu | tee log.txt

Stop pcscd using Control-C and send log file.
The file can be huge as this is a complete dump.