pcscd spams to syslog and kern.log after enabling smartcard reader in VMWare Workstation

Bug #787451 reported by Ochir
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
pcsc-lite (Ubuntu)
Confirmed
Undecided
Ludovic Rousseau

Bug Description

Info:
Ubuntu 11.04 amd64

pcscd:
  Installed: 1.7.0-2ubuntu2
  Candidate: 1.7.0-2ubuntu2
  Version table:
 *** 1.7.0-2ubuntu2 0
        500 http://ru.archive.ubuntu.com/ubuntu/ natty/universe amd64 Packages
        100 /var/lib/dpkg/status

libccid:
  Installed: 1.4.2-2
  Candidate: 1.4.2-2
  Version table:
 *** 1.4.2-2 0
        500 http://ru.archive.ubuntu.com/ubuntu/ natty/universe amd64 Packages
        100 /var/lib/dpkg/status

libpcsclite1:
  Installed: 1.7.0-2ubuntu2
  Candidate: 1.7.0-2ubuntu2
  Version table:
 *** 1.7.0-2ubuntu2 0
        500 http://ru.archive.ubuntu.com/ubuntu/ natty/main amd64 Packages
        100 /var/lib/dpkg/status

 pcscd --version
pcsc-lite version 1.7.0.
Copyright (C) 1999-2002 by David Corcoran <email address hidden>.
Copyright (C) 2001-2010 by Ludovic Rousseau <email address hidden>.
Copyright (C) 2003-2004 by Damien Sauveron <email address hidden>.
Report bugs to <email address hidden>.
Enabled features: Linux x86_64-pc-linux-gnu serial usb libudev usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd configdir=/etc/reader.conf.d

smart card is JCOP 31.

VMWare Workstation version is 7.1.4 build-385536

Steps for bug reproducing:
1) Launch VMWare OS. In my case this is Windows 7 but I guess it doesn't matter.

2) Connect SmartCard reader to VMWare OS. Reader's model is SCM SCR3110. This is supported by libccid 1.4.2.

3) At this moment, syslog is spamed by pcscd process. The following strings can be found in syslog:
May 24 13:10:02 computer-name pcscd: ccid_usb.c:618:WriteUSB() write failed (8/2): -1 Device or resource busy
May 24 13:10:02 computer-name pcscd: ifdwrapper.c:346:IFDStatusICC() Card not transacted: 612
May 24 13:10:02 computer-name pcscd: eventhandler.c:303:EHStatusHandlerThread() Error communicating to: SCM SCR 3310 [CCID Interface] (21120818206778) 00 00
May 24 13:10:02 computer-name pcscd: ccid_usb.c:618:WriteUSB() write failed (8/2): -1 Device or resource busy
May 24 13:10:02 computer-name pcscd: ifdwrapper.c:346:IFDStatusICC() Card not transacted: 612
May 24 13:10:02 computer-name pcscd: eventhandler.c:303:EHStatusHandlerThread() Error communicating to: SCM SCR 3310 [CCID Interface] (21120818206778) 00 00
May 24 13:10:02 computer-name pcscd: ccid_usb.c:618:WriteUSB() write failed (8/2): -1 Device or resource busy
May 24 13:10:02 computer-name pcscd: ifdwrapper.c:346:IFDStatusICC() Card not transacted: 612
May 24 13:10:02 computer-name pcscd: eventhandler.c:303:EHStatusHandlerThread() Error communicating to: SCM SCR 3310 [CCID Interface] (21120818206778) 00 00
May 24 13:10:02 computer-name pcscd: ccid_usb.c:618:WriteUSB() write failed (8/2): -1 Device or resource busy
May 24 13:10:02 computer-name pcscd: ifdwrapper.c:346:IFDStatusICC() Card not transacted: 612
May 24 13:10:02 computer-name pcscd: eventhandler.c:303:EHStatusHandlerThread() Error communicating to: SCM SCR 3310 [CCID Interface] (21120818206778) 00 00
May 24 13:10:02 computer-name pcscd: ccid_usb.c:618:WriteUSB() write failed (8/2): -1 Device or resource busy
....

4) The log size rapidly increases. It takes several minutes to reach 20 Gb.

5) After disconnecting smartcard reader, the following string can be found in syslog:
...
May 24 13:12:41 computer-name kernel: [75680.065939] usb 8-2: usbfs: process 2956 (pcscd) did not claim interface 0 before use
May 24 13:12:41 computer-name kernel: [75680.065996] usb 8-2: usbfs: process 2956 (pcscd) did not claim interface 0 before use
May 24 13:12:41 computer-name kernel: [75680.066000] usb 8-2: usbfs: process 2956 (pcscd) did not claim interface 0 before use
May 24 13:12:41 computer-name kernel: [75680.066057] usb 8-2: usbfs: process 2956 (pcscd) did not claim interface 0 before use
May 24 13:12:41 computer-name kernel: [75680.066211] usb 8-2: usbfs: process 2956 (pcscd) did not claim interface 0 before use

Also this messages are written in kern.log

6) The problem is solved by restarting of computer.

I cannot attach syslog and kern.log due to huge size.

Ochir (oabushinov)
description: updated
Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :
Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

vmware workstation is doing something very bad.

When you want to enable the smart card reader you have the message:
" This VM is trying to claim a USB device that is already attached to another virtual machine (process:27307 /usr/sbin/pcscd). This operation will fail unless the device is first disconnected from the other VM. "

If you select OK the operation will NOT fail but pcscd (the CCID driver in fact) will be disoriented. The USB device has been removed from under its feet.

If you want to avoid this problem you have to use the virtual smart card reader in workstation.

In my case vmware player proposes 2 smart card readers: "Gemplus USB SmartCard reader" and "Virtual Gemalto GemPC Twin 00 00". The first reader is the real USB device. The second reader is in fact the reader also available through the local PC/SC layer.

Your choices are either:
1. use the Virtual smart card reader in Workstation
2. kill the local pcscd before using the real USB device in Workstation

The problem is not in pcsc-lite. I will not fix this bug.

Changed in pcsc-lite (Ubuntu):
status: New → Confirmed
assignee: nobody → Ludovic Rousseau (ludovic-rousseau-gmail)
Revision history for this message
Ochir (oabushinov) wrote :

thanks, I'll try to reassign bug to VMWare support.

Revision history for this message
Krisztian Poos (rocky-poos) wrote :

It is also existing on my system when I use smartcard under Virtualbox. This is surely related to the host machine.

Revision history for this message
Krisztian Poos (rocky-poos) wrote :

However disabling the pcscd daemon on the host as you said before did the trick :)

Revision history for this message
alfa111 (alfa111) wrote :

I have the same problem under VirtualBox (v 3.2, v 4.1.2). Host system Ubuntu 10.04, guest system Ubuntu 11.04 (pcsc-lite 1.7.0). Host system has disabled pcscd starting.
When I use RHEL 5.5 (pcsc-lite-1.4.4) as guest, it is running perfectly.

Revision history for this message
pkrishn6 (surfprasanna) wrote :

Ludovic Rousseau,

Hello. I am a VMware USb developer and I am trying to deal with this issue. What we when an user wants to connect a physical device to the guest aka passthrogh is to knock off the current driver loaded for the device and claim the interfaces. While this approach works if a kernel driver is loaded against the device, it does not if pcscd/libccid is the driver.

I do not get an error from usbfs but my demsg buffer is filled with vmx-tried to use interface 0 before claiming.

Any suggestions how else we could address this problem?

I do not have examples of knocking off other user space drivers working well., since other USB device (mass storage, audio, video) use kernel drivers.

Revision history for this message
pkrishn6 (surfprasanna) wrote :

As you previously mentioned, Killing pcscd or using the virtual smart card is definitely an option but neither is hollistic since a user might want to share one of the physical smart cards between the guest and host but might want to passthrough another smart card reader.

We rely on pcscd for our virtual smart card backend.

Revision history for this message
Ludovic Rousseau (ludovic-rousseau-gmail) wrote :

pkrishn6, libccid is using libusb. libusb is using a generic USB kernel driver. I do not remember its name.

Another option is to add an option to tell pcscd to remove a USB reader. Maybe you can send a fake "unplug" udev event.

Revision history for this message
Erki Hallingu (erkiha) wrote :

I'm still having the same issue: in Ubuntu 18.04 and Virtualbox 5.2.2.

Disabling pcscd before attaching reader to virtualbox removes the log flooding. But its very inconvinient. I have two card readers and I need to use one for host (ubuntu) and one for guest (windows). Is there a way to disable one card reader in pcscd to reserve it for guest windows?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.