gpg-agent has to be restarted after GnuPG SmartCard pulled from reader

gnupg-users.dirk at o.banes.ch gnupg-users.dirk at o.banes.ch
Wed Jan 4 17:15:16 CET 2017


Hello all,

I recently changed to the GnuPG Smartcard which in general works fine
for eMail and for SSH authentication (on Ubuntu 16.10).
The only problem I encountered was that when I pull the card from the
reader and reinsert it the gpg-agent will not recover.

I have to kill him gpgconf --kill gpg-agent.

I checked the logs for gpg-agent, scdaemon and pcscd.
The only suspicious I found was this in the pcscd output.

#normal operation

00500755 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 14
00500775 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 14
00500746 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 14
00500754 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 14

#remove card

00481042 eventhandler.c:357:EHStatusHandlerThread() Card Removed From
OMNIKEY AG 3121 USB 00 00
00019695 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 14


#insert card

03660811 ifdhandler.c:1146:IFDHPowerICC() action: PowerUp,
usb:076b/3022:libudev:0:/dev/bus/usb/001/008 (lun: 0)
0032199 eventhandler.c:405:EHStatusHandlerThread() powerState:
POWER_STATE_POWERED
00000025 eventhandler.c:422:EHStatusHandlerThread() Card inserted into
OMNIKEY AG 3121 USB 00 00
00000013 Card ATR: 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00
90 00 0C

#query card

02063947 winscard_msg_srv.c:253:ProcessEventsServer() Common channel
packet arrival
00000025 winscard_msg_srv.c:265:ProcessEventsServer()
ProcessCommonChannelRequest detects: 15
00000007 pcscdaemon.c:134:SVCServiceRunLoop() A new context thread
creation is requested: 15
00000093 winscard_svc.c:331:ContextThread() Authorized PC/SC client
00000018 winscard_svc.c:335:ContextThread() Thread is started:
dwClientID=15, threadContext @0x9d5560
00000019 winscard_svc.c:353:ContextThread() Received command:
CMD_VERSION from client 15
00000009 winscard_svc.c:365:ContextThread() Client is protocol version 4:3
00000006 winscard_svc.c:385:ContextThread() CMD_VERSION rv=0x0 for client 15
00000083 winscard_svc.c:353:ContextThread() Received command:
ESTABLISH_CONTEXT from client 15
00000014 winscard.c:215:SCardEstablishContext() Establishing Context:
0x5FFCC3AF
00000005 winscard_svc.c:446:ContextThread() ESTABLISH_CONTEXT rv=0x0 for
client 15
00000059 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 15
00000037 winscard_svc.c:353:ContextThread() Received command:
CMD_GET_READERS_STATE from client 15
00000269 winscard_svc.c:353:ContextThread() Received command: CONNECT
from client 15
00000035 winscard_svc.c:484:ContextThread() Authorized client for
'OMNIKEY AG 3121 USB 00 00'
00000006 winscard.c:257:SCardConnect() Attempting Connect to OMNIKEY AG
3121 USB 00 00 using protocol: 3
00000006 readerfactory.c:768:RFReaderInfo() RefReader() count was: 1

# Suspicious ?

00000005 winscard.c:284:SCardConnect() Error Reader Exclusive

00000004 winscard.c:512:SCardConnect() UnrefReader() count was: 2
00000006 winscard_svc.c:498:ContextThread() CONNECT rv=0x8010000B for
client 15
02935987 ifdhandler.c:1146:IFDHPowerICC() action: PowerDown,
usb:076b/3022:libudev:0:/dev/bus/usb/001/008 (lun: 0)
00000474 eventhandler.c:481:EHStatusHandlerThread() powerState:
POWER_STATE_UNPOWERED


I can not figure out what is the problem. Neiter I found anything in the
documentation / google . Is this  common ? 

Does anyone have an ideas where this problem comes from ?
Maybe it is just that I'm doing something wrong.
Happy to provide more information if needed.

thanks and best regards

Dirk






More information about the Gnupg-users mailing list