Bug 19673

Summary: Impossible to create GPG key
Product: Mageia Reporter: André LAUMAILLIER <alaum>
Component: RPM PackagesAssignee: All Packagers <pkg-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: cae, cooker, eatdirt, fundawang, luigiwalser, marja11, olav
Version: CauldronKeywords: NEEDINFO
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: gnupg2-2.0.30-3.mga6.src.rpm CVE:
Status comment:

Description André LAUMAILLIER 2016-10-27 16:37:53 CEST
Description of problem:
I can't create GPG key with the command "gpg2 --gen-key"
The message is : no pinentry.
However pinentry & pinentry-qt4 are installed

Version-Release number of selected component (if applicable):
pinentry-0.9.7-1.mga6

How reproducible:
Every time I attempt to create GPG key

Steps to Reproduce:
1.gpg2 --gen-key
2.pb with agent : no pinentry
3.
Comment 1 Charles Edwards 2016-10-27 17:37:57 CEST
Can you try adding this to your ~.bashrc 

GPG_TTY=$(tty)
export GPG_TTY

Then manually issue the 2 commands or log-out log-in to your WM.

Are you now able to generate the gpg2 key?

CC: (none) => cae

Comment 2 Marja Van Waes 2016-10-27 18:34:53 CEST
Assigning to all packagers collectively, since there is no registered maintainer for this package.

Keywords: (none) => NEEDINFO
CC: (none) => cooker, eatdirt, fundawang, luigiwalser, marja11, olav
Assignee: bugsquad => pkg-bugs

Comment 3 Chris Denice 2016-10-27 18:37:58 CEST
Works for me with no GPG_TTY environment variable set.

gpg2 --gen-key
gpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection?
Comment 4 André LAUMAILLIER 2016-10-27 19:48:56 CEST
(In reply to Charles Edwards from comment #1)
> Can you try adding this to your ~.bashrc 
> 
> GPG_TTY=$(tty)
> export GPG_TTY
> 
> Then manually issue the 2 commands or log-out log-in to your WM.
> 
> Are you now able to generate the gpg2 key?

I get the them result.

I tried gnugpg 1.4, it work well.
Comment 5 André LAUMAILLIER 2016-10-27 19:49:18 CEST
(In reply to Chris Denice from comment #3)
> Works for me with no GPG_TTY environment variable set.
> 
> gpg2 --gen-key
> gpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Please select what kind of key you want:
>    (1) RSA and RSA (default)
>    (2) DSA and Elgamal
>    (3) DSA (sign only)
>    (4) RSA (sign only)
> Your selection?

1
Comment 6 Chris Denice 2016-11-03 11:12:53 CET
Ok, thanks, confirmed!
Comment 7 Chris Denice 2016-11-03 11:46:37 CET
Ok, a fix is to specify manually a pinentry-program that also works from a terminal.
If I add "--pinentry-program /usr/bin/pinentry-curses" in /etc/sysconfig/gnupg2 it works fine.
I am not sure this will not break gnupg2 with GUI though?
Comment 8 Chris Denice 2016-11-03 12:11:52 CET
Ok, I have pushed a new pinentry-0.9.7-2 with some compilation flags switched on for allowing fallback to ncurses (and adding pinentry-tty).
This fixes the pb for me, please check.

Don't forget to restart the agent (or reboot) after the update:
systemctl --user restart gpg-agent.service

Cheers.
Comment 9 André LAUMAILLIER 2016-11-05 13:30:17 CET
(In reply to Chris Denice from comment #8)
> Ok, I have pushed a new pinentry-0.9.7-2 with some compilation flags
> switched on for allowing fallback to ncurses (and adding pinentry-tty).
> This fixes the pb for me, please check.
> 
> Don't forget to restart the agent (or reboot) after the update:
> systemctl --user restart gpg-agent.service
> 
> Cheers.

Good it works well ;-)
Comment 10 Chris Denice 2016-11-05 18:58:13 CET
Perfect, closing then!

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 11 Chris Denice 2016-11-18 14:01:19 CET
Some update.

To fix https://bugs.mageia.org/show_bug.cgi?id=19391, I have disabled the --keep-display option in gpg2 2.0.30-4.mga6

Which means, if you gpg2 --gen-key in a terminal within X environment, a windows to enter you pin should appear. If you do gpg2 --gen-key under a tty, obviously no window can appear, but you should still be able to enter your pin on the command line.

Please reopen this bug if this fails.
Cheers.