Red Hat Bugzilla – Bug 815639
[virt-viewer]virt-viewer failed to initialize smartcard when using reconnect&wait
Last modified: 2013-11-21 03:24:13 EST
Description of problem: virt-viewer failed to initialize smartcard when using --reconnect & --wait. Version-Release number of selected component (if applicable): virt-viewer-0.5.2-6.el6.x86_64 spice-gtk-0.11-8.el6.x86_64 spice-server-0.10.1-5.el6.x86_64 spice-glib-0.11-8.el6.x86_64 pam_pkcs11-0.6.2-11.1.el6.x86_64 How reproducible: always Steps to Reproduce: 1. Imaging there is a running guest, and executed #yum groupinstall "smart card support". 2. run command in client: #virt-viewer --spice-smartcard --connect qemu:///system $guest 3. make sure the smardcard can login guest gdm,and use pklogin_finder can read the smartcard. 4. close virt-viewer,re-run virt-viewer in client: #virt-viewer --spice-smartcard --reconnect --wait --connect qemu:///system $guest 5. in another console,use virsh restart the guest #virsh destroy $guest #virsh start $guest 6. login guest via virt-viewer,make sure service pcscd start 7. run in guest console #pklogin_finder debug Actual results: after step 5,virt-viewer throws a warning: Failed to initialize smartcard smart card can't worked in guest Expected results: using reconnect and wait ,should keep smartcard worked when guest restart. Additional info: when use --spice-color-depth& --spice-disable-effects with --reconnect --wait,they all worked well.
I can reproduce this, the steps from rhbz#815175 can be followed to create a software smartcard and test with that. I'm using pcsc_scan to check for the presence or absence of a smartcard.
Initial investigation shows that it's the vcard_emul_init call from smartcard_manager_init which fails because libcacard is already initialized. This can be workarounded with something like this: From 9acba6054dbc94447837e7049c8ff2f86b47b225 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau <cfergeau@redhat.com> Date: Wed, 25 Apr 2012 19:17:00 +0200 Subject: [PATCH] Don't fail when vcard_emul_init has already been called --- gtk/smartcard-manager.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c index 8e22e6c..f1d5836 100644 --- a/gtk/smartcard-manager.c +++ b/gtk/smartcard-manager.c @@ -457,7 +457,7 @@ static gboolean smartcard_manager_init(SpiceSession *session, init: SPICE_DEBUG("vcard_emul_init"); - if (vcard_emul_init(options) != VCARD_EMUL_OK) { + if (vcard_emul_init(options) == VCARD_EMUL_FAIL) { *err = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, "Failed to initialize smartcard"); -- 1.7.1 but more investigation is needed because the smartcard is still not working after that.
By the way, this can be reassigned to spice-gtk.
Since RHEL 6.3 External Beta has begun, and this bug remains unresolved, it has been rejected as it is not proposed as exception or blocker. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
Actually, a variant of the patch from comment #3 works. Patch sent upstream: http://lists.freedesktop.org/archives/spice-devel/2013-July/013888.html
reproduced - qa_ack+ note that the smart card support doesn't have to be configured or even installed in the guest at all, the error message appears right after second start of the guest during virt-viewer lifetime.
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. http://rhn.redhat.com/errata/RHBA-2013-1577.html