[pkg-gnupg-maint] Bug#814584: gnupg2: gpg2 --card-status fail on armel / Raspberry Pi - "Card error"

Petter Reinholdtsen pere at hungry.com
Fri Aug 5 12:01:08 UTC 2016


[NIIBE Yutaka]
> I see the situation.  I have no idea about the segmentation fault.
>
> I don't know if the difference of armel/armhf matters or not.  My
> point was that in order to narrow down an issue (to be fixed), in
> general, it would be better not to change other factors.
>
> While I guess that the major problem is hardware related, I modified
> the ccid-driver of GnuPG so that the difference between PC/SC service
> can be smaller (less factors involved).

I agree.

I decided to test again using an FreedomBox image to reduce the
difference since my initial testing. First I tested using version
2.1.11-7 in Debian testing, and then using version 2.1.14-1 in Debian
experimental.  Both fail.  First the test using testing.


fbx at freedombox:~$ cat .gnupg/scdaemon.conf 
debug-level guru
debug-all
debug-ccid-driver
log-file /run/user/1000/scd.log
verbose
fbx at freedombox:~$ touch /run/user/1000/scd.log; tail -f /run/user/1000/scd.log &
fbx at freedombox:~$ gpg2 --card-status                                           2016-05-22 00:57:45 scdaemon[15783] listening on socket '/home/fbx/.gnupg/S.scdaemon'
2016-05-22 00:57:45 scdaemon[15783] handler for fd -1 started
2016-05-22 00:57:45 scdaemon[15783] DBG: enter: apdu_open_reader: portstr=(null)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: using CCID reader 0 (ID=08E6:3438:X:0)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: idVendor: 08E6  idProduct: 3438  bcdDevice: 0200
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: ChipCard Interface Descriptor:
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bLength                54
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bDescriptorType        33
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bcdCCID              1.01  (Warning: Only accurate for version 1.0)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   nMaxSlotIndex           0
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bVoltageSupport         7  ?
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwProtocols             3  T=0 T=1
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwDefaultClock       4800
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxiumumClock      4800
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bNumClockSupported      0
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwDataRate          12903 bps
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxDataRate      825806 bps
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bNumDataRatesSupp.     53
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxIFSD             254
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwSyncProtocols  00000000 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMechanical     00000000 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwFeatures       00010230
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     Auto clock change
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     Auto baud rate change
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     NAD value other than 0x00 accepted
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     TPDU level exchange
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxCCIDMsgLen       271
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bClassGetResponse      00
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bClassEnvelope         00
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   wlcdLayout           none
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bPINSupport             0 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bMaxCCIDBusySlots       1
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: usb_claim_interface failed: -1
2016-05-22 00:57:45 scdaemon[15783] pcsc_establish_context failed: no service (0x8010001d)
2016-05-22 00:57:45 scdaemon[15783] DBG: leave: apdu_open_reader => slot=-1 [pc/sc]
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> OK GNU Privacy Guard's Smartcard server ready
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 <- GETINFO socket_name
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> D /home/fbx/.gnupg/S.scdaemon
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> OK
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 <- OPTION event-signal=12
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> OK
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 <- GETINFO version
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> D 2.1.11
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> OK
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 <- SERIALNO openpgp
2016-05-22 00:57:45 scdaemon[15783] DBG: enter: apdu_open_reader: portstr=(null)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: using CCID reader 0 (ID=08E6:3438:X:0)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: idVendor: 08E6  idProduct: 3438  bcdDevice: 0200
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: ChipCard Interface Descriptor:
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bLength                54
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bDescriptorType        33
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bcdCCID              1.01  (Warning: Only accurate for version 1.0)
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   nMaxSlotIndex           0
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bVoltageSupport         7  ?
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwProtocols             3  T=0 T=1
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwDefaultClock       4800
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxiumumClock      4800
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bNumClockSupported      0
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwDataRate          12903 bps
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxDataRate      825806 bps
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bNumDataRatesSupp.     53
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxIFSD             254
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwSyncProtocols  00000000 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMechanical     00000000 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwFeatures       00010230
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     Auto clock change
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     Auto baud rate change
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     NAD value other than 0x00 accepted
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:     TPDU level exchange
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   dwMaxCCIDMsgLen       271
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bClassGetResponse      00
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bClassEnvelope         00
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   wlcdLayout           none
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bPINSupport             0 
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver:   bMaxCCIDBusySlots       1
2016-05-22 00:57:45 scdaemon[15783] DBG: ccid-driver: usb_claim_interface failed: -1
2016-05-22 00:57:45 scdaemon[15783] pcsc_establish_context failed: no service (0x8010001d)
2016-05-22 00:57:45 scdaemon[15783] DBG: leave: apdu_open_reader => slot=-1 [pc/sc]
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> ERR 100663404 Card error <SCD>
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error
fbx at freedombox:~$ 2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 <- RESTART
2016-05-22 00:57:45 scdaemon[15783] DBG: chan_5 -> OK


Next, after running 'apt install -t experimental gnupg2 scdaemon', I got
this result:
fbx at freedombox:~$ killall gpg-agent scdaemon          
2016-05-22 01:04:09 scdaemon[15783] DBG: chan_5 <- [eof]
2016-05-22 01:04:09 scdaemon[15783] handler for fd -1 terminated
2016-05-22 01:04:09 scdaemon[15783] SIGTERM received - still 0 running threads
2016-05-22 01:04:09 scdaemon[15783] scdaemon (GnuPG) 2.1.11 stopped
fbx at freedombox:~$ 
fbx at freedombox:~$ gpg2 --card-status                  
2016-05-22 01:04:17 scdaemon[16362] listening on socket '/run/user/1000/gnupg/S.scdaemon'
2016-05-22 01:04:17 scdaemon[16362] handler for fd -1 started
2016-05-22 01:04:17 scdaemon[16362] DBG: enter: apdu_open_reader: portstr=(null)
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: usb_open failed: LIBUSB_ERROR_ACCESS
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: failed to open '/dev/cmx0': No such file or directory
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: failed to open '/dev/cmx1': No such file or directory
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: no CCID reader with number 0
2016-05-22 01:04:17 scdaemon[16362] pcsc_establish_context failed: no service (0x8010001d)
2016-05-22 01:04:17 scdaemon[16362] DBG: leave: apdu_open_reader => slot=-1 [pc/sc]
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> OK GNU Privacy Guard's Smartcard server ready
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 <- GETINFO socket_name
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> D /run/user/1000/gnupg/S.scdaemon
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> OK
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 <- OPTION event-signal=12
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> OK
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 <- GETINFO version
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> D 2.1.14
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> OK
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 <- SERIALNO openpgp
2016-05-22 01:04:17 scdaemon[16362] DBG: enter: apdu_open_reader: portstr=(null)
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: usb_open failed: LIBUSB_ERROR_ACCESS
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: failed to open '/dev/cmx0': No such file or directory
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: failed to open '/dev/cmx1': No such file or directory
2016-05-22 01:04:17 scdaemon[16362] DBG: ccid-driver: no CCID reader with number 0
2016-05-22 01:04:17 scdaemon[16362] pcsc_establish_context failed: no service (0x8010001d)
2016-05-22 01:04:17 scdaemon[16362] DBG: leave: apdu_open_reader => slot=-1 [pc/sc]
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> ERR 100663404 Card error <SCD>
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 <- RESTART
2016-05-22 01:04:17 scdaemon[16362] DBG: chan_5 -> OK
fbx at freedombox:~$ 

So I guess it is one step forward, two steps back. :(

> Well, if you would like to change other factors to get success anyway,
> I'd recommend to take some hardware approach which possibly may
> stabilize the USB communication:
>
>   (1) Use good voltage supply to RPi board.
>
>   (2) Only connect the card reader (+ the smart card) to USB port of
>       RPi so that we can minimize the load of USB.  If you connect
>       keyboard and mouse, try good ones (or none by using the
>       network).
>
>   (3) Use a USB HUB with an external voltage supply to connect the
>       card reader.

I've tried all three adjustments, did not make a difference. :(

I bought the the card and reader I am using from
<URL: http://shop.kernelconcepts.de/ >.  They work fine using amd64, but
not at all using armel. :(

-- 
Happy hacking
Petter Reinholdtsen



More information about the pkg-gnupg-maint mailing list