Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 165493 - app-crypt/pinentry-0.7.2 - gtk2 fails with "** ERROR **: could not grab keyboard"
Summary: app-crypt/pinentry-0.7.2 - gtk2 fails with "** ERROR **: could not grab keybo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Crypto team [DISABLED]
URL: https://bugs.g10code.com/gnupg/issue798
Whiteboard:
Keywords:
Depends on:
Blocks: 159851
  Show dependency tree
 
Reported: 2007-02-05 20:19 UTC by Maurice van der Pot (RETIRED)
Modified: 2007-12-20 20:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
pinentry-0.7.2-debug.patch (pinentry-0.7.2-debug.patch,629 bytes, patch)
2007-02-05 20:49 UTC, Alon Bar-Lev (RETIRED)
Details | Diff
pinentry-0.7.2-debug.patch (pinentry-0.7.2-debug.patch,660 bytes, patch)
2007-02-06 17:48 UTC, Alon Bar-Lev (RETIRED)
Details | Diff
fix (0.7.2-grab_keyboard.patch,658 bytes, patch)
2007-06-15 14:09 UTC, Vincent Pit
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maurice van der Pot (RETIRED) gentoo-dev 2007-02-05 20:19:23 UTC
Some kind of race condition is causing my gpg to fail.
I can run gpg --sign several times and it will sometimes succeed.

When it succeeds, I get a dialog asking for a passphrase. When it fails I can sometimes see the dialog for a fraction of a second, but then it aborts.

This is the output when it fails:

  griffon26@griffon27 ~> gpg --sign

  You need a passphrase to unlock the secret key for
  user: "Maurice van der Pot (Griffon26) <griffon26@gentoo.org>"
  1024-bit DSA key, ID B79A871C, created 2004-07-17


  ** ERROR **: could not grab keyboard
  aborting...
  gpg-agent[5940]: command get_passphrase failed: End of file
  gpg: problem with the agent: IPC write error
  gpg: Invalid passphrase; please try again ...
 
  You need a passphrase to unlock the secret key for
  user: "Maurice van der Pot (Griffon26) <griffon26@gentoo.org>"
  1024-bit DSA key, ID B79A871C, created 2004-07-17

  gpg: problem with the agent: IPC write error
  gpg: no default secret key: General error
  gpg: signing failed: General error

This has been happening since my upgrade to gnupg 2.0.

It's currently preventing me from signing manifests.

[ebuild   R   ] app-crypt/pinentry-0.7.2-r3  USE="gtk ncurses -caps -qt3" 390 kB 
[ebuild   R   ] app-crypt/gnupg-2.0.2  USE="X bzip2 -doc -ldap -nls -openct -pcsc-lite (-selinux) -smartcard" 0 kB
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2007-02-05 20:49:56 UTC
Created attachment 109261 [details, diff]
pinentry-0.7.2-debug.patch

Hmmm.... It seems that gdk_keyboard_grab is failing in pinentry.
Have you used the same pinentry with gpg-1.4.X?

Can you please try to apply the following patch so we know what is the error code?

Thanks!
Comment 2 Maurice van der Pot (RETIRED) gentoo-dev 2007-02-05 21:04:09 UTC
And the winner is...

** ERROR **: could not grab keyboard (3)
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2007-02-05 21:07:52 UTC
GDK_GRAB_NOT_VIEWABLE  the grab window or the confine_to window are not viewable.

You did not answer, have you used the same pinentry with previous version?
Comment 4 Alon Bar-Lev (RETIRED) gentoo-dev 2007-02-05 21:12:17 UTC
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401957
Comment 5 Maurice van der Pot (RETIRED) gentoo-dev 2007-02-05 21:19:15 UTC
It doesn't look like it. According to emerge.log pinentry was first installed
in january 2007 and my last successful signing was done in october 2006.
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2007-02-06 07:17:40 UTC
Have you tried the solution in comment#4?
Comment 7 Alon Bar-Lev (RETIRED) gentoo-dev 2007-02-06 17:48:13 UTC
Created attachment 109354 [details, diff]
pinentry-0.7.2-debug.patch

Please try this one, it is the patch from comment#4.
Comment 8 Maurice van der Pot (RETIRED) gentoo-dev 2007-02-06 18:36:30 UTC
I tried it. It didn't change anything afaics.
Comment 9 Alon Bar-Lev (RETIRED) gentoo-dev 2007-03-09 19:21:55 UTC
Hello gnome,
I will appreciate any thought regardging this issue.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-03-09 19:37:54 UTC
Here's the relevant portion of code from pinentry:
 88 /* Grab the keyboard for maximum security */
 89 static void
 90 grab_keyboard (GtkWidget *win, GdkEvent *event, gpointer data)
 91 {
 92   if (!pinentry->grab)
 93     return;
 94 
 95   if (gdk_keyboard_grab (win->window, FALSE, gdk_event_get_time (event)))
 96     g_error ("could not grab keyboard");
 97 }
Comment 11 Daniel Gryniewicz (RETIRED) gentoo-dev 2007-03-09 20:29:43 UTC
Looking at it, the patch in comment #7 should probably work.  Without more info (does the error code change with that patch?) I can't help more...
Comment 12 Alon Bar-Lev (RETIRED) gentoo-dev 2007-03-09 20:37:44 UTC
(In reply to comment #11)
> Looking at it, the patch in comment #7 should probably work.  Without more info
> (does the error code change with that patch?) I can't help more...
> 

Thanks!
As per comment#8, it seems that the same error code is produced...
Maurice: Can you please re-verify that?
Comment 13 Maurice van der Pot (RETIRED) gentoo-dev 2007-03-10 10:52:45 UTC
Done. There is no change. It still fails sometimes with the same error code.
Comment 14 Alon Bar-Lev (RETIRED) gentoo-dev 2007-05-18 21:56:26 UTC
Finally, can open bugs in upstream.
Comment 15 Vincent Pit 2007-06-15 14:09:42 UTC
Created attachment 122155 [details, diff]
fix

This patch changes the map/unmap events, that seem to occur too early, with expose/no-expose events. This seems to fix the bug.
Comment 16 Maurice van der Pot (RETIRED) gentoo-dev 2007-06-15 15:41:14 UTC
Yes, it looks like this patch solves the problem. Thanks!
Comment 17 Alon Bar-Lev (RETIRED) gentoo-dev 2007-06-15 16:26:07 UTC
Thank you!!!
Comment 18 Alon Bar-Lev (RETIRED) gentoo-dev 2007-12-20 20:20:58 UTC
Please check 0.7.4, werner reverted this patch with something else...
Thanks!
Comment 19 Maurice van der Pot (RETIRED) gentoo-dev 2007-12-20 20:31:26 UTC
Thanks for the heads-up. And you were right to be concerned; the problem is back again. 

Pinentry 0.7.4 is broken:

/pinentry> pinentry 
OK Your orders please
GETPIN

** ERROR **: could not grab keyboard
aborting...
Aborted
/pinentry>
Comment 20 Alon Bar-Lev (RETIRED) gentoo-dev 2007-12-20 20:43:23 UTC
Thanks!
I don't know how you can reproduce this.
Patch readded.