Bug 1171118

Summary: pcscd.comm and pcscd.pub are not removed on service-shutdown or -restart, restart fails due to this
Product: Red Hat Enterprise Linux 6 Reporter: Gerrit Slomma <gerrit.slomma>
Component: pcsc-liteAssignee: Bob Relyea <rrelyea>
Status: CLOSED ERRATA QA Contact: Asha Akkiangady <aakkiang>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.6CC: arubin, ludovic.rousseau, rpattath
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: pcsc-lite-1.5.2-15.el6 Doc Type: Bug Fix
Doc Text:
On systems with the pcsc-lite-openct package uninstalled, if the pcscd service terminated unexpectedly or was killed, restarting or stopping and starting pcscd failed. This update modifies pcscd to remove the pcscd.comm and pcscd.pub files after pcscd terminates unexpectedly or is killed. As a result, pcscd can be restarted or stopped and started again as expected in the described situation. (BZ#1171118)
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:06:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gerrit Slomma 2014-12-05 11:39:26 UTC
Description of problem:

If stoped or restarted pcscd or corresponding init-script fails to remove pcscd.comm and pcscd.pub. Therefore pcscd remains in stopped state and can not be restarted before these two files are deleted manually

Version-Release number of selected component (if applicable):

yum list pcsc-lite
pcsc-lite.x86_64                                             1.5.2-13.el6_4
pcsc-lite.x86_64                                             1.5.2-14.el6

How reproducible:

do a /etc/init.d/pcscd restart or /etc/init.d/pcscd stop

Steps to Reproduce:
1. /etc/init.d/pcscd stop
2. /etc/init.d/pcscd start (fails!)
3. rm /var/run/pcscd.comm /var/run/pcscd.pub -f
4. /etc/init.d/pcscd start (succeeds)

OR

1. /etc/init.d/pcscd restart (fails!)
3. rm /var/run/pcscd.comm /var/run/pcscd.pub -f
4. /etc/init.d/pcscd start (succeeds)

Actual results:

pcscd is not restarted.

Expected results:

pcscd is restarted.

Additional info:

Problem does surface if pcsc-lite-openct is installed with pcsc-lite and removed afterwards. 
At least Red Hat Enterprise Linux 6.5 and 6.6 with corresponding pcsc-lite-packages are affected.

Comment 2 Ludovic Rousseau 2014-12-05 12:06:54 UTC
pcsc-lite do not use /var/run/pcscd.pub since version 1.6.0 (May 2010).

I guess this bug is already fixed in a "recent" version of pcsc-lite.

Comment 3 Gerrit Slomma 2014-12-05 15:01:36 UTC
that may be, but as it is i am stuck with the version that Red Hat Enterprise Linux 6 provides.

Comment 4 Bob Relyea 2015-01-09 19:43:59 UTC
marking dev_ack+ to investicate

Comment 5 Bob Relyea 2015-02-25 22:30:25 UTC
Gerrit, pcscd removes those files when it stops on it's own. The only issue is when it crashes, or is killed with kill -KILL

I've seen other weirdness when you install pcsc-lite-openct and then uninstall it. That's because pcsc-lite-openct will pull in openct. If you have openct installed and pcsc-lite, but not pcsc-lite-openct pcsc-lite and openct will conflict.

yum remove openct

should fix your issue.

I'll still look into removing those files on stop as a robustness improvement.

Asha: here's how you can reliably reproduce the issue:

as root:
# service pcscd start   --> #(make sure pcscd is started)
Starting PC/SC smart card daemon (pcscd): 
  --> or
Starting PC/SC smart card daemon (pcscd):                  [  OK  ]
# service pcscd status  #(get the pid of the pcscd process)
pcscd (pid  15349) is running...
  --> pid number will vary use the number above in the command below
# kill -KILL 15349
# service pcscd stop
Stopping PC/SC smart card daemon (pcscd):                  [FAILED]
  --> failure is expected, the daemon is not running
# service pcscd start
Starting PC/SC smart card daemon (pcscd):                  [FAILED]
  --> this will be [ OK ] after the patch.

Note: start will not work until you do a stop if you kill by hand, or pcscd crashes.

Comment 7 Roshni 2015-04-13 13:32:09 UTC
[root@dhcp129-124 sctests]# rpm -qi pcsc-lite
Name        : pcsc-lite                    Relocations: (not relocatable)
Version     : 1.5.2                             Vendor: Red Hat, Inc.
Release     : 15.el6                        Build Date: Thu 26 Feb 2015 08:39:13 PM EST
Install Date: Fri 10 Apr 2015 12:06:37 PM EDT      Build Host: x86-031.build.eng.bos.redhat.com
Group       : System Environment/Daemons    Source RPM: pcsc-lite-1.5.2-15.el6.src.rpm
Size        : 402732                           License: BSD
Signature   : RSA/8, Wed 04 Mar 2015 07:22:07 AM EST, Key ID 938a80caf21541eb
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://pcsclite.alioth.debian.org/
Summary     : PC/SC Lite smart card framework and applications

Verification steps

1. yum install openct
2. # service pcscd status  
pcscd (pid  15349) is running...
# kill -KILL 15349
# service pcscd stop
Stopping PC/SC smart card daemon (pcscd):                  [FAILED]
# service pcscd start
Starting PC/SC smart card daemon (pcscd):                  [  OK  ]

Comment 8 errata-xmlrpc 2015-07-22 07:06:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1369.html